Difference between revisions of "Jetty/Starting/Porting to Jetty 7"

From Eclipsepedia

Jump to: navigation, search
m
 
(6 intermediate revisions by 2 users not shown)
Line 7: Line 7:
  
 
| body =   
 
| body =   
== Renaming of Classes and Packages ==
+
== Renaming of Packages and Classes ==
 
The Jetty 7 codebase was moved to the org.eclipse.jetty.* package space and remodularized so that dependencies for client, server and servlet container are more separable. We have written a converter tool to ease the conversion of your application source and configuration files to use the new package space: [[Jetty/Howto/Upgrade from Jetty 6 to Jetty 7|How to Upgrade from Jetty 6 to Jetty 7]].  
 
The Jetty 7 codebase was moved to the org.eclipse.jetty.* package space and remodularized so that dependencies for client, server and servlet container are more separable. We have written a converter tool to ease the conversion of your application source and configuration files to use the new package space: [[Jetty/Howto/Upgrade from Jetty 6 to Jetty 7|How to Upgrade from Jetty 6 to Jetty 7]].  
  
{{:{{PAGENAME}}/Refactoring}}
+
{{:{{PAGENAME}}/Packages and Classes}}
  
For a complete list of changes, see [[/Refactoring|{{SUBPAGENAME}}/Refactoring]]
+
For a complete list of changes, see [[/Packages and Classes|{{SUBPAGENAME}}/Packages and Classes]]
  
 
== Architectural Changes ==
 
== Architectural Changes ==
  
 
=== Configuration ===
 
=== Configuration ===
 +
Jetty-7 changed from using <tt>addLifeCycle</tt> to <tt>addBean</tt> for setting up objects like deployers and security. You will need to change the method call in your configuration files when adding a WebAppDeployer, ContextDeployer, LoginService, etc.
  
 
=== Handlers ===
 
=== Handlers ===
Line 22: Line 23:
 
=== Startup Options ===
 
=== Startup Options ===
  
The Jetty startup options have been streamlined, and differ in some respects from their re
+
The Jetty startup options have been streamlined, and differ in some respects from the startup options in earlier versions of Jetty.
  
 
The more commonly used system properties, such as <tt>jetty.port</tt> and <tt>jetty.home</tt> still work as before:
 
The more commonly used system properties, such as <tt>jetty.port</tt> and <tt>jetty.home</tt> still work as before:
Line 30: Line 31:
 
   java -jar start.jar OPTIONS=default,jsp... etc/jetty.xml
 
   java -jar start.jar OPTIONS=default,jsp... etc/jetty.xml
  
To turn on debugging on the fly, use this command:
+
To set the default value for verbose debug logging use the <tt>org.eclipse.jetty.util.log.DEBUG</tt> system property (note that this is very verbose):
   java -jar start.jar DEBUG=true etc/jetty.xml
+
   java -Dorg.eclipse.jetty.util.log.DEBUG=true -jar start.jar etc/jetty.xml
  
See [[Jetty/Howto/Run Jetty|How to Run Jetty]] for all the startup options that are available for Jetty 7.
+
To set debugging for specific named debuggers, which will override the default setting, use
 +
  java -Dsystem_property_name.DEBUG=true -jar start.jar etc/jetty.xml
 +
 
 +
To enable verbose debug logging for only the startup sequence, use this option with start.jar (note that this isn't a system property)
 +
  java -jar start.jar DEBUG=true etc/jetty.xml
 +
 
 +
See [[Jetty/Howto/Run Jetty|How to Run Jetty]] for more information on running Jetty from the commandline, and [[Jetty/Reference/Start Options| Start Options]] for the complete list of options that are available for Jetty 7.
  
 
=== Continuations ===
 
=== Continuations ===
Jetty 7 introduces portable continuations, extending the Continuations API from Jetty 6 to become a general-purpose API that will work asynchronously on any servlet-3.0 container (such as Jetty 7, or 8). With the aid of the ContinuationFilter, servlet 2.5 containers such as Jetty 6 can also use the jetty-7-style portable continuations. Continuations should be considered an application abstraction and portability layer on top of the implementation detail of asynchronous servlets.  
+
Jetty 7 introduces portable continuations, extending the Continuations API from Jetty 6 to become a general-purpose API that will work asynchronously on any servlet-3.0 container, or with Jetty 6, 7, and 8. Servlet 2.5 containers can also use the jetty-7-style portable continuations, as blocking. Jetty 6 and non-Jetty containers require the ContinuationFilter to be placed in front of your application. Continuations should be considered an application abstraction and portability layer on top of the implementation detail of asynchronous servlets.  
  
 
For a comprehensive look of continuations, see the [[Jetty/Feature/Continuations|Continuations Feature Guide]].
 
For a comprehensive look of continuations, see the [[Jetty/Feature/Continuations|Continuations Feature Guide]].
Line 42: Line 49:
 
== Jetty 7 Source Locations ==  
 
== Jetty 7 Source Locations ==  
  
The core Jetty 7 modules have all moved to [http://www.eclipse.org/jetty/ Eclipse], but some Jetty integrations (e.g., jetty-maven-plugin, terracotta, wadi) and distributions (e.g., deb, rpm, hightide) still remain at codehaus. If you are looking for these, see [https://svn.codehaus.org/jetty/jetty/trunk codehaus trunk].
+
The core Jetty 7 modules have all moved to [http://www.eclipse.org/jetty/ Eclipse], but some Jetty integrations (e.g., jetty-maven-plugin, terracotta, wadi) and distributions (e.g., deb, rpm, hightide) still remain at codehaus. If you are looking for these, see [https://svn.codehaus.org/jetty/jetty/branches/jetty-7/ Jetty 7 Integrations and Distributions].
  
 
Meanwhile, [http://svn.cometd.com/trunk/cometd-java/ Jetty's implementation of a Cometd server] is no longer bundled with the core modules, but is available at [http://cometd.org/ cometd.org].
 
Meanwhile, [http://svn.cometd.com/trunk/cometd-java/ Jetty's implementation of a Cometd server] is no longer bundled with the core modules, but is available at [http://cometd.org/ cometd.org].

Latest revision as of 15:01, 24 September 2010


Contents

[edit] Introduction

The intent of jetty-7 is to allow users to transition to the updated architecture and to access some servlet-3.0 features within a servlet-2.5 container, but without the need to update Java 1.6 or to wait for the final specification.

Jetty 7 is not a drop-in replacement for Jetty 6. While Jetty 7 has very much the same architecture as Jetty 6, there are packaging changes and other minor tweaks between the versions. Also, the Jetty 7 milestones are not as full featured as Jetty 6 in terms of third party integrations being available by default with the distribution bundle.

If your application adheres to standards, porting to Jetty 7 should simply be a matter of updating your configuration files. However, if your application uses non-standard or Jetty-specific APIs, then additional porting work will be required. This page gives a brief overview of the changes needed to port to Jetty 7.

Renaming of Packages and Classes

The Jetty 7 codebase was moved to the org.eclipse.jetty.* package space and remodularized so that dependencies for client, server and servlet container are more separable. We have written a converter tool to ease the conversion of your application source and configuration files to use the new package space: How to Upgrade from Jetty 6 to Jetty 7.


Quick guide to renamed packages and classes. (Covers most, but not all, cases)
Jetty 6 Matching in Jetty 7 Similar in Jetty 7
org.mortbay.(jetty).* org.eclipse.jetty.*
packages under modules/util - org.mortbay.util.*, org.mortbay.log, org.mortbay.component, org.mortbay.thread, org.mortbay.resource org.eclipse.jetty.util.*, org.eclipse.jetty.util.log, org.eclipse.jetty.util.component, etc
org.mortbay.jetty.security.UserRealm

org.mortbay.jetty.security.HashUserRealm

org.eclipse.jetty.security.LoginService

org.eclipse.jetty.security.HashLoginService

org.mortbay.jetty.servlet.Context org.eclipse.jetty.servlet.ServletContextHandler
org.mortbay.util.ajax.Continuation

org.mortbay.util.ajax.ContinuationSupport

org.eclipse.jetty.continuation.Continuation

org.eclipse.jetty.continuation.ContinuationSupport

Other refactoring changes to watch out for when moving to Jetty 7
Type of change Jetty 6 Jetty 7
Maven plugin artifact id maven-jetty-plugin jetty-maven-plugin
Split up server JAR jetty.jar jetty-server.jar, jetty-deploy.jar, jetty-io.jar, jetty-security.jar, jetty-servlet.jar, jetty-servlets.jar, jetty-webapp.jar, jetty-xml.jar
Removed unused module jetty-html.jar ~
Renamed JAR jetty-rewrite-handler.jar jetty-rewrite.jar
Renamed JAR jetty-management.jar jetty-jmx.jar
New Continuation JAR from jetty-util.jar jetty-continuation.jar
Removed class org.mortbay.jetty.plus.jaas.callback.DefaultCallbackHandler Inner class in JAASLoginService


For a complete list of changes, see Porting to Jetty 7/Packages and Classes

Architectural Changes

Configuration

Jetty-7 changed from using addLifeCycle to addBean for setting up objects like deployers and security. You will need to change the method call in your configuration files when adding a WebAppDeployer, ContextDeployer, LoginService, etc.

Handlers

Startup Options

The Jetty startup options have been streamlined, and differ in some respects from the startup options in earlier versions of Jetty.

The more commonly used system properties, such as jetty.port and jetty.home still work as before:

java -Djetty.port=8081 -jar start.jar etc/jetty.xml

The OPTIONS switch, which lets you choose specific modes for running Jetty has been subtly changed and is no longer a system property. Instead of java -DOPTIONS=default,jsp,... -jar start.jar, now do:

 java -jar start.jar OPTIONS=default,jsp... etc/jetty.xml

To set the default value for verbose debug logging use the org.eclipse.jetty.util.log.DEBUG system property (note that this is very verbose):

  java -Dorg.eclipse.jetty.util.log.DEBUG=true -jar start.jar etc/jetty.xml

To set debugging for specific named debuggers, which will override the default setting, use

  java -Dsystem_property_name.DEBUG=true -jar start.jar etc/jetty.xml

To enable verbose debug logging for only the startup sequence, use this option with start.jar (note that this isn't a system property)

 java -jar start.jar DEBUG=true etc/jetty.xml 

See How to Run Jetty for more information on running Jetty from the commandline, and Start Options for the complete list of options that are available for Jetty 7.

Continuations

Jetty 7 introduces portable continuations, extending the Continuations API from Jetty 6 to become a general-purpose API that will work asynchronously on any servlet-3.0 container, or with Jetty 6, 7, and 8. Servlet 2.5 containers can also use the jetty-7-style portable continuations, as blocking. Jetty 6 and non-Jetty containers require the ContinuationFilter to be placed in front of your application. Continuations should be considered an application abstraction and portability layer on top of the implementation detail of asynchronous servlets.

For a comprehensive look of continuations, see the Continuations Feature Guide.

Jetty 7 Source Locations

The core Jetty 7 modules have all moved to Eclipse, but some Jetty integrations (e.g., jetty-maven-plugin, terracotta, wadi) and distributions (e.g., deb, rpm, hightide) still remain at codehaus. If you are looking for these, see Jetty 7 Integrations and Distributions.

Meanwhile, Jetty's implementation of a Cometd server is no longer bundled with the core modules, but is available at cometd.org.

Licenses

Jetty 6 is licensed under the Apache 2.0 License; Jetty 7 is dual licensed under the Apache License 2.0 and Eclipse Public License 1.0 and can be distributed under the terms of either license.

Jetty Version Comparison Table

Note: cometd server is not shipped within the Jetty distribution, it can be obtained from the cometd.org website.

Additional Resources