<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Wt: Wt::Http::Response Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Wt  <span id="projectnumber">3.2.3</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.5.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceWt.html">Wt</a> </li> <li class="navelem"><a class="el" href="namespaceWt_1_1Http.html">Http</a> </li> <li class="navelem"><a class="el" href="classWt_1_1Http_1_1Response.html">Response</a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <div class="title">Wt::Http::Response Class Reference<div class="ingroups"><a class="el" href="group__http.html">HTTP protocol (Wt::Http)</a></div></div> </div> </div> <div class="contents"> <!-- doxytag: class="Wt::Http::Response" --> <p>A resource response. <a href="classWt_1_1Http_1_1Response.html#details">More...</a></p> <p><code>#include <Wt/Http/Response></code></p> <p><a href="classWt_1_1Http_1_1Response-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#a7c14ba3ab34ff14461df3a4369118443">setStatus</a> (int status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the response status. <a href="#a7c14ba3ab34ff14461df3a4369118443"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#aea93d6918a90e8c9b0010499771a1c87">setContentLength</a> (::uint64_t length)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the content length. <a href="#aea93d6918a90e8c9b0010499771a1c87"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#a20dd49d512ffc0cf407f9dd39db30341">setMimeType</a> (const std::string &mimeType)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the content mime type. <a href="#a20dd49d512ffc0cf407f9dd39db30341"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#a5827dd04629251d0c7ff3cc9062afb7d">addHeader</a> (const std::string &name, const std::string &value)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add an HTTP header. <a href="#a5827dd04629251d0c7ff3cc9062afb7d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classWt_1_1Http_1_1ResponseContinuation.html">ResponseContinuation</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#a5cb0800718188328fec17d3b84c85aab">createContinuation</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create a continuation object for this response. <a href="#a5cb0800718188328fec17d3b84c85aab"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classWt_1_1Http_1_1ResponseContinuation.html">ResponseContinuation</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#ad29d222d15779421a840f8974f07b304">continuation</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the continuation, if one was created for this response. <a href="#ad29d222d15779421a840f8974f07b304"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae74ee0009e9ec4aa3d3f35e680a745de"></a><!-- doxytag: member="Wt::Http::Response::out" ref="ae74ee0009e9ec4aa3d3f35e680a745de" args="()" --> std::ostream & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Http_1_1Response.html#ae74ee0009e9ec4aa3d3f35e680a745de">out</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the stream for getting the response output. <br/></td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>A resource response. </p> <p>This class defines the HTTP response for a <a class="el" href="classWt_1_1WResource.html" title="An object which can be rendered in the HTTP protocol.">WResource</a> request.</p> <p>More specifically you can:</p> <ul> <li>set the content mime type using <a class="el" href="classWt_1_1Http_1_1Response.html#a20dd49d512ffc0cf407f9dd39db30341" title="Set the content mime type.">setMimeType()</a></li> <li>add HTTP headers using <a class="el" href="classWt_1_1Http_1_1Response.html#a5827dd04629251d0c7ff3cc9062afb7d" title="Add an HTTP header.">addHeader()</a></li> <li>stream content into <a class="el" href="classWt_1_1Http_1_1Response.html#ae74ee0009e9ec4aa3d3f35e680a745de" title="Returns the stream for getting the response output.">out()</a></li> </ul> <p>You may chose to provide only a partial response. In that case, use <a class="el" href="classWt_1_1Http_1_1Response.html#a5cb0800718188328fec17d3b84c85aab" title="Create a continuation object for this response.">createContinuation()</a> to create a continuation object to which you can annotate information for the next request to process the response further.</p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WResource.html#a3a740f8cc29e2e6e4e58defc9c88b8b6" title="Handles a request.">WResource::handleRequest()</a>, <a class="el" href="classWt_1_1Http_1_1Request.html" title="A resource request.">Request</a> </dd></dl> </div><hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a5827dd04629251d0c7ff3cc9062afb7d"></a><!-- doxytag: member="Wt::Http::Response::addHeader" ref="a5827dd04629251d0c7ff3cc9062afb7d" args="(const std::string &name, const std::string &value)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::Http::Response::addHeader </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"><em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const std::string & </td> <td class="paramname"><em>value</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Add an HTTP header. </p> <p>Headers may be added only before setting the content mime-type (<a class="el" href="classWt_1_1Http_1_1Response.html#a20dd49d512ffc0cf407f9dd39db30341" title="Set the content mime type.">setMimeType()</a>), and before streaming any data to the <a class="el" href="classWt_1_1Http_1_1Response.html#ae74ee0009e9ec4aa3d3f35e680a745de" title="Returns the stream for getting the response output.">out()</a> stream. </p> </div> </div> <a class="anchor" id="ad29d222d15779421a840f8974f07b304"></a><!-- doxytag: member="Wt::Http::Response::continuation" ref="ad29d222d15779421a840f8974f07b304" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classWt_1_1Http_1_1ResponseContinuation.html">ResponseContinuation</a> * Wt::Http::Response::continuation </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Return the continuation, if one was created for this response. </p> <p>Returns the continuation that was previously created using <a class="el" href="classWt_1_1Http_1_1Response.html#a5cb0800718188328fec17d3b84c85aab" title="Create a continuation object for this response.">createContinuation()</a>, or 0 if no continuation was created yet.</p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1Http_1_1Response.html#a5cb0800718188328fec17d3b84c85aab" title="Create a continuation object for this response.">createContinuation()</a> </dd></dl> </div> </div> <a class="anchor" id="a5cb0800718188328fec17d3b84c85aab"></a><!-- doxytag: member="Wt::Http::Response::createContinuation" ref="a5cb0800718188328fec17d3b84c85aab" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classWt_1_1Http_1_1ResponseContinuation.html">ResponseContinuation</a> * Wt::Http::Response::createContinuation </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Create a continuation object for this response. </p> <p>A continuation is used to resume sending more data later for this response. There are two possible reasons for this:</p> <ul> <li>the entire response is quite big and you may want to read and send it in smaller chunks to avoid memory consumption problems since the I/O layer buffers the response first in memory to send it then out to a possibly slow client using async I/O.</li> <li>you may not have any more data available, currently, but expect more data later. In that case you can call <a class="el" href="classWt_1_1Http_1_1ResponseContinuation.html#a3b441e3fa71a68b9dfb7091464e07433" title="Wait for more data.">ResponseContinuation::waitForMoreData()</a> and later call <a class="el" href="classWt_1_1WResource.html#a1a9c35416eb690939ff288b053da3e1b" title="Indicate that more data is available.">WResource::haveMoreData()</a> when more data is available.</li> </ul> <p>A new call to handleRequest() will be made to retrieve more data.</p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1Http_1_1Response.html#ad29d222d15779421a840f8974f07b304" title="Return the continuation, if one was created for this response.">continuation()</a> </dd></dl> </div> </div> <a class="anchor" id="aea93d6918a90e8c9b0010499771a1c87"></a><!-- doxytag: member="Wt::Http::Response::setContentLength" ref="aea93d6918a90e8c9b0010499771a1c87" args="(::uint64_t length)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::Http::Response::setContentLength </td> <td>(</td> <td class="paramtype">::uint64_t </td> <td class="paramname"><em>length</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the content length. </p> <p>If content length is known, use this method to set it. File downloads will see progress bars. If not set, <a class="el" href="namespaceWt.html" title="The namespace for Wt.">Wt</a> will use chunked transfers.</p> <p>Always use this method instead of setting the Content-Length header with <a class="el" href="classWt_1_1Http_1_1Response.html#a5827dd04629251d0c7ff3cc9062afb7d" title="Add an HTTP header.">addHeader()</a>.</p> <p>Headers may be added only before setting the content mime-type (<a class="el" href="classWt_1_1Http_1_1Response.html#a20dd49d512ffc0cf407f9dd39db30341" title="Set the content mime type.">setMimeType()</a>), and before streaming any data to the <a class="el" href="classWt_1_1Http_1_1Response.html#ae74ee0009e9ec4aa3d3f35e680a745de" title="Returns the stream for getting the response output.">out()</a> stream. </p> </div> </div> <a class="anchor" id="a20dd49d512ffc0cf407f9dd39db30341"></a><!-- doxytag: member="Wt::Http::Response::setMimeType" ref="a20dd49d512ffc0cf407f9dd39db30341" args="(const std::string &mimeType)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::Http::Response::setMimeType </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"><em>mimeType</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the content mime type. </p> <p>The content mimetype is used by the browser to correctly interpret the resource. </p> </div> </div> <a class="anchor" id="a7c14ba3ab34ff14461df3a4369118443"></a><!-- doxytag: member="Wt::Http::Response::setStatus" ref="a7c14ba3ab34ff14461df3a4369118443" args="(int status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Wt::Http::Response::setStatus </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>status</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the response status. </p> <p>Unless a overriden, 200 OK will be assumed. </p> </div> </div> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr size="1"><address style="text-align: right; margin: 3px"><small> Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the C++ Web Toolkit (Wt)</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" border="0" style="vertical-align: middle; display: inline-block; height: 2em"></a> 1.7.5.1</small></address> </body> </html>