Results 1 to 3 of 3

Thread: Embedded Jetty example with Spring MVC

  1. #1

    Default Embedded Jetty example with Spring MVC

    Is there an example of spring MVC with an embedded jetty instance?

    I would really appreciate if someone has a working example of how to create a main class with an embedded jetty instance using Maven.

  2. #2
    Join Date
    Nov 2010
    Posts
    7

    Default

    I created a template project that uses embedded jetty with SpringMVC.. This is one I came up with after trial and error embedding Jetty in a few different ways. I've always run into problems with JSP/JSTL. Anyways, this template started with the SpringMVC template project created by STS. It has a few additions that I always do, like logback instead of log4j, but that should matter much..

    https://github.com/jasonish/springmvc-template-jetty

    In its current form its basically a wrapper around a classic style web application. My main use for SpringMVC is bolting on a web interface to an existing application, so it will migrate that way in the next little while. Should still be useful.

    If all you really want to do is make an executable jar out of an existing war you might want to checkout the tomcat7 plugin:

    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <executions>
    <execution>
    <id>tomcat-run</id>
    <goals>
    <goal>exec-war-only</goal>
    </goals>
    <phase>package</phase>
    <configuration>
    <path>/</path>
    </configuration>
    </execution>
    </executions>
    </plugin>

    This will basically embed your war into jar that contains tomcat..

    Hope that helps.

  3. #3
    Join Date
    Sep 2011
    Posts
    25

    Default

    I make a example to redirect any request to port 8080 and redirect to a new location.
    First "mvn package" and goto target folder to run "java -jar redirector.jar".
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •