aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-09-18 11:54:59 (EDT)
committerThomas Becker2013-09-19 05:33:21 (EDT)
commitf19f6ce5cdd5f46486d2fefdd6efb43d6f173e5a (patch)
treec7b130c999b5e9e295ae93e1378fdf295482eeee
parentcea01925f78b2c0ab1883ff6c83d84570d2525dc (diff)
downloadorg.eclipse.jetty.project-f19f6ce5cdd5f46486d2fefdd6efb43d6f173e5a.zip
org.eclipse.jetty.project-f19f6ce5cdd5f46486d2fefdd6efb43d6f173e5a.tar.gz
org.eclipse.jetty.project-f19f6ce5cdd5f46486d2fefdd6efb43d6f173e5a.tar.bz2
416453 Add comments to embedded MinimalServlets example
-rw-r--r--examples/embedded/src/main/java/org/eclipse/jetty/embedded/MinimalServlets.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/MinimalServlets.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/MinimalServlets.java
index b508491..28f68af 100644
--- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/MinimalServlets.java
+++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/MinimalServlets.java
@@ -32,10 +32,20 @@ public class MinimalServlets
{
public static void main(String[] args) throws Exception
{
+ // Create a basic jetty server object that will listen on port 8080. Note that if you set this to port 0
+ // then a randomly available port will be assigned that you can either look in the logs for the port,
+ // or programmatically obtain it for use in test cases.
Server server = new Server(8080);
+
+ // The ServletHandler is a dead simple way to create a context handler that is backed by an instance of a
+ // Servlet. This handler then needs to be registered with the Server object.
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
+ // Passing in the class for the servlet allows jetty to instantite an instance of that servlet and mount it
+ // on a given context path.
+
+ // !! This is a raw Servlet, not a servlet that has been configured through a web.xml or anything like that !!
handler.addServletWithMapping(HelloServlet.class,"/*");
server.start();