Package com.sun.identity.sae.api
Class Utils
- java.lang.Object
-
- com.sun.identity.sae.api.Utils
-
public class Utils extends Object
Util class to implement simple Http request/response transactions.
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formFromMap(String redirectUrl, Map pmap, boolean addAutoSubmit)
Generates a html hidden form to acccomplish a auto POST from the browser Form is assigned an id=saeformstatic String
queryStringFromMap(Map pmap)
Generates a query string from the aMap
.static String
queryStringFromRequest(jakarta.servlet.http.HttpServletRequest request)
Generates a query string from the parameters in the request.static void
redirect(jakarta.servlet.http.HttpServletResponse hres, PrintWriter out, String redirectUrl, Map pmap, String action)
Redirects toredirectUrl
as a GET or a POST based onaction
parameter provided.
-
-
-
Field Detail
-
POST
public static final String POST
Http POST- See Also:
- Constant Field Values
-
GET
public static final String GET
Http GET- See Also:
- Constant Field Values
-
-
Method Detail
-
redirect
public static void redirect(jakarta.servlet.http.HttpServletResponse hres, PrintWriter out, String redirectUrl, Map pmap, String action) throws Exception
Redirects toredirectUrl
as a GET or a POST based onaction
parameter provided. in case of POST all params need to be specified inpmap
parameter.- Parameters:
hres
- HttpSevletResponse to be used for the redirectout
- the print writer for writing out presentationredirectUrl
- URL to redirect to.pmap
- http parameters to be sent as part of the redirectaction
- http action to be executed : GET or POST- Throws:
Exception
-
queryStringFromRequest
public static String queryStringFromRequest(jakarta.servlet.http.HttpServletRequest request)
Generates a query string from the parameters in the request.- Parameters:
request
- http request to pick params from.- Returns:
- query string
-
queryStringFromMap
public static String queryStringFromMap(Map pmap)
Generates a query string from the aMap
.- Parameters:
pmap
- params to be added to the query string.- Returns:
- query string
-
formFromMap
public static String formFromMap(String redirectUrl, Map pmap, boolean addAutoSubmit)
Generates a html hidden form to acccomplish a auto POST from the browser Form is assigned an id=saeform- Parameters:
redirectUrl
- URL to post teh form to.pmap
- parameters to be sent in the POSTaddAutoSubmit
- adds html and javascript to autosubmit form- Returns:
- html code
-
-