Forums Register Login

[JERSEY] Using JSP in a Jersey JAX-RS RESTful application

+Pie Number of slices to send: Send
I'm trying to get a JAX-RS Rest Application to be more MVC. However I'm having trouble getting it to work. I'm using Java 6 and glassfish 3.1.2.2

I posted my sample war repo on github https://github.com/jstralko/JAXRSMVC

Basically my web.xml file is:


My Java Rest Resource File is:


My JSP is under WEB-INF/jsp as per my JSPTemplatesBasePath.

Everything deploys successfully but when I try and access /hello via localhost:8080/hello i get a 404. Is there something stupid I'm missing?

Thanks.
+Pie Number of slices to send: Send
The URL would not be localhost:8080/hello, it would normally be localhost:8080/yourWebAppNameGoesHere/hello. Or are you deploying this specifically as the ROOT web app?

As an aside, mapping JAX-RS to "/*" means it will intercept all requests to the web app - so you can't have other resources, static or dynamic - is that what you want?
+Pie Number of slices to send: Send
I misspoke I was trying to go to http://localhost:8080/myWebapp/hello and getting a 404.


I know I'm intercepting all the request but I'm using this init-param to serve static resources and jsps. Unless this is the wrong way to accomplish this.



Basically i'm trying expose a REST endpoint via JAX-RS and then have it return a web page. I'm was using this site as reference http://blog.usul.org/using-jsp-in-a-jersey-jax-rs-restful-application/

Thanks for the help
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 5319 times.
Similar Threads
Cant Run Simple Jersey REST Webservice Example
JAX-RS resource lifecycle
Problem with JERSEY and JAX-RS
Restfull webservice with weblogic portal
Error deploying on Tomcat ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:03:54.