org.n52.security.common.util
Class ServletUtils

java.lang.Object
  extended by org.n52.security.common.util.ServletUtils

public class ServletUtils
extends Object

A collection of useful tools for servlet handling.


Constructor Summary
ServletUtils()
           
 
Method Summary
static String buildContextLocation(javax.servlet.http.HttpServletRequest request, String... contextRelativePath)
           
static String getContextLocation(javax.servlet.http.HttpServletRequest request)
           
static String getParameterValueEqualIgnoreCase(javax.servlet.http.HttpServletRequest request, String paramname)
          Method gets an parameter value by it's name ignoring the case.
static String getRequestLocation(javax.servlet.http.HttpServletRequest request)
           
static String getRequestLocationIncludingParameter(javax.servlet.http.HttpServletRequest request)
          this methods appends all parameters from the request (also post parameters) to the request location.
static String getRequestLocationIncludingQueryParameter(javax.servlet.http.HttpServletRequest request)
          this method only appends the query parameters to the request location.
static String getServletLocation(javax.servlet.http.HttpServletRequest request)
          Method gets the servlets url from the request.
static void sendFormPostRedirect(String redirectUrl, javax.servlet.http.HttpServletResponse response)
          Methods sends a html form redirect.
static void sendFormPostRedirect(String redirectUrl, javax.servlet.http.HttpServletResponse response, Map<String,Iterable<String>> params)
           
static void sendLocationHeaderRedirect(String redirectUrl, javax.servlet.http.HttpServletResponse response)
          Sends a redirect not using the response.sendRedirect method to allow send Set-Cookie headers.
static void sendRedirect(String redirectUrl, javax.servlet.http.HttpServletResponse response)
          This methods decides based on the length of the redirect url if it uses a location header redirect or form post redirect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletUtils

public ServletUtils()
Method Detail

getParameterValueEqualIgnoreCase

public static String getParameterValueEqualIgnoreCase(javax.servlet.http.HttpServletRequest request,
                                                      String paramname)
Method gets an parameter value by it's name ignoring the case.

Parameters:
request - the request.
paramname - the paramname.
Returns:
String.

buildContextLocation

public static String buildContextLocation(javax.servlet.http.HttpServletRequest request,
                                          String... contextRelativePath)

getContextLocation

public static String getContextLocation(javax.servlet.http.HttpServletRequest request)

getServletLocation

public static String getServletLocation(javax.servlet.http.HttpServletRequest request)
Method gets the servlets url from the request.

Parameters:
request - the request.
Returns:
URL.

getRequestLocation

public static String getRequestLocation(javax.servlet.http.HttpServletRequest request)

getRequestLocationIncludingParameter

public static String getRequestLocationIncludingParameter(javax.servlet.http.HttpServletRequest request)
this methods appends all parameters from the request (also post parameters) to the request location.


getRequestLocationIncludingQueryParameter

public static String getRequestLocationIncludingQueryParameter(javax.servlet.http.HttpServletRequest request)
this method only appends the query parameters to the request location.


sendLocationHeaderRedirect

public static void sendLocationHeaderRedirect(String redirectUrl,
                                              javax.servlet.http.HttpServletResponse response)
Sends a redirect not using the response.sendRedirect method to allow send Set-Cookie headers.


sendRedirect

public static void sendRedirect(String redirectUrl,
                                javax.servlet.http.HttpServletResponse response)
This methods decides based on the length of the redirect url if it uses a location header redirect or form post redirect.


sendFormPostRedirect

public static void sendFormPostRedirect(String redirectUrl,
                                        javax.servlet.http.HttpServletResponse response)
Methods sends a html form redirect. It builds as content an html with a form which sends it self after loading. This is very usefull for urls with a long parameter list. All url parameters are encoded as post body parameter.


sendFormPostRedirect

public static void sendFormPostRedirect(String redirectUrl,
                                        javax.servlet.http.HttpServletResponse response,
                                        Map<String,Iterable<String>> params)


Copyright © 2004–2013 52north.org. All rights reserved.