kapil
(kapil Korat)
January 11, 2011, 6:12am
1
i am using servlet 3.0 to configure servelt using @WebServlet instead of web.xml
Now problem is : i am using @WebServlet (urlPatterns = “/vaadin/*”)
so when i try to start my app with url “http://localhost:8080/test/vaadin ”
it gives me below error :
Joonas
(Joonas Lehtinen)
January 11, 2011, 7:20am
2
Note that you must also map /VAADIN/* to the servlet in addition to your application (/vaadin/* in your example). For more info, see
http://vaadin.com/book/-/page/application.environment.html#section.web.web-xml
.
Bobby
(Bobby Bissett)
January 11, 2011, 5:16pm
3
Joonas is (obviously) correct, so you need to add the other url pattern to your annotation. I
think
the correct form is like this:
@WebServlet(urlPatterns = {"/vaadin/*", "/VAADIN/*"} )
That way the your application is being served from “http://localhost:8080/test/vaadin ” and the Vaadin content is being served from “http://localhost:8080/test/VAADIN, ” which is the hard-coded path relative to your context root.
Note that it would be simpler to just do this:
@WebServlet(urlPatterns = "/*")
…and then access your web app at “http://localhost:8080/test ” instead. Then when the client bits are trying to reach “http://localhost:8080/test/VAADIN ” the request will go through your servlet and will work. (In production, of course, it’s better to have this be static content and map it separately anyway.)
Cheers,
Bobby