Java web application in a Servlet container vs. standalone

There are 2 separate questions in here:

  1. Should I be using an embedded
    server, or deploy into a container?

    I don’t think you should be seeing a
    big difference one way or the other.
    There’s slightly more code to
    startup a Jetty server
    programmatically, and configuration
    is easier to do programmatically.
    Even though IDE support for web app
    configuration and deployment is
    getting better, it’s still worse
    than for standalone applications
    (this is kinda by definitions, since
    there’s a superset of things to
    support).

    On the other hand, app servers give
    you some nice benefits like built-in
    management, built-in ability to run
    as a service, etc.

    You could even use a hybrid
    approach: use an embedded server to
    develop locally, then deploy into a
    container in production. But that’s
    a bit weird: if you go through the
    trouble of making a proper WAR file,
    IDEs should really be able to handle
    deployment into a container
    adequately.

    BTW, it’s weird that you have issues
    with hot-redeploy; Tomcat shouldn’t
    be having issues with it unless
    you’re running into some strange
    corner case…

  2. Should I be using Servlet API?

    This is orthogonal from #1. You
    could very well embed Jetty and
    implement Servlets. You could also
    use Restlet API inside Tomcat
    through a ServerServlet
    http://www.restlet.org/documentation/1.0/faq#02.

    I personally find the Servlet API to
    be pretty straight-forward.You get
    nice things like concurrency and
    state management. I don’t quite know
    what that means that RESTful design
    is not supported, but if Restlets
    address your requirements better,
    then use that…

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)