Serving a GWT Application with an Embedded Jetty Server


For a new project I am interested in starting, I want to serve a GWT application with an embedded Jetty server. I wasn’t sure how to go about doing so, but it turns out it’s easier than I could ever have expected! Check it out below (or, for you folks viewing this in an RSS feed, at http://gist.github.com/346622).

You do, of course, need the Jetty jars (I used the ones from the ‘lib’ folder in the Jetty distribution) in your classpath.

, , , , , , ,

  1. #1 by Matthew Morgan - March 29th, 2010 at 05:40

    I hate it when people get into jetty wars. Can’t we all just share? I guess people get frustrated when someone else puts the lid too tight on the jetty jar.

    I think I should be eligible for worst pun in the universe for one of those! ;)

    All joking aside, this is a really cool feature. I was just thinking the other day about an idea that would require a custom web server, and jetty seems like it would work great! I’ll probably never implement that particular idea, but I really like it when a blog post or article like this comes along and adds another tool to my tool belt so-to-speak that I hadn’t previously known about.

  2. #2 by Seven Corners - June 15th, 2010 at 06:35

    Thanks for posting this! I have a few questions:

    1) How does this get invoked? Do we have to call this name of the class with a Java command, e.g., with a script? Or is there some way it can start automatically?

    2) If you’re deploying to/with Jetty, does this mess up your ability to debug within Eclipse in hosted mode?

    3) What if we already have a proxy server for cross-site REST calls? Is this going to conflict with that?

    4) What about Continuations? Do we need to write a servlet for that? Could I tweak my existing proxy server for that?

    Thanks in advance for your thoughts.

    Seven

(will not be published)
  1. No trackbacks yet.