• Post Reply Bookmark Topic Watch Topic
  • New Topic

error in forwarding jsp using jax-rs  RSS feed

 
Girish Velivela
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to forward a jsp file using jax-rs web sevices? Is it a good pattern...?

I used @context to get HttpRequest to dispatch the jsp. But netbeans giving a warning not context and when I am running application I am getting " javax.servlet.ServletException: javax.ws.rs.ProcessingException: java.io.IOException: Stream closed ".
 
Girish Velivela
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After searching some few blogs I found to forward jsp files.

first add jersey-mvc-2.0.jar to your library.

then next add to your web.xml

<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.server.mvc.jsp.JspMvcFeature</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.mvc.templateBasePath.jsp</param-name>
<param-value>/jsp/</param-value>
</init-param>

or you can use annotations.

then create Viewable object and return it.

@GET
@Path("/getusers")
@Produces("text/html")
public Viewable getUsers(@Context HttpServletRequest request){


return new Viewable("/users");
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!