|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.melati.util.HttpServletRequestCompat
public final class HttpServletRequestCompat
The HttpServletRequestCompat class enables Melati to compile,
without warnings, with the Servlet API versions 2.0 to 2.5.
The core methods are those present in the 2.0 API all methods added since
are established as static members.
These are then available to be invoked if present or a RuntimeException is thrown
otherwise.
However, if you use a method which is not in your version of the API then you
will get a runtime exception.
DelegatedHttpServletRequest| Nested Class Summary | |
|---|---|
static class |
HttpServletRequestCompat.MissingMethodError
Thrown when a method that is not available is invoked. |
| Method Summary | |
|---|---|
static java.util.Enumeration |
getAttributeNames(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API. |
static java.lang.String |
getAuthType(javax.servlet.http.HttpServletRequest it)
Returns the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the servlet was
not protected. |
static java.lang.String |
getContextPath(javax.servlet.http.HttpServletRequest it)
Returns the empty string when run against 2.0 API. |
static javax.servlet.http.Cookie[] |
getCookies(javax.servlet.http.HttpServletRequest it)
Returns an array containing all of the Cookie objects the
client sent with this request. |
static long |
getDateHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
Returns the value of the specified request header as a long
value that represents a Date object. |
static java.lang.String |
getHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
Returns the value of the specified request header as a String. |
static java.util.Enumeration |
getHeaderNames(javax.servlet.http.HttpServletRequest it)
Returns an enumeration of all the header names this request contains. |
static java.util.Enumeration |
getHeaders(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Throws MissingMethodError when run against 2.0 API. |
static int |
getIntHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
Returns the value of the specified request header as an int. |
static java.lang.String |
getLocalAddr(javax.servlet.http.HttpServletRequest it)
|
static java.util.Locale |
getLocale(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API. |
static java.util.Enumeration |
getLocales(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API. |
static java.lang.String |
getLocalName(javax.servlet.http.HttpServletRequest it)
|
static int |
getLocalPort(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getMethod(javax.servlet.http.HttpServletRequest it)
|
static java.util.Map |
getParameterMap(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getPathInfo(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getPathTranslated(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getQueryString(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getRealPath(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Deprecated. Servlet API 2.1 |
static int |
getRemotePort(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getRemoteUser(javax.servlet.http.HttpServletRequest it)
|
static javax.servlet.RequestDispatcher |
getRequestDispatcher(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Throws MissingMethodError when run against 2.0 API. |
static java.lang.String |
getRequestedSessionId(javax.servlet.http.HttpServletRequest it)
|
static java.lang.String |
getRequestURI(javax.servlet.http.HttpServletRequest it)
|
static java.lang.StringBuffer |
getRequestURL(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.2 API. |
static java.lang.String |
getServletPath(javax.servlet.http.HttpServletRequest it)
|
static javax.servlet.http.HttpSession |
getSession(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API, introduced in 2.1. |
static javax.servlet.http.HttpSession |
getSession(javax.servlet.http.HttpServletRequest it,
boolean a)
|
static java.security.Principal |
getUserPrincipal(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API. |
static boolean |
isRequestedSessionIdFromCookie(javax.servlet.http.HttpServletRequest it)
|
static boolean |
isRequestedSessionIdFromUrl(javax.servlet.http.HttpServletRequest it)
Deprecated. Servlet API 2.1 |
static boolean |
isRequestedSessionIdFromURL(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API, introduced in 2.1. |
static boolean |
isRequestedSessionIdValid(javax.servlet.http.HttpServletRequest it)
|
static boolean |
isSecure(javax.servlet.http.HttpServletRequest it)
Throws MissingMethodError when run against 2.0 API. |
static boolean |
isUserInRole(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Throws MissingMethodError when run against 2.0 API. |
static void |
removeAttribute(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Throws MissingMethodError when run against 2.0 API. |
static void |
setAttribute(javax.servlet.http.HttpServletRequest it,
java.lang.String arg1,
java.lang.Object arg2)
Throws MissingMethodError when run against 2.0 API. |
static void |
setCharacterEncoding(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Throws MissingMethodError when run against 2.2 API. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String getAuthType(javax.servlet.http.HttpServletRequest it)
null if the servlet was
not protected. Same as the value of the CGI variable AUTH_TYPE.
it - the HttpServletRequest
String specifying the name of the authentication
scheme, or null if the request was not authenticatedHttpServletRequest.getAuthType()public static javax.servlet.http.Cookie[] getCookies(javax.servlet.http.HttpServletRequest it)
Cookie objects the
client sent with this request. This method returns null if
no cookies were sent.
it - the HttpServletRequest
Cookies included with this
request, or null if the request has no cookiesHttpServletRequest.getCookies()
public static long getDateHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
long
value that represents a Date object. Use this method with
headers that contain dates, such as If-Modified-Since. The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the request did not have a
header of the specified name, this method returns -1. If the header can't
be converted to a date, the method throws an
IllegalArgumentException.
it - the HttpServletRequest
long value representing the date specified in the
header expressed as the number of milliseconds since January 1,
1970 GMT, or -1 if the named header was not included with the
reqestHttpServletRequest.getDateHeader(String)
public static java.lang.String getHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
String.
If the request did not include a header of the specified name, this method
returns null. The header name is case insensitive. You can
use this method with any request header.
it - the HttpServletRequest
String containing the value of the requested
header, or null if the request does not have a
header of that nameHttpServletRequest.getHeader(String)public static java.util.Enumeration getHeaderNames(javax.servlet.http.HttpServletRequest it)
Some
servlet containers do not allow do not allow servlets to access headers
using this method, in which case this method returns null
it - the HttpServletRequest
nullHttpServletRequest.getHeaderNames()
public static int getIntHeader(javax.servlet.http.HttpServletRequest it,
java.lang.String a)
int.
If the request does not have a header of the specified name, this method
returns -1. If the header cannot be converted to an integer, this method
throws a NumberFormatException. The header name is case insensitive.
it - the HttpServletRequest
HttpServletRequest.getIntHeader(String)public static java.lang.String getMethod(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String
specifying the name
of the method with which
this request was madeHttpServletRequest.getMethod()public static java.lang.String getPathInfo(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String specifying
extra path information that comes
after the servlet path but before
the query string in the request URL;
or null if the URL does not have
any extra path informationHttpServletRequest.getPathInfo()public static java.lang.String getPathTranslated(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String specifying the
real path, or null if
the URL does not have any extra path
informationHttpServletRequest.getPathTranslated()public static java.lang.String getQueryString(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String containing the query
string or null if the URL
contains no query stringHttpServletRequest.getQueryString()public static java.lang.String getRemoteUser(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String specifying the login
of the user making this request, or null
if the user login is not knownHttpServletRequest.getRemoteUser()public static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String containing
the part of the URL from the
protocol name up to the query stringHttpServletRequest.getRequestURI()public static java.lang.String getRequestedSessionId(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String specifying the session
ID, or null if the request did
not specify a session IDHttpServletRequest.getRequestedSessionId()public static java.lang.String getServletPath(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
String containing
the name or path of the servlet being
called, as specified in the request URLHttpServletRequest.getServletPath()
public static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest it,
boolean a)
it - the HttpServletRequesta -
HttpSession associated
with this requestHttpServletRequest.getSession()public static boolean isRequestedSessionIdValid(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
true if this
request has an id for a valid session
in the current session context;
false otherwiseHttpServletRequest.isRequestedSessionIdValid()public static boolean isRequestedSessionIdFromCookie(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
true if the session ID
came in as a
cookie; otherwise, falseHttpServletRequest.isRequestedSessionIdFromCookie()
public static java.lang.String getRealPath(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
it - the HttpServletRequestarg - url String
ServletRequest.getRealPath(String)public static boolean isRequestedSessionIdFromUrl(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
HttpServletRequest.isRequestedSessionIdFromUrl()public static java.lang.String getContextPath(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
HttpServletRequest.getContextPath()public static java.security.Principal getUserPrincipal(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
java.security.Principal containing
the name of the user making this request;
null if the user has not been
authenticatedHttpServletRequest.getUserPrincipal()
public static java.util.Enumeration getHeaders(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
it - the HttpServletRequestarg -
Enumeration containing the
values of the requested
header, or null
if the request does not
have any headers of that nameHttpServletRequest.getHeaders(java.lang.String)public static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
HttpSession associated
with this requestHttpServletRequest.getSession()public static boolean isRequestedSessionIdFromURL(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
true if the session ID
came in as part of a URL; otherwise,
falseHttpServletRequest.isRequestedSessionIdFromURL()
public static boolean isUserInRole(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
it - the HttpServletRequestarg -
boolean indicating whether
the user making this request belongs to a given role;
false if the user has not been
authenticatedHttpServletRequest.isUserInRole(java.lang.String)public static java.util.Enumeration getAttributeNames(javax.servlet.http.HttpServletRequest it)
Enumeration containing the names of the attributes available
to this request. This method returns an empty Enumeration if
the request has no attributes available to it.
it - the HttpServletRequest
Enumeration of strings containing the names of
the request's attributesServletRequest.getAttributeNames()public static java.util.Locale getLocale(javax.servlet.http.HttpServletRequest it)
Locale that the client will accept content in,
based on the Accept-Language header. If the client request doesn't provide
an Accept-Language header, this method returns the default locale for the
server.
it - the HttpServletRequest
Locale for the clientServletRequest.getLocale()public static java.util.Enumeration getLocales(javax.servlet.http.HttpServletRequest it)
Enumeration of Locale objects indicating, in
decreasing order starting with the preferred locale, the locales that are
acceptable to the client based on the Accept-Language header. If the client
request doesn't provide an Accept-Language header, this method returns an
Enumeration containing one Locale, the
default locale for the server.
it - the HttpServletRequest
Enumeration of preferred Locale
objects for the clientServletRequest.getLocales()
public static javax.servlet.RequestDispatcher getRequestDispatcher(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
RequestDispatcher object that acts as a wrapper for the
resource located at the given path. A RequestDispatcher
object can be used to forward a request to the resource or to include the
resource in a response. The resource can be dynamic or static.
The
pathname specified may be relative, although it cannot extend outside the
current servlet context. If the path begins with a "/" it is interpreted as
relative to the current context root. This method returns null
if the servlet container cannot return a RequestDispatcher.
The difference between this method and
ServletContext#getRequestDispatcher is that this method can take a
relative path.
it - the HttpServletRequestarg - a String specifying the pathname to the resource
RequestDispatcher object that acts as a wrapper
for the resource at the specified pathRequestDispatcher,
ServletRequest.getRequestDispatcher(String)public static boolean isSecure(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.isSecure()
public static void removeAttribute(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
Attribute
names should follow the same conventions as package names. Names beginning
with java.*, javax.*, and
com.sun.*, are reserved for use by Sun Microsystems.
it - the HttpServletRequestarg - a String specifying the name of the attribute to
removejavax.servlet.http.HttpServletRequest#removeAttribute()
public static void setAttribute(javax.servlet.http.HttpServletRequest it,
java.lang.String arg1,
java.lang.Object arg2)
RequestDispatcher.
Attribute names should follow the same conventions as package names.
Names beginning with java.*, javax.*, and
com.sun.*, are reserved for use by Sun Microsystems.
it - the HttpServletRequestarg1 - a String specifying the name of the attributearg2 - the Object to be storedServletRequest.setAttribute(java.lang.String, java.lang.Object)public static java.lang.StringBuffer getRequestURL(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
HttpServletRequest.getRequestURL()
public static void setCharacterEncoding(javax.servlet.http.HttpServletRequest it,
java.lang.String arg)
it - the HttpServletRequestarg - encoding nameServletRequest.setCharacterEncoding(String)public static java.util.Map getParameterMap(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.getParameterMap()public static int getRemotePort(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.getRemotePort()public static int getLocalPort(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.getLocalPort()public static java.lang.String getLocalName(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.getLocalName()public static java.lang.String getLocalAddr(javax.servlet.http.HttpServletRequest it)
it - the HttpServletRequest
ServletRequest.getLocalAddr()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||