com.ecyrd.jspwiki.util
Class HttpUtil

java.lang.Object
  extended by com.ecyrd.jspwiki.util.HttpUtil

public class HttpUtil
extends Object

Contains useful utilities for some common HTTP tasks.

Since:
2.1.61.
Author:
Janne Jalkanen

Constructor Summary
HttpUtil()
           
 
Method Summary
static boolean checkFor304(javax.servlet.http.HttpServletRequest req, WikiPage page)
          If returns true, then should return a 304 (HTTP_NOT_MODIFIED)
static String createETag(WikiPage p)
           
static String guessValidURI(String uri)
          Attempts to form a valid URI based on the string given.
static String retrieveCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName)
          Attempts to retrieve the given cookie value from the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtil

public HttpUtil()
Method Detail

retrieveCookieValue

public static String retrieveCookieValue(javax.servlet.http.HttpServletRequest request,
                                         String cookieName)
Attempts to retrieve the given cookie value from the request. Returns the string value (which may or may not be decoded correctly, depending on browser!), or null if the cookie is not found. The algorithm will automatically trim leading and trailing double quotes, if found.

Parameters:
request - The current request
cookieName - The name of the cookie to fetch.
Returns:
Value of the cookie, or null, if there is no such cookie.

createETag

public static String createETag(WikiPage p)

checkFor304

public static boolean checkFor304(javax.servlet.http.HttpServletRequest req,
                                  WikiPage page)
If returns true, then should return a 304 (HTTP_NOT_MODIFIED)


guessValidURI

public static String guessValidURI(String uri)
Attempts to form a valid URI based on the string given. Currently it can guess email addresses (mailto:). If nothing else is given, it assumes it to be a http:// url.

Parameters:
uri - URI to take a poke at
Returns:
Possibly a valid URI
Since:
2.2.8