public class Redirector extends AbstractResponseDispatcher
HttpServletResponse.sendRedirect()
to send a temporary redirect response to clients to initiate an SSO process.UTF_8
Constructor and Description |
---|
Redirector(javax.servlet.http.HttpServletResponse response, java.lang.String baseUrl)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addQuery(java.lang.String name, java.lang.String value)
Adds query parameter to the redirect location URL.
|
void |
dispatch()
Sends a redirect response to the location URL constructed with
endpointUrl appended with supplied query parameters. |
addCookie, addHeader
public Redirector(javax.servlet.http.HttpServletResponse response, java.lang.String baseUrl)
response
- the response associated with the HttpServletRequest
that requires a particular SSO process to be performedbaseUrl
- the base url will be appended with the supplied query parameters to construct the location url that the redirect response is sent to, cannot be nullpublic void dispatch() throws SsoServiceException
endpointUrl
appended with supplied query parameters. The supplied parameters can be urls that contain a query string or special characters. This method calls java.net.URLEncoder.encode(aString, "UTF-8")
to do URL encoding for each supplied query parameter before concatenating them to form the URL returned to the caller. It is expected that the supplied urls are not url encoded. This method calls HttpServletResponse.sendRedirect(response.encodeRedirectURL(redirectUrl)
to send a redirect.
Sends the response to initiate an SSO process.
SsoServiceException
- if failed to send the responsepublic void addQuery(java.lang.String name, java.lang.String value)
name
- the name of the query parametervalue
- the value of the query parameter