What Is Jetty

What Is Jetty

The Executable JAR

If you embrace Jetty's XML to configure your own apps, you could end up with a lot of boilerplate code to load the config file and launch your stand-alone apps. You can use Jetty's executable start.jar to load the file for you, saving you even more code.



For example, you can load the Jetty-based service from Step2Driver using the following command line:

CLASSPATH= ...various Jetty JARs...

java \

   -Djetty.class.path=${CLASSPATH} \

   -jar <jetty install path>/start.jar \

   standalone.xml

Note that this call only loads the XML file to establish the container and listener. It, therefore, doesn't call the rest of the sample code that invokes the test URLs.

Conclusion

An embedded Jetty servlet container lets you web enable a Java app without having to package it as a formal web app. This opens up new possibilities for several disciplines, making Jetty a versatile addition to your toolbox.

There is certainly more to Jetty than I have written here. I encourage you to review the Jetty website for docs and sample code.

Resources

  • Sample code for this article
  • .
  • The Jetty website has links to documentation, samples, and downloads. It includes the "Jetty Powered" page, which has links to some apps that have somehow incorporated Jetty. Also of note is the JettyPlus subproject, which offers support for JNDI, DataSources, and other features beyond the servlet spec.
  • Sun's Java EE website, which has links to the servlet spec
  • .
  • Java Reflection in Action discusses Java's Reflection and Introspection APIs in detail.
  • For the sake of comparison, OnJava has also published an article on Tomcat's embedded side.
  • I mentioned Swing, XUI, and SWT as Java-based options for GUI front ends.
  • The Message-Driven Bank is from another OnJava article, "J2EE Without the Application Server."

Ethan McCallum keeps himself busy with with Unix/Linux, C++, and Java.


Return to ONJava.com.

Prev  [1] [2] [3] [4] 

Close    To Top
  • Prev Article-Java:
  • Next Article-Java:
  • Now: Tutorial for Web and Software Design > Java > Java Servlets > Java Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction