|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.cas.client.util.CommonUtils
public final class CommonUtils
Common utilities so that we don't need to include Commons Lang.
| Method Summary | |
|---|---|
static void |
assertNotEmpty(java.util.Collection c,
java.lang.String message)
Check whether the collection is null or empty. |
static void |
assertNotNull(java.lang.Object object,
java.lang.String message)
Check whether the object is null or not. |
static void |
assertTrue(boolean cond,
java.lang.String message)
Assert that the statement is true, otherwise throw an exception with the provided message. |
static java.lang.String |
constructRedirectUrl(java.lang.String casServerLoginUrl,
java.lang.String serviceParameterName,
java.lang.String serviceUrl,
boolean renew,
boolean gateway)
Constructs the URL to use to redirect to the CAS server. |
static java.lang.String |
constructServiceUrl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String service,
java.lang.String serverName,
java.lang.String artifactParameterName,
boolean encode)
Constructs a service url from the HttpServletRequest or from the given serviceUrl. |
static java.lang.String |
getResponseFromServer(java.lang.String url)
Contacts the remote URL and returns the response. |
static java.lang.String |
getResponseFromServer(java.net.URL constructedUrl)
Contacts the remote URL and returns the response. |
static boolean |
isBlank(java.lang.String string)
Determines if a String is blank or not. |
static boolean |
isEmpty(java.lang.String string)
Determines whether the String is null or of length 0. |
static boolean |
isNotBlank(java.lang.String string)
Determines if a string is not blank. |
static boolean |
isNotEmpty(java.lang.String string)
Determines if the String is not empty. |
static void |
readAndRespondToProxyReceptorRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ProxyGrantingTicketStorage proxyGrantingTicketStorage)
|
static java.lang.String |
safeGetParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String parameter)
Safe method for retrieving a parameter from the request without disrupting the reader UNLESS the parameter actually exists in the query string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void assertNotNull(java.lang.Object object,
java.lang.String message)
object - the object to check.message - the message to display if the object is null.
public static void assertNotEmpty(java.util.Collection c,
java.lang.String message)
c - the collecion to check.message - the message to display if the object is null.
public static void assertTrue(boolean cond,
java.lang.String message)
cond - the codition to assert is true.message - the message to display if the condition is not true.public static boolean isEmpty(java.lang.String string)
string - the string to check
public static boolean isNotEmpty(java.lang.String string)
string - the string to check
public static boolean isBlank(java.lang.String string)
string - the string to check
public static boolean isNotBlank(java.lang.String string)
string - the string to check.
public static java.lang.String constructRedirectUrl(java.lang.String casServerLoginUrl,
java.lang.String serviceParameterName,
java.lang.String serviceUrl,
boolean renew,
boolean gateway)
casServerLoginUrl - the CAS Server login url.serviceParameterName - the name of the parameter that defines the service.serviceUrl - the actual service's url.renew - whether we should send renew or not.gateway - where we should send gateway or not.
public static void readAndRespondToProxyReceptorRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ProxyGrantingTicketStorage proxyGrantingTicketStorage)
throws java.io.IOException
java.io.IOException
public static java.lang.String constructServiceUrl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String service,
java.lang.String serverName,
java.lang.String artifactParameterName,
boolean encode)
request - the HttpServletRequestresponse - the HttpServletResponseservice - the configured service url (this will be used if not null)serverName - the server name to use to constuct the service url if the service param is emptyartifactParameterName - the artifact parameter name to remove (i.e. ticket)encode - whether to encode the url or not (i.e. Jsession).
public static java.lang.String safeGetParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String parameter)
Note, this does not work for POST Requests for "logoutRequest". It works for all other CAS POST requests because the parameter is ALWAYS in the GET request.
If we see the "logoutRequest" parameter we MUST treat it as if calling the standard request.getParameter.
request - the request to check.parameter - the parameter to look for.
public static java.lang.String getResponseFromServer(java.net.URL constructedUrl)
constructedUrl - the url to contact.
public static java.lang.String getResponseFromServer(java.lang.String url)
url - the url to contact.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||