net.shibboleth.utilities.java.support.net
Class HttpServletSupport

java.lang.Object
  extended by net.shibboleth.utilities.java.support.net.HttpServletSupport

@Beta
public final class HttpServletSupport
extends Object

Utilities for working with HTTP Servlet requests and responses.


Constructor Summary
private HttpServletSupport()
          Constructor.
 
Method Summary
static void addNoCacheHeaders(HttpServletResponse response)
          Adds Cache-Control and Pragma headers meant to disable caching.
static URI getFullRequestUri(HttpServletRequest request)
          Gets the URL that was requested to generate this request.
static String getRequestPathWithoutContext(HttpServletRequest request)
          Gets the request URI as returned by HttpServletRequest.getRequestURI() but without the servlet context path.
static void setContentType(HttpServletResponse response, String contentType)
          Sets the MIME content type of the response.
static void setUTF8Encoding(HttpServletResponse response)
          Sets the character encoding of the transport to UTF-8.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServletSupport

private HttpServletSupport()
Constructor.

Method Detail

addNoCacheHeaders

public static void addNoCacheHeaders(HttpServletResponse response)
Adds Cache-Control and Pragma headers meant to disable caching.

Parameters:
response - transport to add headers to

setUTF8Encoding

public static void setUTF8Encoding(HttpServletResponse response)
Sets the character encoding of the transport to UTF-8.

Parameters:
response - transport to set character encoding type

setContentType

public static void setContentType(HttpServletResponse response,
                                  String contentType)
Sets the MIME content type of the response.

Parameters:
response - the transport to set content type on
contentType - the content type to set

getRequestPathWithoutContext

public static String getRequestPathWithoutContext(HttpServletRequest request)
Gets the request URI as returned by HttpServletRequest.getRequestURI() but without the servlet context path.

Parameters:
request - request to get the URI from
Returns:
constructed URI

getFullRequestUri

public static URI getFullRequestUri(HttpServletRequest request)
Gets the URL that was requested to generate this request. This includes the scheme, host, port, path, and query string.

Parameters:
request - current request
Returns:
URL that was requested to generate this request


Copyright © 1999-2012. All Rights Reserved.