users@jersey.java.net

[Jersey] Re: Forward to Servlet

From: cmdotmani <cmdotmani_at_gmail.com>
Date: Thu, 9 Dec 2010 16:50:27 -0800 (PST)

Thanks for sharing the bookstore.

I am looking for Explicit MVC using Viewable. Can you please tell me whether
I am making correct progress.

1) <filter> <filter-name>JerseyFilter</filter-name>
<filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class>
<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.property.JSPTemplatesBasePath</param-name>
<param-value>/views/</param-value> </init-param> <init-param>
<param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
<param-value>/(images|css|jsp)/.*</param-value> </init-param> </filter>
<filter-mapping> <filter-name>JerseyFilter</filter-name>
<url-pattern>/myproject/*</url-pattern> </filter-mapping>

So all my resources will start with /myproject/singup..

2) My resource class

@Path ("/admin") public class AdminUiResource { @GET @Produces ("text/html")
@Path ("/singup") public Viewable getSignUp () { return new
Viewable("/public/signup", "some object here"); }

...

3) For post

@POST @Produces ("text/html") @Path ("/singup") public Viewable getSignUp
(SignUpRequest request) { //some logic here by accesing request obj

//question. How to I return the success or failure status with error message
// is there a standard way provided by jersey mvc ?

return new Viewable("/public/signup", "some object here"); }


Thanks,


On Thu, Dec 9, 2010 at 9:58 AM, Paul Sandoz-2 [via Jersey] <
ml-node+5819249-462221888-307074_at_n2.nabble.com<ml-node%2B5819249-462221888-307074_at_n2.nabble.com>
> wrote:

> On Dec 9, 2010, at 2:53 AM, cmdotmani wrote:
>
> >
> > I am a newbie to Jersey Viewable & JSPTemplateProcessor.
> > My client has an application which exposes api and they want to have
> > a UI
> > framework from Jersey MVC (using viewable & JSPTemplateProcessor..)
> >
> > Could you please send me a sample code implementation for
> > JSPTemplateProcessor.
> >
> >
>
> See here:
>
>
> http://download.java.net/maven/2/com/sun/jersey/samples/bookstore/1.4/bookstore-1.4-project.zip
>
> Paul.
>
>
> ------------------------------
> View message @
> http://jersey.576304.n2.nabble.com/Forward-to-Servlet-tp5351731p5819249.html
> To unsubscribe from Forward to Servlet, click here<http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5351731&code=Y21kb3RtYW5pQGdtYWlsLmNvbXw1MzUxNzMxfC0xMzU0Mzg3MDEx>.
>
>

-- 
View this message in context: http://jersey.576304.n2.nabble.com/Forward-to-Servlet-tp5351731p5821531.html
Sent from the Jersey mailing list archive at Nabble.com.