tufao  0.8.1
An asynchronous web framework for C++ built on top of Qt
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Tufao::UrlRewriterHandler Class Reference

This class provides a handler to internally (only seen by your application) rewrite the URL. More...

+ Inheritance diagram for Tufao::UrlRewriterHandler:
+ Collaboration diagram for Tufao::UrlRewriterHandler:

Public Slots

bool handleRequest (Tufao::HttpServerRequest *request, Tufao::HttpServerResponse *response, const QStringList &=QStringList())
 Changes the request url and returns false. More...
 
- Public Slots inherited from Tufao::AbstractHttpServerRequestHandler
virtual bool handleRequest (Tufao::HttpServerRequest *request, Tufao::HttpServerResponse *response, const QStringList &args=QStringList())=0
 Handles the request using the response object. More...
 

Public Member Functions

 UrlRewriterHandler (const QByteArray &url, QObject *parent=0)
 Constructs a UrlRewriterHandler object. More...
 
void setUrl (const QByteArray &url)
 Sets the URL that will replace the old URL to url.
 
QByteArray url () const
 Returns the url used to replace the old URLs.
 
 ~UrlRewriterHandler ()
 Destroys the object.
 
- Public Member Functions inherited from Tufao::AbstractHttpServerRequestHandler
 AbstractHttpServerRequestHandler (QObject *parent=0)
 Constructs an AbstractHttpServerRequestHandler object.
 

Detailed Description

This class provides a handler to internally (only seen by your application) rewrite the URL.

Note
The handler does NOT redirects the HTTP client to another path. The new URL can only be seen by the Tufão application itself and HTTP clients will think they are receiving a response to the path they originally asked for.

One place where this technique is useful is when you want to use one file to handle the root page of your site through HttpFileServer. This example is illustrated in the image below:

urlrewrite.png
Url rewrite example
Since
0.6

Constructor & Destructor Documentation

Tufao::UrlRewriterHandler::UrlRewriterHandler ( const QByteArray &  url,
QObject *  parent = 0 
)
explicit

Constructs a UrlRewriterHandler object.

parent is passed to the QObject constructor.

url will be the new url.

Member Function Documentation

bool Tufao::UrlRewriterHandler::handleRequest ( Tufao::HttpServerRequest request,
Tufao::HttpServerResponse response,
const QStringList &  = QStringList() 
)
slot

Changes the request url and returns false.

This method doesn't do anything else.


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