org.yestech.lib.web
Class RequestUtils

java.lang.Object
  extended by org.yestech.lib.web.RequestUtils

public final class RequestUtils
extends java.lang.Object

A collection of request processing utilities

Version:
$Revision: $
Author:
Artie Copeland

Method Summary
static boolean acceptsEncoding(javax.servlet.http.HttpServletRequest request, java.lang.String name)
          Checks if request accepts the named encoding.
static boolean acceptsGzipEncoding(javax.servlet.http.HttpServletRequest request)
          Determine whether the user agent accepts GZIP encoding.
static boolean headerContains(javax.servlet.http.HttpServletRequest request, java.lang.String header, java.lang.String value)
          Checks if request contains the header value.
static boolean isIncluded(javax.servlet.http.HttpServletRequest request)
          Checks if the request uri is an include.
static java.lang.String resolveUserIpAddress(javax.servlet.http.HttpServletRequest request)
          Trys to resolve an clients ip address first by last item in "X-Forwarded-For" HTTP header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isIncluded

public static boolean isIncluded(javax.servlet.http.HttpServletRequest request)
Checks if the request uri is an include. These cannot be gzipped.


acceptsGzipEncoding

public static boolean acceptsGzipEncoding(javax.servlet.http.HttpServletRequest request)
Determine whether the user agent accepts GZIP encoding. This feature is part of HTTP1.1. If a browser accepts GZIP encoding it will advertise this by including in its HTTP header:

Accept-Encoding: gzip

Requests which do not accept GZIP encoding fall into the following categories:

As of September 2004, about 34% of Internet requests do not accept GZIP encoding.

Parameters:
request -
Returns:
true, if the User Agent request accepts GZIP encoding

acceptsEncoding

public static boolean acceptsEncoding(javax.servlet.http.HttpServletRequest request,
                                      java.lang.String name)
Checks if request accepts the named encoding.


headerContains

public static boolean headerContains(javax.servlet.http.HttpServletRequest request,
                                     java.lang.String header,
                                     java.lang.String value)
Checks if request contains the header value.

Returns:
true if header acc

resolveUserIpAddress

public static java.lang.String resolveUserIpAddress(javax.servlet.http.HttpServletRequest request)
Trys to resolve an clients ip address first by last item in "X-Forwarded-For" HTTP header. If that fails then use ServletRequest.getRemoteAddr().

Parameters:
request - HttpRequest
Returns:
Ip Address


Copyright © 2009 YES Technology Association. All Rights Reserved.