Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.directwebremoting
Interface WebContext

All Superinterfaces:
  ServerContext

All Known Subinterfaces:
  WebContext

All Known Implementing Classes:
  DefaultWebContext, ExecutionContext

    public interface WebContext

extends ServerContext

Class to enable us to access servlet parameters.

Author:
  Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
`static java.lang.String` | `ATTRIBUTE_DWR` An attribute used by `forwardToString(String)` to inform anyone that wants to know that this is a request from DWR.

Method Summary
`java.lang.String` | `forwardToString(java.lang.String url)` Forward a request to a given URL and catch the data written to it.
`java.lang.String` | `getCurrentPage()` What is the URL of the current page.
`javax.servlet.http.HttpServletRequest` | `getHttpServletRequest()` Accessor for the http request information.
`javax.servlet.http.HttpServletResponse` | `getHttpServletResponse()` Accessor for the http response bean.
`ScriptSession` | `getScriptSession()` Get the script session that represents the currently viewed page in the same way that an HttpSession represents a cookie.
`javax.servlet.http.HttpSession` | `getSession()` Returns the current session associated with this request, or if the request does not have a session, creates one.
`javax.servlet.http.HttpSession` | `getSession(boolean create)` Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
`void` | `setCurrentPageInformation(java.lang.String page, java.lang.String scriptSessionId)` For system use only: This method allows the system to fill in the session id and page id when they are discovered.

Methods inherited from interface org.directwebremoting.ServerContext
`getAllScriptSessions, getContainer, getScriptSessionsByPage, getServletConfig, getServletContext, getVersion`

Field Detail

### ATTRIBUTE_DWR

    static final java.lang.String ATTRIBUTE_DWR

  An attribute used by `forwardToString(String)` to inform anyone that wants to know that this is a request from DWR.

  See Also:
    Constant Field Values

Method Detail

### getScriptSession

    ScriptSession getScriptSession()

  Get the script session that represents the currently viewed page in the same way that an HttpSession represents a cookie.

  Returns:
    A browser object for this user

### getCurrentPage

    java.lang.String getCurrentPage()

  What is the URL of the current page. This includes 'http://', up to (but not including) '?' or '#'

  Returns:
    The URL of the current page

### getSession

    javax.servlet.http.HttpSession getSession()

  Returns the current session associated with this request, or if the request does not have a session, creates one.

  Returns:
    Returns the http session.
  See Also:
    `HttpServletRequest.getSession()`

### getSession

    javax.servlet.http.HttpSession getSession(boolean create)

  Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session. If create is false and the request has no valid HttpSession, this method returns null.

  Parameters:
    `create` - false to return null if there's no current session
  Returns:
    the session associated with this request
  See Also:
    `HttpServletRequest.getSession(boolean)`

### getHttpServletRequest

    javax.servlet.http.HttpServletRequest getHttpServletRequest()

  Accessor for the http request information.

  Returns:
    Returns the request.

### getHttpServletResponse

    javax.servlet.http.HttpServletResponse getHttpServletResponse()

  Accessor for the http response bean.

  You can't use this request to directly reply to the response or to add headers or cookies.

  Returns:
    Returns the response.

### forwardToString

    java.lang.String forwardToString(java.lang.String url)
                                     throws javax.servlet.ServletException,
                                            java.io.IOException

  Forward a request to a given URL and catch the data written to it. It is possible to distinguish requests that arrive normally and requests that come from a DWR forwardToString() by the presence of a request attribute. Before the request is forwarded, DWR will call:

       request.setAttribute(WebContext.ATTRIBUTE_DWR, Boolean.TRUE);

  Parameters:
    `url` - The URL to forward to
  Returns:
    The text that results from forwarding to the given URL
  Throws:
    `java.io.IOException` - if the target resource throws this exception
    `javax.servlet.ServletException` - if the target resource throws this exception
    `java.lang.IllegalStateException` - if the response was already committed

### setCurrentPageInformation

    void setCurrentPageInformation(java.lang.String page,
                                   java.lang.String scriptSessionId)

  For system use only: This method allows the system to fill in the session id and page id when they are discovered.

  Parameters:
    `page` - The URL of the current page
    `scriptSessionId` - The session id passed in by the browser

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¬ 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD