[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] Override default servlet mapping in Jetty8 with Servlet 3.0
|
Hi,
I'm not able to override the default servlet using Servlet 3.0 and no web.xml file. Here is my pom.xml:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.2.v20120308</version>
<configuration>
<useTestScope>true</useTestScope>
<webApp>
<contextPath>/${project.artifactId}</contextPath>
</webApp>
</configuration>
</plugin>
Main.java:
public class Main implements WebApplicationInitializer {
@Override
public void onStartup(final ServletContext servletContext)
throws ServletException {
ServletRegistration.Dynamic dispatcher = servletContext.addServlet(
"dispatcher", new DispatcherServlet());
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/");
}
}
jetty:run starts without any problem or obvious errors in logs, but if I try to call my servlet I get a HTTP-404.
I appreciate any help on this.
Thanks.
--
edgar