java.lang.Object
org.codelibs.saml2.servlet.ServletUtils
ServletUtils class of Java Toolkit.
A class that contains several auxiliary methods related to HttpServletRequest and HttpServletResponse
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetSelfHost(jakarta.servlet.http.HttpServletRequest request) static StringgetSelfRoutedURLNoQuery(jakarta.servlet.http.HttpServletRequest request) Returns the routed URL of the current host + current view.static StringgetSelfURL(jakarta.servlet.http.HttpServletRequest request) Returns the URL of the current context + current view + querystatic StringgetSelfURLhost(jakarta.servlet.http.HttpServletRequest request) Returns the protocol + the current host + the port (if different than common ports).static StringgetSelfURLNoQuery(jakarta.servlet.http.HttpServletRequest request) Returns the URL of the current host + current view.static booleanisHTTPS(jakarta.servlet.http.HttpServletRequest request) Check if under https or http protocolstatic org.codelibs.saml2.core.http.HttpRequestmakeHttpRequest(jakarta.servlet.http.HttpServletRequest req) Creates an HttpRequest from an HttpServletRequest.static voidsendRedirect(jakarta.servlet.http.HttpServletResponse response, String location) Redirect to location urlstatic voidsendRedirect(jakarta.servlet.http.HttpServletResponse response, String location, Map<String, String> parameters) Redirect to location urlstatic StringsendRedirect(jakarta.servlet.http.HttpServletResponse response, String location, Map<String, String> parameters, Boolean stay) Redirect to location url
-
Method Details
-
makeHttpRequest
public static org.codelibs.saml2.core.http.HttpRequest makeHttpRequest(jakarta.servlet.http.HttpServletRequest req) Creates an HttpRequest from an HttpServletRequest.- Parameters:
req- the incoming HttpServletRequest- Returns:
- a HttpRequest
-
getSelfURLhost
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
- Parameters:
request- HttpServletRequest object to be processed- Returns:
- the server name
-
isHTTPS
public static boolean isHTTPS(jakarta.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
Returns the URL of the current context + current view + query- Parameters:
request- HttpServletRequest object to be processed- Returns:
- current context + current view + query
-
getSelfURLNoQuery
Returns the URL of the current host + current view.- Parameters:
request- HttpServletRequest object to be processed- Returns:
- current host + current view
-
getSelfRoutedURLNoQuery
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 String sendRedirect(jakarta.servlet.http.HttpServletResponse response, String location, Map<String, String> parameters, Boolean stay) Redirect 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
- See Also:
-
sendRedirect
public static void sendRedirect(jakarta.servlet.http.HttpServletResponse response, String location, Map<String, String> parameters) Redirect to location url- Parameters:
response- HttpServletResponse object to be usedlocation- target location urlparameters- GET parameters to be added- See Also:
-
sendRedirect
Redirect to location url- Parameters:
response- HttpServletResponse object to be usedlocation- target location url- See Also:
-