📄 simplehttpserver.html
字号:
boolean expandWebapps) throws java.lang.Exception</PRE><DL><DL><DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DL><HR><A NAME="SimpleHttpServer(boolean, java.lang.String, java.lang.String, int, boolean)"><!-- --></A><H3>SimpleHttpServer</H3><PRE>public <B>SimpleHttpServer</B>(boolean localhostOnly, java.lang.String name, java.lang.String context, int port, boolean expandWebapps) throws java.lang.Exception</PRE><DL><DD><B>Deprecated.</B> <I>Use SimpleHttpServer(name,context,hosts,port,expandWebapps)</I><P><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - Name of webapp to load.<DD><CODE>context</CODE> - Where to mount the webapp. If passed context is null or empty string, we'll use '/' + <code>name</code> else if passed '/' then we'll add the webapp as the root webapp.<DD><CODE>port</CODE> - Port to run on.<DD><CODE>expandWebapps</CODE> - True if we're to expand the webapp passed.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DL><HR><A NAME="SimpleHttpServer(java.lang.String, java.lang.String, java.util.Collection, int, boolean)"><!-- --></A><H3>SimpleHttpServer</H3><PRE>public <B>SimpleHttpServer</B>(java.lang.String name, java.lang.String context, java.util.Collection<java.lang.String> hosts, int port, boolean expandWebapps) throws java.lang.Exception</PRE><DL><DD>Constructor.<P><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - Name of webapp to load<DD><CODE>context</CODE> - Where to mount the webap. If null or empty string, we'll use '/' + <code>name</code>; if passed '/' then we'll add the webapp as the root webapp<DD><CODE>hosts</CODE> - list of hosts to bind to<DD><CODE>port</CODE> - port to listen on<DD><CODE>expandWebapps</CODE> - true to expand webapp passed<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DL><HR><A NAME="SimpleHttpServer(java.util.List, int, boolean)"><!-- --></A><H3>SimpleHttpServer</H3><PRE>public <B>SimpleHttpServer</B>(java.util.List webapps, int port, boolean expandWebapps) throws java.lang.Exception</PRE><DL><DL><DT><B>Parameters:</B><DD><CODE>webapps</CODE> - List of webapps to load.<DD><CODE>port</CODE> - Port to run on.<DD><CODE>expandWebapps</CODE> - True if we're to expand the webapps found.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="addWebapp(java.lang.String, java.lang.String, boolean)"><!-- --></A><H3>addWebapp</H3><PRE>protected void <B>addWebapp</B>(java.lang.String name, java.lang.String context, boolean expand) throws java.io.IOException</PRE><DL><DD>Add a webapp.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - Name of webapp to add.<DD><CODE>context</CODE> - Context to add the webapp on.<DD><CODE>expand</CODE> - True if we should expand the webapps.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="initialize(int, boolean)"><!-- --></A><H3>initialize</H3><PRE>protected void <B>initialize</B>(int port, boolean localhostOnly)</PRE><DL><DD><B>Deprecated.</B> <I>Use initialize(Collection<String>, port) instead</I><P><DD>Initialize the server. Called from constructors.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>port</CODE> - Port to start the server on.</DL></DD></DL><HR><A NAME="initialize(java.util.Collection, int)"><!-- --></A><H3>initialize</H3><PRE>protected void <B>initialize</B>(java.util.Collection<java.lang.String> hosts, int port)</PRE><DL><DD>Initialize the server. Called from constructors.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>hosts</CODE> - the hostnames to bind to; if empty or null, will bind to all interfaces<DD><CODE>port</CODE> - the port to listen on</DL></DD></DL><HR><A NAME="getServerLogging()"><!-- --></A><H3>getServerLogging</H3><PRE>protected org.mortbay.http.RequestLog <B>getServerLogging</B>() throws java.lang.Exception</PRE><DL><DD>Setup log files.<P><DD><DL><DT><B>Returns:</B><DD>RequestLog instance to add to a server.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DD></DL><HR><A NAME="startServer()"><!-- --></A><H3>startServer</H3><PRE>public void <B>startServer</B>() throws java.lang.Exception</PRE><DL><DD>Start the server.<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if problem starting server or if server already started.</DL></DD></DL><HR><A NAME="stopServer()"><!-- --></A><H3>stopServer</H3><PRE>public void <B>stopServer</B>() throws java.lang.InterruptedException</PRE><DL><DD>Stop the running server.<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.InterruptedException</CODE></DL></DD></DL><HR><A NAME="finalize()"><!-- --></A><H3>finalize</H3><PRE>protected void <B>finalize</B>() throws java.lang.Throwable</PRE><DL><DD><DL><DT><B>Overrides:</B><DD><CODE>finalize</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.Throwable</CODE></DL></DD></DL><HR><A NAME="getPort()"><!-- --></A><H3>getPort</H3><PRE>public int <B>getPort</B>()</PRE><DL><DD><DL><DT><B>Returns:</B><DD>Port server is running on.</DL></DD></DL><HR><A NAME="getServer()"><!-- --></A><H3>getServer</H3><PRE>public org.mortbay.http.HttpServer <B>getServer</B>()</PRE><DL><DD><DL><DT><B>Returns:</B><DD>Server reference.</DL></DD></DL><HR><A NAME="setAuthentication(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>setAuthentication</H3><PRE>public org.mortbay.http.HashUserRealm <B>setAuthentication</B>(java.lang.String realmName, java.lang.String contextName, java.lang.String authProperties) throws java.io.IOException</PRE><DL><DD>Setup a realm on the server named for the webapp and add to the passed webapp's context. Used by the selftest to check digest authentication is working. For this all to work, the <code>web.xml</code> needs to set with a security constraint that points to a realm named for the passed webapp, <code>webappName</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>realmName</CODE> - Name of realm to configure.<DD><CODE>contextName</CODE> - Name of context we're using with this realm. If null, we'll use the realm name as context name.<DD><CODE>authProperties</CODE> - Path to file that holds the auth login and password.<DT><B>Returns:</B><DD>Hash of user realms.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="setAuthentication(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>setAuthentication</H3><PRE>public void <B>setAuthentication</B>(java.lang.String realmName, java.lang.String contextName, java.lang.String username, java.lang.String password, java.lang.String role) throws java.io.IOException</PRE><DL><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="resetAuthentication(java.lang.String, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>resetAuthentication</H3><PRE>public void <B>resetAuthentication</B>(java.lang.String realmAndRoleName, java.lang.String oldUsername, java.lang.String newUsername, java.lang.String newPassword)</PRE><DL><DD>Reset the administrator login info.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>realmAndRoleName</CODE> - for our use, always 'admin'<DD><CODE>oldUsername</CODE> - previous username to replace/disable<DD><CODE>newUsername</CODE> - new username (may be same as old)<DD><CODE>newPassword</CODE> - new password</DL></DD></DL><HR><A NAME="getWebappPath(java.lang.String)"><!-- --></A><H3>getWebappPath</H3><PRE>public java.io.File <B>getWebappPath</B>(java.lang.String name)</PRE><DL><DD>Get path to named webapp.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - Name of webpp. Possible names are 'admin' or 'selftest'.<DT><B>Returns:</B><DD>Path to deployed webapp.</DL></DD></DL><HR><A NAME="getRootWebappName()"><!-- --></A><H3>getRootWebappName</H3><PRE>public static java.lang.String <B>getRootWebappName</B>()</PRE><DL><DD><DL><DT><B>Returns:</B><DD>Returns the root webapp name.</DL></DD></DL><HR><A NAME="getHosts()"><!-- --></A><H3>getHosts</H3><PRE>public java.util.Collection<java.lang.String> <B>getHosts</B>()</PRE><DL><DD>Returns the hosts that the server is listening on.<P><DD><DL><DT><B>Returns:</B><DD>the hosts that the server is listening on.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SimpleHttpServer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../org/archive/crawler/Heritrix.html" title="class in org.archive.crawler"><B>PREV CLASS</B></A> <A HREF="../../../org/archive/crawler/WebappLifecycle.html" title="class in org.archive.crawler"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/archive/crawler/SimpleHttpServer.html" target="_top"><B>FRAMES</B></A> <A HREF="SimpleHttpServer.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright © 2003-2006 Internet Archive. All Rights Reserved.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -