Minnal C++ Servlet Container
1.7.0
Developed by Sans Pareil Technologies, Inc. (SPT)
|
The Servlet that builds dynamic output based on files with extension cms
stored under the virtual host document root.
More...
#include <CMSServlet.h>
Public Member Functions | |
CMSServlet () | |
Default CTOR. More... | |
virtual | ~CMSServlet () |
Virtual DTOR for sub-classes. More... | |
const std::string | getServletName () const |
Return a descriptive name for this servlet (useful for logging). More... | |
void | init () |
Initialise the servlet instance. Invoked from VirtualHostServer. More... | |
Public Member Functions inherited from spt::servlet::Servlet | |
Servlet () | |
Default CTOR. More... | |
virtual | ~Servlet () |
Virtual DTOR for sub-classes. More... | |
void | service (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
The primary request/response handling method. More... | |
virtual const std::string & | getServerIdentifier () const |
void | setServletConfig (const model::ServletConfigPtr sc) |
Set the servlet configuration information for this instance. More... | |
void | setHostContext (const model::HostContextPtr hptr) |
Set the host context information for this instance. More... | |
Protected Member Functions | |
Poco::Logger & | getLogger () |
Protected Member Functions inherited from spt::servlet::FileServlet | |
void | doGet (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a GET HTTP request from a client. More... | |
void | doHead (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a HEAD HTTP request from a client. More... | |
void | doOptions (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a OPTIONS HTTP request from a client. More... | |
bool | checkURI (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Check the URI specified in client request to ensure it is valid. Validity checks try to protect against common attacks attempted by malicious scripts and hackers. More... | |
std::string | checksum (const Poco::File &filePath) |
Compute a checksum for the specified file. May be used for etags or similar purposes. More... | |
Protected Member Functions inherited from spt::servlet::Servlet | |
const model::ServletConfigPtr | getServletConfig () const |
model::HostContextPtr | getHostContext () |
const model::HostConfigurationPtr | getHostConfiguration () |
const model::ContextParams & | getContextParams () const |
const model::InitParams & | getInitParams () const |
const std::string & | getName () const |
const std::string & | getClassName () const |
void | log (const std::string &msg) |
Log the specified information message to the getLogger. More... | |
void | log (const std::string &className, const std::string &method, const std::string &msg) |
Log the specified information message to the getLogger Prefix the message with the className and method . More... | |
void | sendErrorResponse (Poco::Net::HTTPResponse::HTTPStatus status, const std::string &message, Poco::Net::HTTPServerResponse &resp) |
Send an error response with the specified status and explanation message to the response. More... | |
virtual bool | authenticate (const Poco::Net::HTTPServerRequest &req) |
bool | requiresAuthentication (const Poco::Net::HTTPServerRequest &req) |
Checks rules in web.xml to determine if URI is protected. More... | |
virtual const std::string * | getRealm () const |
Sub-classes that need to specify custom realms must over-ride. The default implementation uses the realm configured under the login-config element in web.xml. More... | |
virtual void | doPost (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a POST HTTP request from a client. More... | |
virtual void | doTrace (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a TRACE HTTP request from a client. More... | |
virtual void | doPut (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a PUT HTTP request from a client. More... | |
virtual void | doDelete (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) |
Handle a DELETE HTTP request from a client. More... | |
bool | gzipResponse (const Poco::Net::HTTPServerRequest &req) const |
Check to see if request specified gzip compressed response. More... | |
bool | deflateResponse (const Poco::Net::HTTPServerRequest &req) const |
Check to see if request specified deflate compressed response. More... | |
bool | rangeRequest (const Poco::Net::HTTPServerRequest &req) const |
Check to see if request specified a byte range from full data. More... | |
const Range | getRequestedRange (const Poco::Net::HTTPServerRequest &req) const |
Return the byte range specified in the request. More... | |
const std::string | getContentType (const std::string &path) const |
Return the mime-type for the resource at specified path. More... | |
const std::string & | stringValue (const std::string &key, const std::string &defaultValue=std::string()) const |
Return value of init or context param with specified key. More... | |
int | intValue (const std::string &key) const |
Return int value of init or context param with specified key. More... | |
bool | booleanValue (const std::string &key) const |
Return value of init or context param with specified key. More... | |
model::ServletSecurityPtr | securityForPath (const std::string &url) |
Attempt to return ServletSecurity for path. Designed to be invoked from servletSecurity( const string& ). More... | |
model::ServletSecurityPtr | servletSecurity (const std::string &url) |
Return the servlet security configuration if any for request path. More... | |
const std::string & | getDocRoot () const |
Additional Inherited Members | |
Static Public Attributes inherited from spt::servlet::Servlet | |
static const std::string | ALLOW |
The HTTP Allow header. More... | |
static const std::string | ACCEPT_RANGES |
The HTTP Accept-Ranges header. More... | |
static const std::string | CACHE_CONTROL |
The HTTP Cache-Control directive. More... | |
static const std::string | CONTENT_RANGE |
The HTTP Content-Range header. More... | |
static const std::string | ETAG_HEADER |
The HTTP ETag header. More... | |
static const std::string | IF_MODIFIED_SINCE |
The HTTP If-Modified-Since header. More... | |
static const std::string | IF_RANGE |
The HTTP If-Range header. More... | |
static const std::string | LAST_MODIFIED_HEADER |
The HTTP Last-Modified header. More... | |
static const std::string | MUST_REVALIDATE |
The HTTP must-revalidate header. More... | |
static const std::string | RANGE |
The HTTP Range header. More... | |
Protected Types inherited from spt::servlet::Servlet | |
typedef std::pair < Poco::UInt32, Poco::UInt32 > | Range |
Pair of the starting and ending byte range specified in request. More... | |
The Servlet that builds dynamic output based on files with extension cms
stored under the virtual host document root.
These files are JSON files that specify the location of template to use to render the dynamic content, as well as the type of datastore to retrieve the associted data from.
Data (also represented as JSON) will be loaded from the appropriate datastore and used to build the ctemplate data dictionary. Data will need to be stored with a path that is the same as the path to the requested cms
file.
|
inline |
Default CTOR.
|
inlinevirtual |
Virtual DTOR for sub-classes.
|
inlineprotectedvirtual |
Reimplemented from spt::servlet::Servlet.
|
inlinevirtual |
Return a descriptive name for this servlet (useful for logging).
Reimplemented from spt::servlet::Servlet.
|
virtual |
Initialise the servlet instance. Invoked from VirtualHostServer.
Reimplemented from spt::servlet::Servlet.