Hi Amit,
On Apr 22, 2008, at 1:27 AM, amit maheshwari wrote:
> Hi All,
>
> I am new to the RESTful webservice world.I have to develop a web
> application for my client and there it is proposed to me to use
> REST WS.
>
Welcome to the list.
>
> So i need to know if jsp+jersey0.6+jpa is a good combination. do i
> need to use some framework?
>
>
What do you mean by framework? all three technologies you mention
above are "frameworks" (with distinct architectures), and you compose
them together to build your application.
I am slightly biased :-) but i think this composition would make a
good basis to build a Web application. I specifically modeled the JSP-
based approach based on Hudson, which is essentially Jelly/Groovy
+Hudson/Stapler+File. Hudson makes extensive use of implicit views.
> i tried Bookstore example of jersey but there jsp-templates are
> placed in a proper directory structure pattern but i want to put
> all my jsps into the folder i want. I aked this to Paul abd he told
> me the we can explicitly create an instance of viewable() class and
> tranfer the control to the jsp.
> What i did is in the getItem() method of Bookstore.java class , i
> changed the retun type of getItem() method to Viewable and return
> the Viewable object with absolute path of the jsp and the item
> model. I haven't change the location of jsp because i just wanted
> to test it. but it is giving first a warning:
>
> "A resource class, class com.sun.ws.rest.api.view.Viewable, does
> not have any resource method, sub-resource method, or sub-resource
> locator.
> "
> and on browser ,i am getting the following error description:
>
> "The specified HTTP method is not allowed for the requested resource "
>
> please help me out and tell me the procedure to integrate web
> resource to jsps.
>
>
The getItem method is a sub-locator method. It returns another
resource to match more of the request URI path. Essentially the
Bookstore example shows the use of polymorphic types for resources,
namely that one can add another resource say, DVD, that extends Item
and defines its own hierarchical URI space.
To get want you want to work, namely changing implicit views to
explicit views you need to implement a GET method on a concrete
resource, for example modify the Book class to as follows:
public class Book extends Item {
public Book(final String title, final String author) {
super(title, author);
}
@GET
public Viewable get() {
return new Viewable("/com/sun/ws/rest/samples/bookstore/
resources/Book/index.jsp", this);
}
}
Paul.