org.melati.util
Class HttpUtil

Package class diagram package HttpUtil
java.lang.Object
  extended by org.melati.util.HttpUtil

public final class HttpUtil
extends Object

An assortment of useful things to do with Http.


Method Summary
static void appendRelativeZoneURL(StringBuffer url, javax.servlet.http.HttpServletRequest request)
          Append relative servlet zone url.
static void appendZoneURL(StringBuffer url, javax.servlet.http.HttpServletRequest request)
          Add a Zone URL to buffer.
static String concatenateUrls(String url, String relativeUrl)
           
static String getRelativeRequestURL(javax.servlet.http.HttpServletRequest request)
          Retrieve a relative url from a request.
static String getServerURL(javax.servlet.http.HttpServletRequest request)
          Return the server URL.
static String servletURL(javax.servlet.http.HttpServletRequest request)
          Retrieve a Servlet url from a request.
static String zoneURL(javax.servlet.http.HttpServletRequest request)
          Retrieve a Zone url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

appendZoneURL

public static void appendZoneURL(StringBuffer url,
                                 javax.servlet.http.HttpServletRequest request)
Add a Zone URL to buffer.

Parameters:
url - an empty StringBuffer to append to
request - the request to interrogate

getServerURL

public static String getServerURL(javax.servlet.http.HttpServletRequest request)
Return the server URL.

Parameters:
request - the request to interrogate

appendRelativeZoneURL

public static void appendRelativeZoneURL(StringBuffer url,
                                         javax.servlet.http.HttpServletRequest request)
Append relative servlet zone url. Note that this function should return /zone/servlet from a request of form http://host/zone/servlet/pathinfo?querystring on all servlet API versions greater than 2.0. In 2.0 the zone was returned in the ServletPath it is now in the ContextPath.

Parameters:
url - StringBuffer to append to
request - the request to interrogate

zoneURL

public static String zoneURL(javax.servlet.http.HttpServletRequest request)
Retrieve a Zone url.

Parameters:
request - the request to interrogate
Returns:
an Url up to the zone specification as a String

servletURL

public static String servletURL(javax.servlet.http.HttpServletRequest request)
Retrieve a Servlet url from a request.

Parameters:
request - the request to interrogate
Returns:
an Url up to the servlet specification as a String

getRelativeRequestURL

public static String getRelativeRequestURL(javax.servlet.http.HttpServletRequest request)
Retrieve a relative url from a request.

Parameters:
request - the request to interrogate
Returns:
a relative Url

concatenateUrls

public static String concatenateUrls(String url,
                                     String relativeUrl)
Parameters:
url - An url or relative url which may end in a slash
relativeUrl - A relative url which may start with a slash
Returns:
an url without a duplicated slash at the join


Copyright © 2000-2010 PanEris. All Rights Reserved.