users@jersey.java.net

Re: [Jersey] Using JSP for HTML representation

From: Kevin Duffey <andjarnic_at_yahoo.com>
Date: Fri, 22 Aug 2008 22:12:50 -0700 (PDT)

Hey,

I am guessing here.. but looking at the web.xml for that example:

  <init-param>
            <param-name>com.sun.jersey.config.feature.Redirect</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.config.feature.ImplicitViewables</param-name>
            <param-value>true</param-value>
        </init-param>


Not sure if that helps it, but my guess is the response is somehow "redirected" back to the jsp page... based on the Redirect param and ImplicitViewables param above. I really don't see tho looking at it how each jsp page gets called, but another guess is the name of the jsp page is in the same path as that of the Resource... that is com\sun\jersey\samples\bookstore\resources seems to be the package names for the java classes, and the same "path" for the jsp pages.

Maybe you can mess around with that and see what happens.




----- Original Message ----
From: Daniel Larsson <daniel.j.larsson_at_gmail.com>
To: users_at_jersey.dev.java.net
Sent: Friday, August 22, 2008 6:25:44 PM
Subject: [Jersey] Using JSP for HTML representation


Hi,

The bookstore example shows how to use JSP pages for resources. How does jersey decide to use this page when returning the response? I'm returning an instance of a @XmlRootElement annotated class, and there's a provider in the jersey library that has a "*/*" producer, so I'm getting an XML document in response when doing a GET with Accept: text/html.

Is there a way to have my application return the JSP generated page instead?