Fawkes API  Fawkes Development Version
redirect_reply.cpp
1 
2 /***************************************************************************
3  * redirect_reply.h - Web request reply for a redirect
4  *
5  * Created: Thu Feb 12 13:40:12 2009
6  * Copyright 2006-2009 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <webview/redirect_reply.h>
24 
25 namespace fawkes {
26 #if 0 /* just to make Emacs auto-indent happy */
27 }
28 #endif
29 
30 /** @class WebRedirectReply <webview/redirect_reply.h>
31  * Redirect reply for webview.
32  * This reply will cause an immediate redirect from the requested page
33  * to the given URL. THe URL can be local as well as remote. The redirect
34  * is done on the HTTP level with status code "moved permanently" and
35  * the new URL as "Location" HTTP header.
36  * @author Tim Niemueller
37  */
38 
39 /** Constructor.
40  * @param url the URL to redirect to
41  */
43  : StaticWebReply(WebReply::HTTP_MOVED_PERMANENTLY)
44 {
45  add_header("Location", url);
46 }
47 
48 } // end namespace fawkes
Fawkes library namespace.
void add_header(std::string header, std::string content)
Add a HTTP header.
Definition: reply.cpp:97
Basic web reply.
Definition: reply.h:36
WebRedirectReply(std::string url)
Constructor.
Static web reply.
Definition: reply.h:133