Package com.onelogin.saml2.servlet
Class ServletUtils
- java.lang.Object
-
- com.onelogin.saml2.servlet.ServletUtils
-
public class ServletUtils extends java.lang.ObjectServletUtils class of OneLogin's Java Toolkit. A class that contains several auxiliary methods related to HttpServletRequest and HttpServletResponse
-
-
Constructor Summary
Constructors Modifier Constructor Description privateServletUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetSelfHost(javax.servlet.http.HttpServletRequest request)static java.lang.StringgetSelfRoutedURLNoQuery(javax.servlet.http.HttpServletRequest request)Returns the routed URL of the current host + current view.static java.lang.StringgetSelfURL(javax.servlet.http.HttpServletRequest request)Returns the URL of the current context + current view + querystatic java.lang.StringgetSelfURLhost(javax.servlet.http.HttpServletRequest request)Returns the protocol + the current host + the port (if different than common ports).static java.lang.StringgetSelfURLNoQuery(javax.servlet.http.HttpServletRequest request)Returns the URL of the current host + current view.static booleanisHTTPS(javax.servlet.http.HttpServletRequest request)Check if under https or http protocolstatic HttpRequestmakeHttpRequest(javax.servlet.http.HttpServletRequest req)Creates an HttpRequest from an HttpServletRequest.static voidsendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location)Redirect to location urlstatic voidsendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> parameters)Redirect to location urlstatic java.lang.StringsendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Boolean stay)Redirect to location url
-
-
-
Method Detail
-
makeHttpRequest
public static HttpRequest makeHttpRequest(javax.servlet.http.HttpServletRequest req)
Creates an HttpRequest from an HttpServletRequest.- Parameters:
req- the incoming HttpServletRequest- Returns:
- a HttpRequest
-
getSelfURLhost
public static java.lang.String getSelfURLhost(javax.servlet.http.HttpServletRequest request)
Returns the protocol + the current host + the port (if different than common ports).- Parameters:
request- HttpServletRequest object to be processed- Returns:
- the HOST URL
-
getSelfHost
public static java.lang.String getSelfHost(javax.servlet.http.HttpServletRequest request)
- Parameters:
request- HttpServletRequest object to be processed- Returns:
- the server name
-
isHTTPS
public static boolean isHTTPS(javax.servlet.http.HttpServletRequest request)
Check if under https or http protocol- Parameters:
request- HttpServletRequest object to be processed- Returns:
- false if https is not active
-
getSelfURL
public static java.lang.String getSelfURL(javax.servlet.http.HttpServletRequest request)
Returns the URL of the current context + current view + query- Parameters:
request- HttpServletRequest object to be processed- Returns:
- current context + current view + query
-
getSelfURLNoQuery
public static java.lang.String getSelfURLNoQuery(javax.servlet.http.HttpServletRequest request)
Returns the URL of the current host + current view.- Parameters:
request- HttpServletRequest object to be processed- Returns:
- current host + current view
-
getSelfRoutedURLNoQuery
public static java.lang.String getSelfRoutedURLNoQuery(javax.servlet.http.HttpServletRequest request)
Returns the routed URL of the current host + current view.- Parameters:
request- HttpServletRequest object to be processed- Returns:
- the current routed url
-
sendRedirect
public static java.lang.String sendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Boolean stay) throws java.io.IOExceptionRedirect to location url- Parameters:
response- HttpServletResponse object to be usedlocation- target location urlparameters- GET parameters to be addedstay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- string the target URL
- Throws:
java.io.IOException- See Also:
HttpServletResponse.sendRedirect(String)
-
sendRedirect
public static void sendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOExceptionRedirect to location url- Parameters:
response- HttpServletResponse object to be usedlocation- target location urlparameters- GET parameters to be added- Throws:
java.io.IOException- See Also:
HttpServletResponse.sendRedirect(String)
-
sendRedirect
public static void sendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String location) throws java.io.IOExceptionRedirect to location url- Parameters:
response- HttpServletResponse object to be usedlocation- target location url- Throws:
java.io.IOException- See Also:
HttpServletResponse.sendRedirect(String)
-
-