Jetty has moved!
Jetty is a project at the Eclipse Foundation.
Homepage:http://www.eclipse.org/jetty
Downloads: http://download.eclipse.org/jetty/
Documentation:http://www.eclipse.org/jetty/documentation/current/
About:http://www.eclipse.org/jetty/about.php
Jetty Powered:http://www.eclipse.org/jetty/powered/
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Jetty.xml

The jetty.xml is the configuration file when you run the server java -jar server.jar etc/jetty.xml. However, you may create one with your own configuration and settings and explicitly specify it when you run the server ...etc/my_own_config.xml.

Once the server is running, the elements declared and placed in between its parameters are called and/or created. Here's a more descriptive overview of the jetty.xml:

All tags and elements declared inside jetty.xml will be pointing to this resource, configure.dtd. This only means tags and/or elements will be readable based from this data type file.

The first instance called when you run the server is the Server class. The org.mortbay.jetty.Server is the main class for the Jetty HTTP Servlet server. It aggregates connectors (HTTP request receivers) and request Handlers. The server is itself a handler and a ThreadPool. Connectors use the ThreadPool methods to run jobs that will eventually call the handle method.

The org.mortbay.thread.BoundedThreadPool class implements the pooling of threads. It avoids the expense of thread creation by pooling threads for reuse after their run methods exit. If the maximum pool size is reached, jobs wait for a free thread. By default there is no maximum pool size. Idle threads timeout and terminate until the minimum number of threads are running.

Implementations of the org.mortbay.jetty.Connector interface provide connectors for the HTTP protocol.

Classes defined under these are:

    org.mortbay.jetty.bio.SocketConnector - implements a traditional blocking IO and threading model.
    org.mortbay.jetty.nio.SelectChannelConnector - This connector uses efficient NIO buffers with a non blocking threading model. This is where we normally change the port numbers used for running the server; default is 8080.

Handlers process inbound requests. There is a handler which services web applications called org.mortbay.jetty.webapp.WebAppContext. If you don't wish to use a full-blown application but just want to serve static content and maybe some servlets, then you can use a ContextHandler and only configure those services you require. The list of handlers that are defined for a Server is set by the following call:

If you want to use authentication and authorisation, then you need to define a Security realm. There is no limit to the number or types of realms that you can define for a Server. The following example sets up a security realm that is populated by the etc/realm.properties file:

You can check the whole configuration file by looking at the jetty.xml of Jetty6_installation/etc directory.

  • No labels
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery