/lib/docs/org/apache/xmlrpc/webserver/WebServer.html
HTML | 820 lines | 716 code | 80 blank | 24 comment | 0 complexity | fe08bc6ddcfd6d94c5febb653d942bbe MD5 | raw file
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.6.0_0) on Mon Apr 20 21:45:59 CEST 2009 --> 6<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<TITLE> 8WebServer (Apache XML-RPC 3.1.2 API) 9</TITLE> 10 11<META NAME="date" CONTENT="2009-04-20"> 12 13<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 14 15<SCRIPT type="text/javascript"> 16function windowTitle() 17{ 18 if (location.href.indexOf('is-external=true') == -1) { 19 parent.document.title="WebServer (Apache XML-RPC 3.1.2 API)"; 20 } 21} 22</SCRIPT> 23<NOSCRIPT> 24</NOSCRIPT> 25 26</HEAD> 27 28<BODY BGCOLOR="white" onload="windowTitle();"> 29<HR> 30 31 32<!-- ========= START OF TOP NAVBAR ======= --> 33<A NAME="navbar_top"><!-- --></A> 34<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 35<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 36<TR> 37<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 38<A NAME="navbar_top_firstrow"><!-- --></A> 39<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 40 <TR ALIGN="center" VALIGN="top"> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 43 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/WebServer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 48 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 49 </TR> 50</TABLE> 51</TD> 52<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 53</EM> 54</TD> 55</TR> 56 57<TR> 58<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 59 <A HREF="../../../../org/apache/xmlrpc/webserver/ServletWebServer.Exception.html" title="class in org.apache.xmlrpc.webserver"><B>PREV CLASS</B></A> 60 <A HREF="../../../../org/apache/xmlrpc/webserver/XmlRpcServlet.html" title="class in org.apache.xmlrpc.webserver"><B>NEXT CLASS</B></A></FONT></TD> 61<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 62 <A HREF="../../../../index.html?org/apache/xmlrpc/webserver/WebServer.html" target="_top"><B>FRAMES</B></A> 63 <A HREF="WebServer.html" target="_top"><B>NO FRAMES</B></A> 64 <SCRIPT type="text/javascript"> 65 <!-- 66 if(window==top) { 67 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 68 } 69 //--> 70</SCRIPT> 71<NOSCRIPT> 72 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 73</NOSCRIPT> 74 75 76</FONT></TD> 77</TR> 78<TR> 79<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 80 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 81<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 82DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 83</TR> 84</TABLE> 85<A NAME="skip-navbar_top"></A> 86<!-- ========= END OF TOP NAVBAR ========= --> 87 88<HR> 89<!-- ======== START OF CLASS DATA ======== --> 90<H2> 91<FONT SIZE="-1"> 92org.apache.xmlrpc.webserver</FONT> 93<BR> 94Class WebServer</H2> 95<PRE> 96java.lang.Object 97 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.xmlrpc.webserver.WebServer</B> 98</PRE> 99<DL> 100<DT><B>All Implemented Interfaces:</B> <DD>java.lang.Runnable</DD> 101</DL> 102<DL> 103<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/xmlrpc/webserver/ServletWebServer.html" title="class in org.apache.xmlrpc.webserver">ServletWebServer</A></DD> 104</DL> 105<HR> 106<DL> 107<DT><PRE>public class <B>WebServer</B><DT>extends java.lang.Object<DT>implements java.lang.Runnable</DL> 108</PRE> 109 110<P> 111<p>The <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>WebServer</CODE></A> is a minimal HTTP server, that might be used 112 as an embedded web server.</p> 113 <p>Use of the <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>WebServer</CODE></A> has grown very popular amongst users 114 of Apache XML-RPC. Why this is the case, can hardly be explained, 115 because the <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>WebServer</CODE></A> is at best a workaround, compared to 116 full blown servlet engines like Tomcat or Jetty. For example, under 117 heavy load it will almost definitely be slower than a real servlet 118 engine, because it does neither support proper keepalive (multiple 119 requests per physical connection) nor chunked mode (in other words, 120 it cannot stream requests).</p> 121 <p>If you still insist in using the <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>WebServer</CODE></A>, it is 122 recommended to use its subclass, the <A HREF="../../../../org/apache/xmlrpc/webserver/ServletWebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>ServletWebServer</CODE></A> instead, 123 which offers a minimal subset of the servlet API. In other words, 124 you keep yourself the option to migrate to a real servlet engine 125 later.</p> 126 <p>Use of the <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver"><CODE>WebServer</CODE></A> goes roughly like this: First of all, 127 create a property file (for example "MyHandlers.properties") and 128 add it to your jar file. The property keys are handler names and 129 the property values are the handler classes. Once that is done, 130 create an instance of WebServer: 131 <pre> 132 final int port = 8088; 133 final String propertyFile = "MyHandler.properties"; 134 135 PropertyHandlerMapping mapping = new PropertyHandlerMapping(); 136 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 137 mapping.load(cl, propertyFile); 138 WebServer webServer = new WebServer(port); 139 XmlRpcServerConfigImpl config = new XmlRpcServerConfigImpl(); 140 XmlRpcServer server = webServer.getXmlRpcServer(); 141 server.setConfig(config); 142 server.setHandlerMapping(mapping); 143 webServer.start(); 144 </pre> 145<P> 146 147<P> 148<HR> 149 150<P> 151<!-- =========== FIELD SUMMARY =========== --> 152 153<A NAME="field_summary"><!-- --></A> 154<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 155<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 156<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 157<B>Field Summary</B></FONT></TH> 158</TR> 159<TR BGCOLOR="white" CLASS="TableRowColor"> 160<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 161<CODE>protected java.util.List</CODE></FONT></TD> 162<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#accept">accept</A></B></CODE> 163 164<BR> 165 </TD> 166</TR> 167<TR BGCOLOR="white" CLASS="TableRowColor"> 168<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 169<CODE>protected java.util.List</CODE></FONT></TD> 170<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#deny">deny</A></B></CODE> 171 172<BR> 173 </TD> 174</TR> 175<TR BGCOLOR="white" CLASS="TableRowColor"> 176<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 177<CODE>protected <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A></CODE></FONT></TD> 178<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#server">server</A></B></CODE> 179 180<BR> 181 </TD> 182</TR> 183<TR BGCOLOR="white" CLASS="TableRowColor"> 184<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 185<CODE>protected java.net.ServerSocket</CODE></FONT></TD> 186<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#serverSocket">serverSocket</A></B></CODE> 187 188<BR> 189 </TD> 190</TR> 191</TABLE> 192 193<!-- ======== CONSTRUCTOR SUMMARY ======== --> 194 195<A NAME="constructor_summary"><!-- --></A> 196<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 197<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 198<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 199<B>Constructor Summary</B></FONT></TH> 200</TR> 201<TR BGCOLOR="white" CLASS="TableRowColor"> 202<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#WebServer(int)">WebServer</A></B>(int pPort)</CODE> 203 204<BR> 205 Creates a web server at the specified port number.</TD> 206</TR> 207<TR BGCOLOR="white" CLASS="TableRowColor"> 208<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#WebServer(int, java.net.InetAddress)">WebServer</A></B>(int pPort, 209 java.net.InetAddress pAddr)</CODE> 210 211<BR> 212 Creates a web server at the specified port number and IP address.</TD> 213</TR> 214</TABLE> 215 216<!-- ========== METHOD SUMMARY =========== --> 217 218<A NAME="method_summary"><!-- --></A> 219<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 220<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 221<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 222<B>Method Summary</B></FONT></TH> 223</TR> 224<TR BGCOLOR="white" CLASS="TableRowColor"> 225<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 226<CODE> void</CODE></FONT></TD> 227<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#acceptClient(java.lang.String)">acceptClient</A></B>(java.lang.String pAddress)</CODE> 228 229<BR> 230 Add an IP address to the list of accepted clients.</TD> 231</TR> 232<TR BGCOLOR="white" CLASS="TableRowColor"> 233<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 234<CODE>protected boolean</CODE></FONT></TD> 235<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#allowConnection(java.net.Socket)">allowConnection</A></B>(java.net.Socket s)</CODE> 236 237<BR> 238 Checks incoming connections to see if they should be allowed.</TD> 239</TR> 240<TR BGCOLOR="white" CLASS="TableRowColor"> 241<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 242<CODE>protected java.net.ServerSocket</CODE></FONT></TD> 243<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#createServerSocket(int, int, java.net.InetAddress)">createServerSocket</A></B>(int pPort, 244 int backlog, 245 java.net.InetAddress addr)</CODE> 246 247<BR> 248 Factory method to manufacture the server socket.</TD> 249</TR> 250<TR BGCOLOR="white" CLASS="TableRowColor"> 251<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 252<CODE> void</CODE></FONT></TD> 253<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#denyClient(java.lang.String)">denyClient</A></B>(java.lang.String pAddress)</CODE> 254 255<BR> 256 Add an IP address to the list of denied clients.</TD> 257</TR> 258<TR BGCOLOR="white" CLASS="TableRowColor"> 259<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 260<CODE> int</CODE></FONT></TD> 261<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#getPort()">getPort</A></B>()</CODE> 262 263<BR> 264 Returns the port, on which the web server is running.</TD> 265</TR> 266<TR BGCOLOR="white" CLASS="TableRowColor"> 267<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 268<CODE> <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A></CODE></FONT></TD> 269<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#getXmlRpcServer()">getXmlRpcServer</A></B>()</CODE> 270 271<BR> 272 Returns the <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcServer.html" title="class in org.apache.xmlrpc.server"><CODE>XmlRpcServer</CODE></A>.</TD> 273</TR> 274<TR BGCOLOR="white" CLASS="TableRowColor"> 275<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 276<CODE>protected boolean</CODE></FONT></TD> 277<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#isParanoid()">isParanoid</A></B>()</CODE> 278 279<BR> 280 Returns the client filtering state.</TD> 281</TR> 282<TR BGCOLOR="white" CLASS="TableRowColor"> 283<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 284<CODE> void</CODE></FONT></TD> 285<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#log(java.lang.String)">log</A></B>(java.lang.String pMessage)</CODE> 286 287<BR> 288 Logs a message.</TD> 289</TR> 290<TR BGCOLOR="white" CLASS="TableRowColor"> 291<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 292<CODE> void</CODE></FONT></TD> 293<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#log(java.lang.Throwable)">log</A></B>(java.lang.Throwable pError)</CODE> 294 295<BR> 296 Logs an error.</TD> 297</TR> 298<TR BGCOLOR="white" CLASS="TableRowColor"> 299<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 300<CODE>protected <A HREF="../../../../org/apache/xmlrpc/util/ThreadPool.Task.html" title="interface in org.apache.xmlrpc.util">ThreadPool.Task</A></CODE></FONT></TD> 301<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#newTask(org.apache.xmlrpc.webserver.WebServer, org.apache.xmlrpc.server.XmlRpcStreamServer, java.net.Socket)">newTask</A></B>(<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver">WebServer</A> pServer, 302 <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A> pXmlRpcServer, 303 java.net.Socket pSocket)</CODE> 304 305<BR> 306 </TD> 307</TR> 308<TR BGCOLOR="white" CLASS="TableRowColor"> 309<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 310<CODE>protected <A HREF="../../../../org/apache/xmlrpc/util/ThreadPool.html" title="class in org.apache.xmlrpc.util">ThreadPool</A></CODE></FONT></TD> 311<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#newThreadPool()">newThreadPool</A></B>()</CODE> 312 313<BR> 314 </TD> 315</TR> 316<TR BGCOLOR="white" CLASS="TableRowColor"> 317<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 318<CODE>protected <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A></CODE></FONT></TD> 319<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#newXmlRpcStreamServer()">newXmlRpcStreamServer</A></B>()</CODE> 320 321<BR> 322 </TD> 323</TR> 324<TR BGCOLOR="white" CLASS="TableRowColor"> 325<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 326<CODE> void</CODE></FONT></TD> 327<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#run()">run</A></B>()</CODE> 328 329<BR> 330 Listens for client requests until stopped.</TD> 331</TR> 332<TR BGCOLOR="white" CLASS="TableRowColor"> 333<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 334<CODE> void</CODE></FONT></TD> 335<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#setParanoid(boolean)">setParanoid</A></B>(boolean pParanoid)</CODE> 336 337<BR> 338 Switch client filtering on/off.</TD> 339</TR> 340<TR BGCOLOR="white" CLASS="TableRowColor"> 341<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 342<CODE> void</CODE></FONT></TD> 343<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#shutdown()">shutdown</A></B>()</CODE> 344 345<BR> 346 Stop listening on the server port.</TD> 347</TR> 348<TR BGCOLOR="white" CLASS="TableRowColor"> 349<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 350<CODE> void</CODE></FONT></TD> 351<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#start()">start</A></B>()</CODE> 352 353<BR> 354 Spawns a new thread which binds this server to the port it's 355 configured to accept connections on.</TD> 356</TR> 357</TABLE> 358 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 359<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 360<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 361<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> 362</TR> 363<TR BGCOLOR="white" CLASS="TableRowColor"> 364<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> 365</TR> 366</TABLE> 367 368<P> 369 370<!-- ============ FIELD DETAIL =========== --> 371 372<A NAME="field_detail"><!-- --></A> 373<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 374<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 375<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 376<B>Field Detail</B></FONT></TH> 377</TR> 378</TABLE> 379 380<A NAME="serverSocket"><!-- --></A><H3> 381serverSocket</H3> 382<PRE> 383protected java.net.ServerSocket <B>serverSocket</B></PRE> 384<DL> 385<DL> 386</DL> 387</DL> 388<HR> 389 390<A NAME="accept"><!-- --></A><H3> 391accept</H3> 392<PRE> 393protected final java.util.List <B>accept</B></PRE> 394<DL> 395<DL> 396</DL> 397</DL> 398<HR> 399 400<A NAME="deny"><!-- --></A><H3> 401deny</H3> 402<PRE> 403protected final java.util.List <B>deny</B></PRE> 404<DL> 405<DL> 406</DL> 407</DL> 408<HR> 409 410<A NAME="server"><!-- --></A><H3> 411server</H3> 412<PRE> 413protected final <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A> <B>server</B></PRE> 414<DL> 415<DL> 416</DL> 417</DL> 418 419<!-- ========= CONSTRUCTOR DETAIL ======== --> 420 421<A NAME="constructor_detail"><!-- --></A> 422<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 423<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 424<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 425<B>Constructor Detail</B></FONT></TH> 426</TR> 427</TABLE> 428 429<A NAME="WebServer(int)"><!-- --></A><H3> 430WebServer</H3> 431<PRE> 432public <B>WebServer</B>(int pPort)</PRE> 433<DL> 434<DD>Creates a web server at the specified port number. 435<P> 436<DL> 437<DT><B>Parameters:</B><DD><CODE>pPort</CODE> - Port number; 0 for a random port, choosen by the 438 operating system.</DL> 439</DL> 440<HR> 441 442<A NAME="WebServer(int, java.net.InetAddress)"><!-- --></A><H3> 443WebServer</H3> 444<PRE> 445public <B>WebServer</B>(int pPort, 446 java.net.InetAddress pAddr)</PRE> 447<DL> 448<DD>Creates a web server at the specified port number and IP address. 449<P> 450<DL> 451<DT><B>Parameters:</B><DD><CODE>pPort</CODE> - Port number; 0 for a random port, choosen by the 452 operating system.<DD><CODE>pAddr</CODE> - Local IP address; null for all available IP addresses.</DL> 453</DL> 454 455<!-- ============ METHOD DETAIL ========== --> 456 457<A NAME="method_detail"><!-- --></A> 458<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 459<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 460<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 461<B>Method Detail</B></FONT></TH> 462</TR> 463</TABLE> 464 465<A NAME="newXmlRpcStreamServer()"><!-- --></A><H3> 466newXmlRpcStreamServer</H3> 467<PRE> 468protected <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A> <B>newXmlRpcStreamServer</B>()</PRE> 469<DL> 470<DD><DL> 471</DL> 472</DD> 473<DD><DL> 474</DL> 475</DD> 476</DL> 477<HR> 478 479<A NAME="createServerSocket(int, int, java.net.InetAddress)"><!-- --></A><H3> 480createServerSocket</H3> 481<PRE> 482protected java.net.ServerSocket <B>createServerSocket</B>(int pPort, 483 int backlog, 484 java.net.InetAddress addr) 485 throws java.io.IOException</PRE> 486<DL> 487<DD>Factory method to manufacture the server socket. Useful as a 488 hook method for subclasses to override when they desire 489 different flavor of socket (i.e. a <code>SSLServerSocket</code>). 490<P> 491<DD><DL> 492</DL> 493</DD> 494<DD><DL> 495<DT><B>Parameters:</B><DD><CODE>pPort</CODE> - Port number; 0 for a random port, choosen by the operating 496 system.<DD><CODE>backlog</CODE> - <DD><CODE>addr</CODE> - If <code>null</code>, binds to 497 <code>INADDR_ANY</code>, meaning that all network interfaces on 498 a multi-homed host will be listening. 499<DT><B>Throws:</B> 500<DD><CODE>java.io.IOException</CODE> - Error creating listener socket.</DL> 501</DD> 502</DL> 503<HR> 504 505<A NAME="start()"><!-- --></A><H3> 506start</H3> 507<PRE> 508public void <B>start</B>() 509 throws java.io.IOException</PRE> 510<DL> 511<DD>Spawns a new thread which binds this server to the port it's 512 configured to accept connections on. 513<P> 514<DD><DL> 515</DL> 516</DD> 517<DD><DL> 518 519<DT><B>Throws:</B> 520<DD><CODE>java.io.IOException</CODE> - Binding the server socket failed.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#run()"><CODE>run()</CODE></A></DL> 521</DD> 522</DL> 523<HR> 524 525<A NAME="setParanoid(boolean)"><!-- --></A><H3> 526setParanoid</H3> 527<PRE> 528public void <B>setParanoid</B>(boolean pParanoid)</PRE> 529<DL> 530<DD>Switch client filtering on/off. 531<P> 532<DD><DL> 533</DL> 534</DD> 535<DD><DL> 536<DT><B>Parameters:</B><DD><CODE>pParanoid</CODE> - True to enable filtering, false otherwise.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#acceptClient(java.lang.String)"><CODE>acceptClient(java.lang.String)</CODE></A>, 537<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#denyClient(java.lang.String)"><CODE>denyClient(java.lang.String)</CODE></A></DL> 538</DD> 539</DL> 540<HR> 541 542<A NAME="isParanoid()"><!-- --></A><H3> 543isParanoid</H3> 544<PRE> 545protected boolean <B>isParanoid</B>()</PRE> 546<DL> 547<DD>Returns the client filtering state. 548<P> 549<DD><DL> 550</DL> 551</DD> 552<DD><DL> 553 554<DT><B>Returns:</B><DD>True, if client filtering is enabled, false otherwise.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#acceptClient(java.lang.String)"><CODE>acceptClient(java.lang.String)</CODE></A>, 555<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#denyClient(java.lang.String)"><CODE>denyClient(java.lang.String)</CODE></A></DL> 556</DD> 557</DL> 558<HR> 559 560<A NAME="acceptClient(java.lang.String)"><!-- --></A><H3> 561acceptClient</H3> 562<PRE> 563public void <B>acceptClient</B>(java.lang.String pAddress)</PRE> 564<DL> 565<DD>Add an IP address to the list of accepted clients. The parameter can 566 contain '*' as wildcard character, e.g. "192.168.*.*". You must call 567 setParanoid(true) in order for this to have any effect. 568<P> 569<DD><DL> 570</DL> 571</DD> 572<DD><DL> 573<DT><B>Parameters:</B><DD><CODE>pAddress</CODE> - The IP address being enabled. 574<DT><B>Throws:</B> 575<DD><CODE>java.lang.IllegalArgumentException</CODE> - Parsing the address failed.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#denyClient(java.lang.String)"><CODE>denyClient(java.lang.String)</CODE></A>, 576<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#setParanoid(boolean)"><CODE>setParanoid(boolean)</CODE></A></DL> 577</DD> 578</DL> 579<HR> 580 581<A NAME="denyClient(java.lang.String)"><!-- --></A><H3> 582denyClient</H3> 583<PRE> 584public void <B>denyClient</B>(java.lang.String pAddress)</PRE> 585<DL> 586<DD>Add an IP address to the list of denied clients. The parameter can 587 contain '*' as wildcard character, e.g. "192.168.*.*". You must call 588 setParanoid(true) in order for this to have any effect. 589<P> 590<DD><DL> 591</DL> 592</DD> 593<DD><DL> 594<DT><B>Parameters:</B><DD><CODE>pAddress</CODE> - The IP address being disabled. 595<DT><B>Throws:</B> 596<DD><CODE>java.lang.IllegalArgumentException</CODE> - Parsing the address failed.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#acceptClient(java.lang.String)"><CODE>acceptClient(java.lang.String)</CODE></A>, 597<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#setParanoid(boolean)"><CODE>setParanoid(boolean)</CODE></A></DL> 598</DD> 599</DL> 600<HR> 601 602<A NAME="allowConnection(java.net.Socket)"><!-- --></A><H3> 603allowConnection</H3> 604<PRE> 605protected boolean <B>allowConnection</B>(java.net.Socket s)</PRE> 606<DL> 607<DD>Checks incoming connections to see if they should be allowed. 608 If not in paranoid mode, always returns true. 609<P> 610<DD><DL> 611</DL> 612</DD> 613<DD><DL> 614<DT><B>Parameters:</B><DD><CODE>s</CODE> - The socket to inspect. 615<DT><B>Returns:</B><DD>Whether the connection should be allowed.</DL> 616</DD> 617</DL> 618<HR> 619 620<A NAME="newTask(org.apache.xmlrpc.webserver.WebServer, org.apache.xmlrpc.server.XmlRpcStreamServer, java.net.Socket)"><!-- --></A><H3> 621newTask</H3> 622<PRE> 623protected <A HREF="../../../../org/apache/xmlrpc/util/ThreadPool.Task.html" title="interface in org.apache.xmlrpc.util">ThreadPool.Task</A> <B>newTask</B>(<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html" title="class in org.apache.xmlrpc.webserver">WebServer</A> pServer, 624 <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A> pXmlRpcServer, 625 java.net.Socket pSocket) 626 throws java.io.IOException</PRE> 627<DL> 628<DD><DL> 629</DL> 630</DD> 631<DD><DL> 632 633<DT><B>Throws:</B> 634<DD><CODE>java.io.IOException</CODE></DL> 635</DD> 636</DL> 637<HR> 638 639<A NAME="run()"><!-- --></A><H3> 640run</H3> 641<PRE> 642public void <B>run</B>()</PRE> 643<DL> 644<DD>Listens for client requests until stopped. Call <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#start()"><CODE>start()</CODE></A> to invoke this method, and <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#shutdown()"><CODE>shutdown()</CODE></A> to 645 break out of it. 646<P> 647<DD><DL> 648<DT><B>Specified by:</B><DD><CODE>run</CODE> in interface <CODE>java.lang.Runnable</CODE></DL> 649</DD> 650<DD><DL> 651 652<DT><B>Throws:</B> 653<DD><CODE>java.lang.RuntimeException</CODE> - Generally caused by either an 654 <code>UnknownHostException</code> or <code>BindException</code> 655 with the vanilla web server.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#start()"><CODE>start()</CODE></A>, 656<A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#shutdown()"><CODE>shutdown()</CODE></A></DL> 657</DD> 658</DL> 659<HR> 660 661<A NAME="newThreadPool()"><!-- --></A><H3> 662newThreadPool</H3> 663<PRE> 664protected <A HREF="../../../../org/apache/xmlrpc/util/ThreadPool.html" title="class in org.apache.xmlrpc.util">ThreadPool</A> <B>newThreadPool</B>()</PRE> 665<DL> 666<DD><DL> 667</DL> 668</DD> 669<DD><DL> 670</DL> 671</DD> 672</DL> 673<HR> 674 675<A NAME="shutdown()"><!-- --></A><H3> 676shutdown</H3> 677<PRE> 678public void <B>shutdown</B>()</PRE> 679<DL> 680<DD>Stop listening on the server port. Shutting down our <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#listener"><CODE>listener</CODE></A> effectively breaks it out of its <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#run()"><CODE>run()</CODE></A> 681 loop. 682<P> 683<DD><DL> 684</DL> 685</DD> 686<DD><DL> 687<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#run()"><CODE>run()</CODE></A></DL> 688</DD> 689</DL> 690<HR> 691 692<A NAME="getPort()"><!-- --></A><H3> 693getPort</H3> 694<PRE> 695public int <B>getPort</B>()</PRE> 696<DL> 697<DD>Returns the port, on which the web server is running. 698 This method may be invoked after <A HREF="../../../../org/apache/xmlrpc/webserver/WebServer.html#start()"><CODE>start()</CODE></A> only. 699<P> 700<DD><DL> 701</DL> 702</DD> 703<DD><DL> 704 705<DT><B>Returns:</B><DD>Servers port number</DL> 706</DD> 707</DL> 708<HR> 709 710<A NAME="log(java.lang.Throwable)"><!-- --></A><H3> 711log</H3> 712<PRE> 713public void <B>log</B>(java.lang.Throwable pError)</PRE> 714<DL> 715<DD>Logs an error. 716<P> 717<DD><DL> 718</DL> 719</DD> 720<DD><DL> 721<DT><B>Parameters:</B><DD><CODE>pError</CODE> - The error being logged.</DL> 722</DD> 723</DL> 724<HR> 725 726<A NAME="log(java.lang.String)"><!-- --></A><H3> 727log</H3> 728<PRE> 729public void <B>log</B>(java.lang.String pMessage)</PRE> 730<DL> 731<DD>Logs a message. 732<P> 733<DD><DL> 734</DL> 735</DD> 736<DD><DL> 737<DT><B>Parameters:</B><DD><CODE>pMessage</CODE> - The being logged.</DL> 738</DD> 739</DL> 740<HR> 741 742<A NAME="getXmlRpcServer()"><!-- --></A><H3> 743getXmlRpcServer</H3> 744<PRE> 745public <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcStreamServer.html" title="class in org.apache.xmlrpc.server">XmlRpcStreamServer</A> <B>getXmlRpcServer</B>()</PRE> 746<DL> 747<DD>Returns the <A HREF="../../../../org/apache/xmlrpc/server/XmlRpcServer.html" title="class in org.apache.xmlrpc.server"><CODE>XmlRpcServer</CODE></A>. 748<P> 749<DD><DL> 750</DL> 751</DD> 752<DD><DL> 753 754<DT><B>Returns:</B><DD>The server object.</DL> 755</DD> 756</DL> 757<!-- ========= END OF CLASS DATA ========= --> 758<HR> 759 760 761<!-- ======= START OF BOTTOM NAVBAR ====== --> 762<A NAME="navbar_bottom"><!-- --></A> 763<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 764<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 765<TR> 766<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 767<A NAME="navbar_bottom_firstrow"><!-- --></A> 768<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 769 <TR ALIGN="center" VALIGN="top"> 770 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 771 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 772 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 773 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/WebServer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 774 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 775 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 776 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 777 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 778 </TR> 779</TABLE> 780</TD> 781<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 782</EM> 783</TD> 784</TR> 785 786<TR> 787<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 788 <A HREF="../../../../org/apache/xmlrpc/webserver/ServletWebServer.Exception.html" title="class in org.apache.xmlrpc.webserver"><B>PREV CLASS</B></A> 789 <A HREF="../../../../org/apache/xmlrpc/webserver/XmlRpcServlet.html" title="class in org.apache.xmlrpc.webserver"><B>NEXT CLASS</B></A></FONT></TD> 790<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 791 <A HREF="../../../../index.html?org/apache/xmlrpc/webserver/WebServer.html" target="_top"><B>FRAMES</B></A> 792 <A HREF="WebServer.html" target="_top"><B>NO FRAMES</B></A> 793 <SCRIPT type="text/javascript"> 794 <!-- 795 if(window==top) { 796 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 797 } 798 //--> 799</SCRIPT> 800<NOSCRIPT> 801 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 802</NOSCRIPT> 803 804 805</FONT></TD> 806</TR> 807<TR> 808<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 809 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 810<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 811DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 812</TR> 813</TABLE> 814<A NAME="skip-navbar_bottom"></A> 815<!-- ======== END OF BOTTOM NAVBAR ======= --> 816 817<HR> 818Copyright © 2001-2009 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. 819</BODY> 820</HTML>