Jetty Spring Web Service

Jetty RESTFul Web Service

If you are working on spring standalone project and wanted to expose this applicaiton as web serivce you could use Jetty to expose it. Using Jetty it’s very easy just you will have to add few line of code into your existing project. Please follow steps below:

  • Create maven project name: JettyApplication as below is shonw complete project strucure after all configuration:

Jetty Spring Web Service

  • pom.xml:

  • spring-context.xml:

  • Jetty.properties:

  • JettyService.java:

  • MessageHandler.java:

  • HttpClientPost.java:

  • MainApp.java:

  • Now to start this application start MainApp.java class as java application you will below output on console:

Jetty Spring Web Service

  • To test this appication I have written class: HttpClientPost.java strat this class as java application which will send one post parameter “Java Honk” in request to Jetty and once handler receive request it will print out put on console as below:

Jetty Spring Web Service

  • That’s it. For more information please visit here

download Download Project: JettyApplication

Leave a Reply

Your email address will not be published. Required fields are marked *