uk.ltd.getahead.dwr.impl
Class DefaultWebContext

java.lang.Object
  extended byuk.ltd.getahead.dwr.impl.DefaultWebContext
All Implemented Interfaces:
WebContext

public class DefaultWebContext
extends java.lang.Object
implements WebContext

A default implementation of WebContext

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

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
 Container getContainer()
          Accessor for the IoC container.
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Accessor for the http request information.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Accessor for the http response bean.
 javax.servlet.ServletConfig getServletConfig()
          Accessor for the servlet config.
 javax.servlet.ServletContext getServletContext()
          Returns the ServletContext to which this session belongs.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
WebContextBuilder.set(HttpServletRequest, HttpServletResponse, ServletConfig, ServletContext, Container)
Method Detail

getContainer

public Container getContainer()
Description copied from interface: WebContext
Accessor for the IoC container.

Specified by:
getContainer in interface WebContext
Returns:
The IoC container that created the interface implementations.

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)

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Description copied from interface: WebContext
Accessor for the servlet config.

Specified by:
getServletConfig in interface WebContext
Returns:
Returns the config.

getServletContext

public javax.servlet.ServletContext getServletContext()
Description copied from interface: WebContext
Returns the ServletContext to which this session belongs.

Specified by:
getServletContext in interface WebContext
Returns:
The servlet context information.

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.

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

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: WebContext
Fish the version number out of the dwr.properties file.

Specified by:
getVersion in interface WebContext
Returns:
The current version number.

Copyright ? 2005