CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

container::ServletContainer Class Reference

#include <servletcontainer.h>

Inheritance diagram for container::ServletContainer:
Collaboration diagram for container::ServletContainer:

List of all members.


Public Member Functions

 ServletContainer (servlet::Servlet *, container::ServletConfigImpl *conf, const std::string &path, size_t maxRequestSize, size_t maxFileSize, const std::string &mime, const std::string &enc, bool cache)
 ~ServletContainer ()
std::string getName () const
const std::string & getPath () const
void init ()
void destroy ()
container::ServletConfigImplgetConfig ()
const
container::ServletConfigImpl
getConfig () const
virtual void forward (servlet::ServletRequest &request, servlet::ServletResponse &response) const
virtual void include (servlet::ServletRequest &request, servlet::ServletResponse &response) const

Protected Member Functions

void service (Connection &con)

Private Member Functions

void invalidRequest (std::ostream &con, servlet::Traceable &e)
void invalidRequest (std::ostream &con)

Private Attributes

servlet::Servletm_servlet
container::ServletConfigImplm_conf
std::string m_path
size_t m_maxRequestSize
size_t m_maxFileSize
std::string m_mime
std::string m_enc
 Default mime type for response.
bool m_cache
 Default character encoding for response.

Friends

class RequestHandler

Detailed Description

Object that contains servlet, and that is used in a map of URLs to servlets

Author:
Ilya A. Volynets-Evenbakh

Definition at line 44 of file servletcontainer.h.


Constructor & Destructor Documentation

container::ServletContainer::ServletContainer ( servlet::Servlet servlet,
container::ServletConfigImpl conf,
const std::string &  path,
size_t  maxRequestSize,
size_t  maxFileSize,
const std::string &  mime,
const std::string &  enc,
bool  cache 
)

Definition at line 33 of file servletcontainer.cpp.

container::ServletContainer::~ServletContainer (  ) 

Definition at line 49 of file servletcontainer.cpp.

References m_servlet.


Member Function Documentation

container::ServletContainer::destroy (  )  [inline]

Calls servlet::Servlet::destroy()

Definition at line 81 of file servletcontainer.h.

References servlet::Servlet::destroy(), and m_servlet.

Referenced by container::serverconfig::AppContext::destroyServlet().

Here is the call graph for this function:

void container::ServletContainer::forward ( servlet::ServletRequest request,
servlet::ServletResponse response 
) const [virtual]

Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate the response.

For a RequestDispatcher obtained via getRequestDispatcher(), the ServletRequest object has its path elements and parameters adjusted to match the path of the target resource.

forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.

The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the servlet::ServletRequestWrapper or servlet::ServletResponseWrapper classes that wrap them.

Parameters:
request a servlet::ServletRequest object that represents the request the client makes of the servlet
response a servlet::ServletResponse object that represents the response the servlet returns to the client
Exceptions:
ServletException if the target resource throws this exception
IOException if the target resource throws this exception
IllegalStateException if the response was already committed

Implements servlet::RequestDispatcher.

Definition at line 56 of file servletcontainer.cpp.

References getConfig(), getName(), servlet::ServletResponse::getOutputStream(), getPath(), container::ServletConfigImpl::getServletContext(), container::serverconfig::AppContext::getServletContextName(), container::serverconfig::AppContext::getUriBase(), servlet::ServletResponse::isCommitted(), m_servlet, and servlet::Servlet::service().

Here is the call graph for this function:

const container::ServletConfigImpl* container::ServletContainer::getConfig (  )  const [inline]

Definition at line 90 of file servletcontainer.h.

References m_conf.

container::ServletContainer::getConfig (  )  [inline]

Definition at line 89 of file servletcontainer.h.

References m_conf.

Referenced by forward(), getName(), and container::serverconfig::AppContext::unloadServlet().

container::ServletContainer::getName (  )  const [inline]

Definition at line 55 of file servletcontainer.h.

References getConfig(), and container::ServletConfigImpl::getServletName().

Referenced by forward().

Here is the call graph for this function:

container::ServletContainer::getPath (  )  const [inline]

Definition at line 63 of file servletcontainer.h.

References m_path.

Referenced by forward(), and service().

void container::ServletContainer::include ( servlet::ServletRequest request,
servlet::ServletResponse response 
) const [virtual]

Includes the content of a resource (servlet, JSP page, HTML file) in the response. In essence, this method enables programmatic server-side includes.

The servlet::ServletResponse object has its path elements and parameters remain unchanged from the caller's. The included servlet cannot change the response status code or set headers; any attempt to make a change is ignored.

The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the servlet::ServletRequestWrapper or servlet::ServletResponseWrapper classes that wrap them.

Parameters:
request a servlet::ServletRequest object that contains the client's request
response a servlet::ServletResponse object that contains the servlet's response
Exceptions:
ServletException if the included resource throws this exception
IOException if the included resource throws this exception

Implements servlet::RequestDispatcher.

Definition at line 67 of file servletcontainer.cpp.

References m_servlet, and servlet::Servlet::service().

Here is the call graph for this function:

container::ServletContainer::init (  )  [inline]

Calls servlet::Servlet::init(servlet::ServletConfig&)

Definition at line 72 of file servletcontainer.h.

References servlet::Servlet::init(), m_conf, and m_servlet.

Referenced by container::serverconfig::AppContext::initServlet().

Here is the call graph for this function:

void container::ServletContainer::invalidRequest ( std::ostream &  con  )  [private]

void container::ServletContainer::invalidRequest ( std::ostream &  con,
servlet::Traceable e 
) [private]

Definition at line 73 of file servletcontainer.cpp.

References servlet::Traceable::printStackTrace(), and servlet::HttpServletResponse::SC_INTERNAL_SERVER_ERROR.

Referenced by service().

Here is the call graph for this function:

void container::ServletContainer::service ( Connection con  )  [protected]

Sets up request and response objects and calls servlet's service method

Definition at line 92 of file servletcontainer.cpp.

References getPath(), container::ServletConfigImpl::getServletContext(), invalidRequest(), m_cache, m_conf, m_enc, m_maxFileSize, m_maxRequestSize, m_mime, m_servlet, servlet::Traceable::printStackTrace(), and servlet::Servlet::service().

Referenced by container::RequestHandler::taskFunction().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class RequestHandler [friend]

Definition at line 109 of file servletcontainer.h.


Member Data Documentation

Default character encoding for response.

Definition at line 102 of file servletcontainer.h.

Referenced by service().

std::string container::ServletContainer::m_enc [private]

Default mime type for response.

Definition at line 101 of file servletcontainer.h.

Referenced by service().

Definition at line 99 of file servletcontainer.h.

Referenced by service().

Definition at line 98 of file servletcontainer.h.

Referenced by service().

std::string container::ServletContainer::m_mime [private]

Definition at line 100 of file servletcontainer.h.

Referenced by service().

std::string container::ServletContainer::m_path [private]

Definition at line 97 of file servletcontainer.h.

Referenced by getPath().


The documentation for this class was generated from the following files:

SourceForge.net Logo