This documentation is for an old version of fiftyfive-wicket (2.0.9).


fiftyfive.wicket.util
Class HttpUtils

java.lang.Object
  extended by fiftyfive.wicket.util.HttpUtils

public class HttpUtils
extends Object

Provides easy access to the HTTP information that triggered the current Wicket request. Wicket normally hides this information from us, but occassionally we need access to things like the raw URL or HTTP headers. Note that these methods only work when called within a Wicket thread.

Since:
2.0

Method Summary
static String getAbsoluteRequestUrl()
          Returns the entire URL that was used to make the current request, including protocol, host, port, absolute path and query string.
static List<Map.Entry<String,String>> getHeaders()
          Returns all HTTP headers as key-value pairs.
static javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Returns the HttpServletRequest associated with the current Wicket request, or null one cannot be found.
static javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Returns the HttpServletResponse associated with the current Wicket request, or null one cannot be found.
static String getRelativeRequestUrl()
          Returns the Wicket portion of the URL that was used to make the current request, including relative path and query string.
static String getUserAgent()
          Returns the value of the User-Agent HTTP header, as provided by the HttpServletRequest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHttpServletRequest

public static javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns the HttpServletRequest associated with the current Wicket request, or null one cannot be found.


getHttpServletResponse

public static javax.servlet.http.HttpServletResponse getHttpServletResponse()
Returns the HttpServletResponse associated with the current Wicket request, or null one cannot be found.


getUserAgent

public static String getUserAgent()
Returns the value of the User-Agent HTTP header, as provided by the HttpServletRequest. May be null.


getHeaders

public static List<Map.Entry<String,String>> getHeaders()
Returns all HTTP headers as key-value pairs. Since headers can be listed more than once, it is possible that a header key can have multiple values. The resulting List may be empty, but never null.


getAbsoluteRequestUrl

public static String getAbsoluteRequestUrl()
Returns the entire URL that was used to make the current request, including protocol, host, port, absolute path and query string. May return null if the current request is not an HTTP one.


getRelativeRequestUrl

public static String getRelativeRequestUrl()
Returns the Wicket portion of the URL that was used to make the current request, including relative path and query string. The protocol, host, port, and base Wicket path are not included. May return null if the current request is not an HTTP one.



Copyright © 2011 55 Minutes. All Rights Reserved.