• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Gerb Stralko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Gerb Stralko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!