Mapping to a JSON method with url-pattern
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-04-08T18:26:42Z
Indexed on
2010/04/08
18:53 UTC
Read the original article
Hit count: 337
I'm creating a Spring MVC application that will have a controller with 'RequestMapping'-annotated methods, including a JSON method. It currently has static content that resides in webapps/static, and the app itself resides in webapps/myapp. I assume that Catalina's default servlet is handling the static content, and my *.htm url-pattern in web.xml is returning the request for my JSP page, but I haven't been able to get the JSON method to be called. How do I write the url-pattern in the servlet mapping to do so? Using /* has not worked; it prevents the app from being accessed at all. Is there anything else to be aware of?
EDIT: The url-pattern '/' appears to allow the JSON request through, because a 406 error is returned. What then would need to be modified to allow JSON to be returned?
© Stack Overflow or respective owner