1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WServer Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<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>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WServer.html">WServer</a>
</div>
</div>
<div class="contents">
<h1>Wt::WServer Class Reference</h1><!-- doxytag: class="Wt::WServer" -->A class encapsulating an application server.
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WServer></code>
<p>
<p>
<a href="classWt_1_1WServer-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#4e347c4f853f527999c8c46c62d16f6b">WServer</a> (const std::string &wtApplicationPath=std::string(), const std::string &wtConfigurationFile=std::string())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new server instance. <a href="#4e347c4f853f527999c8c46c62d16f6b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#e7c9762cd7be550b0fcd71593af5fb37">~WServer</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#e7c9762cd7be550b0fcd71593af5fb37"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#0f3ced6ffd8b8c53d8e34cf27a5e2d94">setServerConfiguration</a> (int argc, char *argv[], const std::string &serverConfigurationFile=std::string())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Configures the HTTP(S) server or FastCGI process. <a href="#0f3ced6ffd8b8c53d8e34cf27a5e2d94"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#84f84652ccb139850adcf5ea75f50fa5">addEntryPoint</a> (<a class="el" href="namespaceWt.html#f4b6ed5fd28b4f5fa141b153c1107349">EntryPointType</a> type, ApplicationCreator callback, const std::string &path=std::string(), const std::string &favicon=std::string())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Binds an entry-point to a callback function to create a new application. <a href="#84f84652ccb139850adcf5ea75f50fa5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#7b78b5e35d2dc3086faa54f82124cf38">addResource</a> (<a class="el" href="classWt_1_1WResource.html">WResource</a> *resource, const std::string &path)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Binds a resource to a fixed path. <a href="#7b78b5e35d2dc3086faa54f82124cf38"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#f1699e7cee79223e6d35c1c5eae0aa5a">start</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Starts the server in the background. <a href="#f1699e7cee79223e6d35c1c5eae0aa5a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c">stop</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Stops the server. <a href="#da0ea6f20704b1255f5c28764c776f2c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#493c35784e8f0ba28281483415eed7e6">isRunning</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the server is running. <a href="#493c35784e8f0ba28281483415eed7e6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#cf48af4046dbb1ad353e54de480dd0c4">httpPort</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the server http port number. <a href="#cf48af4046dbb1ad353e54de480dd0c4"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#da2b943932a470be299594c7e896e275">waitForShutdown</a> (const char *restartWatchFile=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits for a shutdown signal. <a href="#da2b943932a470be299594c7e896e275"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#5d514ec2756c5c4ffe44b10e0b03c5a4">restart</a> (int argc, char **argv, char **envp)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">A utility method to restart. <a href="#5d514ec2756c5c4ffe44b10e0b03c5a4"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Related Functions</h2></td></tr>
<tr><td colspan="2">(Note that these are not member functions.) <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer.html#bca6890dab44d87bd3af64705ac072d3">WRun</a> (int argc, char **argv, ApplicationCreator createApplication=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Runs the Wt application server. <a href="#bca6890dab44d87bd3af64705ac072d3"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WServer_1_1Exception.html">Exception</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Server Exception class. <a href="classWt_1_1WServer_1_1Exception.html#_details">More...</a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A class encapsulating an application server.
<p>
This server class represents an instance of an application server.<p>
It offers support for multiple application entry points and control over starting and stopping the server (the latter functionality is only for supported for the built-in httpd). This may be used as an alternative to using <a class="el" href="classWt_1_1WServer.html#bca6890dab44d87bd3af64705ac072d3" title="Runs the Wt application server.">WRun()</a> when you wish to support multiple application entry points, or for integrating a <a class="el" href="namespaceWt.html" title="The namespace for Wt.">Wt</a> (stand-alone httpd) server application into an existing application, when you want to and start and stop the server as appropriate.<p>
As an example usage, consider the implementation of <a class="el" href="classWt_1_1WServer.html#bca6890dab44d87bd3af64705ac072d3" title="Runs the Wt application server.">WRun()</a>, which starts the server until a Ctrl-C is pressed or a termination signal has been received, or a restart is indicated using SIGHUP or a changed binary (argv[0]):<p>
<div class="fragment"><pre class="fragment"><span class="keywordtype">int</span> <a class="code" href="classWt_1_1WServer.html#bca6890dab44d87bd3af64705ac072d3" title="Runs the Wt application server.">WRun</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[], ApplicationCreator createApplication)
{
<span class="keywordflow">try</span> {
<span class="comment">// use argv[0] as the application name to match a suitable entry</span>
<span class="comment">// in the Wt configuration file, and use the default configuration</span>
<span class="comment">// file (which defaults to /etc/wt/wt_config.xml unless the environment</span>
<span class="comment">// variable WT_CONFIG_XML is set)</span>
<a class="code" href="classWt_1_1WServer.html#4e347c4f853f527999c8c46c62d16f6b" title="Creates a new server instance.">WServer</a> server(argv[0]);
<span class="comment">// WTHTTP_CONFIGURATION is e.g. "/etc/wt/wthttpd"</span>
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
<span class="comment">// add a single entry point, at the default location (as determined</span>
<span class="comment">// by the server configuration's deploy-path)</span>
server.addEntryPoint(WServer::Application, createApplication);
<span class="keywordflow">if</span> (server.start()) {
<span class="keywordtype">int</span> sig = <a class="code" href="classWt_1_1WServer.html#da2b943932a470be299594c7e896e275" title="Waits for a shutdown signal.">WServer::waitForShutdown</a>(argv[0]);
std::cerr << <span class="stringliteral">"Shutdown (signal = "</span> << sig << <span class="stringliteral">")"</span> << std::endl;
server.stop();
<span class="keywordflow">if</span> (sig == SIGHUP)
<a class="code" href="classWt_1_1WServer.html#5d514ec2756c5c4ffe44b10e0b03c5a4" title="A utility method to restart.">WServer::restart</a>(argc, argv, environ);
}
} <span class="keywordflow">catch</span> (WServer::Exception& e) {
std::cerr << e.what() << <span class="stringliteral">"\n"</span>;
<span class="keywordflow">return</span> 1;
} <span class="keywordflow">catch</span> (std::exception& e) {
std::cerr << <span class="stringliteral">"exception: "</span> << e.what() << <span class="stringliteral">"\n"</span>;
<span class="keywordflow">return</span> 1;
}
}
</pre></div><p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Currently, only a single server instance may be created. We plan to remove this limiation in the future. </dd></dl>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="4e347c4f853f527999c8c46c62d16f6b"></a><!-- doxytag: member="Wt::WServer::WServer" ref="4e347c4f853f527999c8c46c62d16f6b" args="(const std::string &wtApplicationPath=std::string(), const std::string &wtConfigurationFile=std::string())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WServer::WServer </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>wtApplicationPath</em> = <code>std::string()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>wtConfigurationFile</em> = <code>std::string()</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new server instance.
<p>
The <code>wtApplicationPath</code> is used to match specific application-settings in the Wt configuration file. If no specific match could be found, the general settings are used (corresponding to the '*' selector).<p>
The Wt application configuration is read from the <code>wtConfigurationFile</code>. If empty, this defaults to the value configured at build time.<p>
For more information on configuring Wt applications, see <a class="el" href="overview.html#configuration_sec">Configuration</a>.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classWt_1_1WServer_1_1Exception.html" title="Server Exception class.">Exception</a></em> </td><td>: indicates a configuration problem.</td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WServer.html#0f3ced6ffd8b8c53d8e34cf27a5e2d94" title="Configures the HTTP(S) server or FastCGI process.">setServerConfiguration()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e7c9762cd7be550b0fcd71593af5fb37"></a><!-- doxytag: member="Wt::WServer::~WServer" ref="e7c9762cd7be550b0fcd71593af5fb37" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WServer::~WServer </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Destructor.
<p>
If the server was still running, it is stopped first by calling <a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c" title="Stops the server.">stop()</a>. It is probably safer to call <a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c" title="Stops the server.">stop()</a> first yourself, since this allows exceptions to be caught.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WServer.html#493c35784e8f0ba28281483415eed7e6" title="Returns whether the server is running.">isRunning()</a>, <a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c" title="Stops the server.">stop()</a> </dd></dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="0f3ced6ffd8b8c53d8e34cf27a5e2d94"></a><!-- doxytag: member="Wt::WServer::setServerConfiguration" ref="0f3ced6ffd8b8c53d8e34cf27a5e2d94" args="(int argc, char *argv[], const std::string &serverConfigurationFile=std::string())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WServer::setServerConfiguration </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"> <em>argv</em>[], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>serverConfigurationFile</em> = <code>std::string()</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Configures the HTTP(S) server or FastCGI process.
<p>
Configures the HTTP(S) server using command-line arguments, a configuration file, or both. The valid options are described in <a class="el" href="overview.html#config_wthttpd">Built-in httpd configuration</a>.<p>
The applications themselves are configured using the configuration file passed to the constructor.<p>
The server configuration must be set before any other functionality can be used.<p>
In case of FastCGI deployment, the <code>serverConfigurationFile</code> argument is ignored, and depending on the command-line arguments, this process may become a FastCGI protocol relay process which never returning from this call but directs the FastCGI stream to the correct session, rather than a <a class="el" href="namespaceWt.html" title="The namespace for Wt.">Wt</a> application server.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classWt_1_1WServer_1_1Exception.html" title="Server Exception class.">Exception</a></em> </td><td>: indicates a configuration problem. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="84f84652ccb139850adcf5ea75f50fa5"></a><!-- doxytag: member="Wt::WServer::addEntryPoint" ref="84f84652ccb139850adcf5ea75f50fa5" args="(EntryPointType type, ApplicationCreator callback, const std::string &path=std::string(), const std::string &favicon=std::string())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WServer::addEntryPoint </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceWt.html#f4b6ed5fd28b4f5fa141b153c1107349">EntryPointType</a> </td>
<td class="paramname"> <em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ApplicationCreator </td>
<td class="paramname"> <em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>path</em> = <code>std::string()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>favicon</em> = <code>std::string()</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Binds an entry-point to a callback function to create a new application.
<p>
The <code>path</code> is the local URL at which the application is deployed: when a user visits this URL, the callback will be called to create a new application. If empty, the URL is inferred from the server configuration's deploy-path (see also <a class="el" href="overview.html#config_wthttpd">Built-in httpd configuration</a>).<p>
The path must start with a '/'.<p>
The optional <code>favicon</code> is a URL path (which should not contain the host part!) to a favicon, which is the icon displayed in the browser for your application. Alternatively, you may specify a favicon using the "favicon" property in the configuration file (see als <a class="el" href="overview.html#config_general">Application</a> settings (wt_config.xml)").
</div>
</div><p>
<a class="anchor" name="7b78b5e35d2dc3086faa54f82124cf38"></a><!-- doxytag: member="Wt::WServer::addResource" ref="7b78b5e35d2dc3086faa54f82124cf38" args="(WResource *resource, const std::string &path)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WServer::addResource </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td>
<td class="paramname"> <em>resource</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>path</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Binds a resource to a fixed path.
<p>
Resources may either be private to a single session or public. Use this method to add a public resource with a fixed path.
</div>
</div><p>
<a class="anchor" name="f1699e7cee79223e6d35c1c5eae0aa5a"></a><!-- doxytag: member="Wt::WServer::start" ref="f1699e7cee79223e6d35c1c5eae0aa5a" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Wt::WServer::start </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Starts the server in the background.
<p>
Returns whether the server could be successfully started.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classWt_1_1WServer_1_1Exception.html" title="Server Exception class.">Exception</a></em> </td><td>: indicates a problem starting the server.</td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WServer.html#493c35784e8f0ba28281483415eed7e6" title="Returns whether the server is running.">isRunning()</a>, <a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c" title="Stops the server.">stop()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="da0ea6f20704b1255f5c28764c776f2c"></a><!-- doxytag: member="Wt::WServer::stop" ref="da0ea6f20704b1255f5c28764c776f2c" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WServer::stop </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Stops the server.
<p>
All active application sessions are terminated cleanly, and the HTTP(S) server is shut down.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classWt_1_1WServer_1_1Exception.html" title="Server Exception class.">Exception</a></em> </td><td>: indicates a problem while stopping the server.</td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WServer.html#493c35784e8f0ba28281483415eed7e6" title="Returns whether the server is running.">isRunning()</a>, <a class="el" href="classWt_1_1WServer.html#f1699e7cee79223e6d35c1c5eae0aa5a" title="Starts the server in the background.">start()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="da2b943932a470be299594c7e896e275"></a><!-- doxytag: member="Wt::WServer::waitForShutdown" ref="da2b943932a470be299594c7e896e275" args="(const char *restartWatchFile=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int Wt::WServer::waitForShutdown </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>restartWatchFile</em> = <code>0</code> </td>
<td> ) </td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Waits for a shutdown signal.
<p>
This static method blocks the current thread, waiting for a shutdown signal. The implementation and details are platform dependent, but this is usually Ctrl-C (SIGINT), SIGKILL, or SIGHUP.<p>
This method is convenient if you want to customize how the server is started (by instantiating a <a class="el" href="classWt_1_1WServer.html" title="A class encapsulating an application server.">WServer</a> object yourself, instead of using Wt::Wrun()), but still want to use Wt as a standalone server that cleanly terminates on interruption.<p>
The optional <code>restartWatchFile</code> parameter can be used to let the server watch for changes to a particular file (usually the binary itself, argv[0]) which it will also interpret as SIGHUP. This may be convenient to start the new binary after cleanly shutting down, using <a class="el" href="classWt_1_1WServer.html#5d514ec2756c5c4ffe44b10e0b03c5a4" title="A utility method to restart.">restart()</a>. <em>(Experimental, UNIX only)</em>
</div>
</div><p>
<a class="anchor" name="5d514ec2756c5c4ffe44b10e0b03c5a4"></a><!-- doxytag: member="Wt::WServer::restart" ref="5d514ec2756c5c4ffe44b10e0b03c5a4" args="(int argc, char **argv, char **envp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static void Wt::WServer::restart </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"> <em>argv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"> <em>envp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
A utility method to restart.
<p>
This will result the application with the new image (argv[0]), effectively loading a newly deployed version. <em>(Experimental, UNIX only)</em>
</div>
</div><p>
<a class="anchor" name="493c35784e8f0ba28281483415eed7e6"></a><!-- doxytag: member="Wt::WServer::isRunning" ref="493c35784e8f0ba28281483415eed7e6" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Wt::WServer::isRunning </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns whether the server is running.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WServer.html#f1699e7cee79223e6d35c1c5eae0aa5a" title="Starts the server in the background.">start()</a>, <a class="el" href="classWt_1_1WServer.html#da0ea6f20704b1255f5c28764c776f2c" title="Stops the server.">stop()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="cf48af4046dbb1ad353e54de480dd0c4"></a><!-- doxytag: member="Wt::WServer::httpPort" ref="cf48af4046dbb1ad353e54de480dd0c4" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Wt::WServer::httpPort </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the server http port number.
<p>
Returns -1 if the port is not known (i.e. because the connector is not aware of how the http server is configured).
</div>
</div><p>
<hr><h2>Friends And Related Function Documentation</h2>
<a class="anchor" name="bca6890dab44d87bd3af64705ac072d3"></a><!-- doxytag: member="Wt::WServer::WRun" ref="bca6890dab44d87bd3af64705ac072d3" args="(int argc, char **argv, ApplicationCreator createApplication=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WRun </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"> <em>argv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ApplicationCreator </td>
<td class="paramname"> <em>createApplication</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [related]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Runs the Wt application server.
<p>
This function runs the application server, and should be called only once (e.g. from within your main function).<p>
The <em>createApplication</em> argument is a function pointer to create new application instances for each new user surfing to your application.<p>
When using the built-in httpd, the implementation listens for POSIX termination signals (or console CTRL-C) event. You can use the <a class="el" href="classWt_1_1WServer.html" title="A class encapsulating an application server.">WServer</a> class for more flexible control on starting and stopping the server.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WApplication.html" title="Represents an application instance for a single session.">WApplication</a> </dd></dl>
</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:07 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>
|