Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/JettyHttpServer"

(Configuration)
Line 62: Line 62:
 
For more details on all the configuration properties used here refer to the [[Jetty|Jetty documentation]] next door.
 
For more details on all the configuration properties used here refer to the [[Jetty|Jetty documentation]] next door.
  
The default configuration file used in the SMILA application replaces the "handler" section like this to deploy a simple Web application for search on [http://localhost:8080/SMILA/search]:
+
The default configuration file used in the SMILA application replaces the "handler" section like this to deploy a simple Web application for search at [http://localhost:8080/SMILA/search http://localhost:8080/SMILA/search]:
  
 
<source lang="xml">
 
<source lang="xml">

Revision as of 08:37, 1 March 2011

Configuration and Usage of the Jetty HTTP server embedded in SMILA

Configuration

To configure the embedded Jetty server, place a file named jetty.xml in the configuration directory org.eclipse.smila.http.server. If the configuration area does not contain such a file, a default file provided by the Http server bundle itself is used. It's probably the most simple file possible:

<Configure id="Server" class="org.eclipse.jetty.server.Server">
 
    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <Set name="ThreadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">10</Set>
        <Set name="maxThreads">200</Set>
        <Set name="detailedDump">false</Set>
      </New>
    </Set>
 
    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->
 
    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host"><Property name="jetty.host" /></Set>
            <Set name="port"><Property name="jetty.port" default="8080"/></Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
	    <Set name="lowResourcesConnections">20000</Set>
	    <Set name="lowResourcesMaxIdleTime">5000</Set>
          </New>
      </Arg>
    </Call>
 
    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <Set name="handler">
      <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
    </Set>
 
    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
    <Set name="sendServerVersion">true</Set>
    <Set name="sendDateHeader">true</Set>
    <Set name="gracefulShutdown">1000</Set>
    <Set name="dumpAfterStart">false</Set>
    <Set name="dumpBeforeStop">false</Set>
</Configure>

It basically configures the server to listen at port 8080 and adds a default handler that responses with HTTP status 404 (NOT FOUND) if no other handler was found to handle the request, and it lists the available handlers.

For more details on all the configuration properties used here refer to the Jetty documentation next door.

The default configuration file used in the SMILA application replaces the "handler" section like this to deploy a simple Web application for search at http://localhost:8080/SMILA/search:

    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <Set name="handler">
      <New class="org.eclipse.jetty.server.handler.HandlerList">
        <Set name="handlers">
	      <Array type="org.eclipse.jetty.server.Handler">
	        <Item>
	          <New class="org.eclipse.jetty.webapp.WebAppContext">
	            <Set name="contextPath">/SMILA</Set>
	            <Set name="resourceBase">configuration/org.eclipse.smila.search.servlet/webapp</Set>
	            <Set name="descriptor">configuration/org.eclipse.smila.search.servlet/webapp/WEB-INF/web.xml</Set>
	            <Set name="defaultsDescriptor">configuration/org.eclipse.smila.http.server/webdefault.xml</Set>
	            <Set name="parentLoaderPriority">true</Set>
              </New>
	        </Item>
            <Item>
              <New class="org.eclipse.jetty.server.handler.DefaultHandler"/>
	        </Item>
	      </Array>
        </Set>
      </New>
    </Set>

Usage

Back to the top