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.impl
Class DefaultWebContext

    java.lang.Object
      org.directwebremoting.impl.DefaultServerContext
          org.directwebremoting.impl.DefaultWebContext

All Implemented Interfaces:
  ServerContext, WebContext

    public class DefaultWebContext

extends DefaultServerContext
implements WebContext

A default implementation of WebContext

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

Field Summary

Fields inherited from interface org.directwebremoting.WebContext
`ATTRIBUTE_DWR`

Constructor Summary
`DefaultWebContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletConfig config, javax.servlet.ServletContext context, Container container)` Create a new DefaultWebContext

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.
`java.lang.String` | `getVersion()` Fish the version number out of the dwr.properties file.
`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 class org.directwebremoting.impl.DefaultServerContext
`getAllScriptSessions, getContainer, getScriptSessionsByPage, getServletConfig, getServletContext`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

Constructor Detail

### DefaultWebContext

    public DefaultWebContext(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.ServletConfig config,
                             javax.servlet.ServletContext context,
                             Container container)

  Create a new DefaultWebContext

  Parameters:
    `request` - The incoming http request
    `response` - The outgoing http reply
    `config` - The servlet configuration
    `context` - The servlet context
    `container` - The IoC container
  See Also:
    `WebContextFactory.WebContextBuilder.set(HttpServletRequest, HttpServletResponse, ServletConfig, ServletContext, Container)`

Method Detail

### setCurrentPageInformation

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

  Description copied from interface: `WebContext`
  For system use only: This method allows the system to fill in the session id and page id when they are discovered.

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

### getCurrentPage

    public java.lang.String getCurrentPage()

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

  Specified by:
    `getCurrentPage` in interface `WebContext`
  Returns:
    The URL of the current page

### getScriptSession

    public ScriptSession getScriptSession()

  Description copied from interface: `WebContext`
  Get the script session that represents the currently viewed page in the same way that an HttpSession represents a cookie.

  Specified by:
    `getScriptSession` in interface `WebContext`
  Returns:
    A browser object for this user

### getSession

    public javax.servlet.http.HttpSession getSession()

  Description copied from interface: `WebContext`
  Returns the current session associated with this request, or if the request does not have a session, creates one.

  Specified by:
    `getSession` in interface `WebContext`
  Returns:
    Returns the http session.
  See Also:
    `HttpServletRequest.getSession()`

### getSession

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

  Description copied from interface: `WebContext`
  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.

  Specified by:
    `getSession` in interface `WebContext`
  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

    public javax.servlet.http.HttpServletRequest getHttpServletRequest()

  Description copied from interface: `WebContext`
  Accessor for the http request information.

  Specified by:
    `getHttpServletRequest` in interface `WebContext`
  Returns:
    Returns the request.

### getHttpServletResponse

    public javax.servlet.http.HttpServletResponse getHttpServletResponse()

  Description copied from interface: `WebContext`
  Accessor for the http response bean.

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

  Specified by:
    `getHttpServletResponse` in interface `WebContext`
  Returns:
    Returns the response.

### forwardToString

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

  Description copied from interface: `WebContext`
  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);

  Specified by:
    `forwardToString` in interface `WebContext`
  Parameters:
    `url` - The URL to forward to
  Returns:
    The text that results from forwarding to the given URL
  Throws:
    `javax.servlet.ServletException` - if the target resource throws this exception
    `java.io.IOException` - if the target resource throws this exception

### getVersion

    public java.lang.String getVersion()

  Description copied from interface: `ServerContext`
  Fish the version number out of the dwr.properties file.

  Specified by:
    `getVersion` in interface `ServerContext`
  Overrides:
    `getVersion` in class `DefaultServerContext`
  Returns:
    The current version number.

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