SK.gnome.dwarf.http
Interface Request

All Superinterfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public interface Request
extends javax.servlet.http.HttpServletRequest

This class extends the javax.servlet.http.HttpServletRequest.


Method Summary
 void forward(java.lang.String path, Response response)
          Forwards the request to the specified path.
 java.lang.String getAbsolutePath(java.lang.String path)
          Converts the given URI path to an absolute path.
 Application getApplication()
          Returns the servlet context associated with the request.
 java.lang.String getApplicationPath()
          Converts the given URI path to an absolute path, but relative to the servlet context.
 RequestURI getDispatchedURI()
          Returns the dispatched RequestURI object.
 int getElapsedTime()
          Returns total time in milliseconds elapsed while processing the request.
 Host getHost()
          Returns the HTTP host associated with the request.
 java.lang.String getJavaEncoding()
          Returns Java encoding to be used for decoding the request information.
 RequestURI getURI()
          Returns the RequestURI representing the request.
 void include(java.lang.String path, Response response)
          Includes the content of the specified path to the current request.
 boolean isIncluded()
          Checks whether or not the request is included.
 boolean isPersistentConnection()
          Whether or not the HTTP connection is persistent.
 void setCharacterEncoding(java.lang.String enc)
          Sets the character encoding of the request.
 void setPersistentConnection(boolean value)
          Enables or disables the persistent connection.
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getContentLength, getContentType, getCharacterEncoding, getInputStream, getLocale, getLocales, getParameter, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getServerName, getServerPort, getScheme, isSecure, removeAttribute, setAttribute
 

Method Detail

getHost

public Host getHost()
Returns the HTTP host associated with the request.

Returns:
the host

getApplication

public Application getApplication()
Returns the servlet context associated with the request.

Returns:
the application

getURI

public RequestURI getURI()
Returns the RequestURI representing the request.

Returns:
the RequestURI

getDispatchedURI

public RequestURI getDispatchedURI()
Returns the dispatched RequestURI object.

The dispatched URI differs from the original URI if the request is currently being forwarded to a different path, or another resource is currently being included to the request.

Returns:
the request URI

getElapsedTime

public int getElapsedTime()
Returns total time in milliseconds elapsed while processing the request.

Returns:
time in millis

isPersistentConnection

public boolean isPersistentConnection()
Whether or not the HTTP connection is persistent.

The persistent connections (also known as keep-alive connections) allow to receive and send multiple requests and responses through a single TCP/IP connection.

Returns:
true if the connection associated with the request is persistent

setPersistentConnection

public void setPersistentConnection(boolean value)
Enables or disables the persistent connection.

The persistent connections (also known as keep-alive connections) allow to receive and send multiple requests and responses through a single TCP/IP connection. By setting it to false you will cause the connection to be closed by the server after the response is sent to the client.

Note: The persistence status is maintained by the server internally, so the best you can do is to avoid using this method.

Parameters:
value - true if the connection associated with the request should stay persistent

getAbsolutePath

public java.lang.String getAbsolutePath(java.lang.String path)
Converts the given URI path to an absolute path.

It takes a path relative to the request's servlet path and converts it to an absolute path. For example, if a current request's servlet path is "/guestbook", the the absolute form of the "index.html" argument would be "/guestbook/index.html".

The path argument must not go beyond the current servlet context.

Parameters:
path - the relative path
Returns:
the absolute path

getApplicationPath

public java.lang.String getApplicationPath()
Converts the given URI path to an absolute path, but relative to the servlet context.

It takes an absolute path and converts it to a path relative to the current servlet context. For example, if the current servlet context is "/guestbook", the path argument "/guestbook/index.html" would be converted to "/index.html".

The path argument must not go beyond the current servlet context.

Returns:
the application-relative path

getJavaEncoding

public java.lang.String getJavaEncoding()
Returns Java encoding to be used for decoding the request information.

This method first calls getCharacterEncoding of the current request, and if it returns null, then it uses the default encoding specified via the HTTPParameters object. The MIME encoding is then mapped to the Java encoding name and returned. If no Java encoding can be found for the given MIME charset, the default ISO8859_1 encoding is returned instead.

Java encoding is used to decode the x-www-form-urlencoded data, such as request URI, query string, data sent via HTTP POST method, etc.

Returns:
the Java encoding name

setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)
Sets the character encoding of the request.

It tells the server the character encoding used by the request. The character encoding should be set before calling any of the getParameter or getReader methods.

This method may be used if the browser does not send the encoding information via the Content-Type request header.

Parameters:
enc - the MIME charset

forward

public void forward(java.lang.String path,
                    Response response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Forwards the request to the specified path.

The path information of the current request is modified to reflect the new URI path.

The path argument must not go beyond the current servlet context.

Parameters:
path - the path to which the request should be forwarded
Throws:
java.io.IOException
javax.servlet.ServletException

include

public void include(java.lang.String path,
                    Response response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Includes the content of the specified path to the current request.

The path information of the request is left unchanged, although the included path information can be obtained via the request attributes.

The path argument must not go beyond the current servlet context.

Parameters:
path - the path of the included resource
Throws:
java.io.IOException
javax.servlet.ServletException

isIncluded

public boolean isIncluded()
Checks whether or not the request is included.

Returns true if another resource is currently being included to the request via the include method.

Returns:
true if a resource is being included to the request


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.