Jump to: navigation, search

Difference between revisions of "Jetty/HowTo/Using Jetty with Eclipse"

m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Jetty Howto  
 
{{Jetty Howto  
| introduction = You can use Jetty in a variety of ways when developing in Eclipse.
+
| introduction =  
}}
+
 
 +
{{Jetty TODO}}
 +
 
 +
You can use Jetty in a variety of ways when developing in Eclipse.
  
 
== WTP Style Use ==
 
== WTP Style Use ==
Line 10: Line 13:
  
 
The embedded approach is an often used mechanism for developing in Eclipse.  This strategy involves writing a small main method that starts Jetty and deploys your servlets programmatically. You can control the starting and stopping of your webapp through normal runtime measures.   
 
The embedded approach is an often used mechanism for developing in Eclipse.  This strategy involves writing a small main method that starts Jetty and deploys your servlets programmatically. You can control the starting and stopping of your webapp through normal runtime measures.   
 +
 +
== run-jetty-run ==
 +
 +
[http://code.google.com/p/run-jetty-run/ Run-jetty-run] is a plugin that allows you to easily make run-configurations where Jetty starts a webapp. You point the run configuration to your webapp-directory, configure the context path and port, and you're pretty much done. Works for jetty 6, 7 and 8 - a version of each is included.
  
 
== Testing Use ==
 
== Testing Use ==

Latest revision as of 14:13, 23 April 2013



Introduction

Warning2.png
Some or all of this content remains to be ported to Jetty 9 Documentation.
If you are interested in migrating this content see our contribution guide or contact us.


You can use Jetty in a variety of ways when developing in Eclipse.

WTP Style Use

A problematic mechanism is the WTP style approach to webapp development. Under certain circumstances this works for certain people and if it does, great, enjoy. Here is a link to a Jetty WTP Plugin that Angelo Zerr contributed.

Embedded Use

The embedded approach is an often used mechanism for developing in Eclipse. This strategy involves writing a small main method that starts Jetty and deploys your servlets programmatically. You can control the starting and stopping of your webapp through normal runtime measures.

run-jetty-run

Run-jetty-run is a plugin that allows you to easily make run-configurations where Jetty starts a webapp. You point the run configuration to your webapp-directory, configure the context path and port, and you're pretty much done. Works for jetty 6, 7 and 8 - a version of each is included.

Testing Use

You can use Jetty with JUnit or the like, where in @Before and @After there is a starting and stopping of a Jetty server. This is a popular approach to developing in Eclipse, and one that we employ heavily. If you're interested in this approach, look through the unit tests for things like jetty-server and jetty-client for a wealth of examples. Also see the embedded-examples project for a number of simple examples in common usage scenarios.