3

I am looking to use Jersey without the need of installing an application server such as Tomcat or Glassfish. Ideally I would like to create a lightweight program that listens on a port and allows connections. I believe you can do this with Grizzly + Jersey but I am not sure how easy this is, because from my understanding Grizzly is used to write new http servers from scratch?

Restlet looked good in this regard because it included an internal http server but the documentation provided is extremely meager.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
fthinker
  • 646
  • 2
  • 9
  • 17

2 Answers2

3

You can use a light-weight servlet container like jetty. you can bundle and ship this with your application. Also building and shipping jetty with your application is very easy.

Rajesh Pantula
  • 10,061
  • 9
  • 43
  • 52
  • Good stuff. The link here has a direct example: http://stackoverflow.com/questions/7421574/embedded-jetty-with-jersey-or-resteasy – fthinker Jan 09 '12 at 02:20
  • jersey itself has direct samples of doing similar things (with grizzly). See helloworld: http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/helloworld/1.11/helloworld-1.11-project.zip – Pavel Bucek Jan 09 '12 at 16:57
  • You might find this presentation helpful as well. Using maven in this context is a big help since it DLs and launches Grizzly for you. http://matthewturland.com/slides/jersey/ – Spencer Kormos Jan 09 '12 at 22:32
0

I've deployed an app recently that uses embedded Jetty in Spring to launch Jersey, so this is 100% possible. Jersey, in fact, has a SpringServlet for easy delegating to a Spring context based REST implementation. If you have additional questions down this route, let me know. It wasn't the most straight forward, but I can talk you through some of it with the appropriate links.

Spencer Kormos
  • 8,381
  • 3
  • 28
  • 45
  • 1
    Thanks, but that sounds like a bit of overkill for a novice like myself. I just read about a small blurb on servlets yesterday! – fthinker Jan 09 '12 at 02:21
  • Spencer Kormos, I'm looking to do exactly this. What is the best way to contact you for specific questions. I have my Spring Jersey server running great with Java Config but am having a hard time moving from tomcat:run and jetty:run to an embedded version. – robert_difalco Mar 12 '13 at 21:44