users@jersey.java.net

Re: help with uritemplate

From: Vishal Vatsa <vishal.vatsa_at_propylon.com>
Date: Thu, 23 Aug 2007 11:24:04 +0100

Hi Jakub,

Thanks for taking a look at this for me, I will submit a new bug report with
the necessary files to recreate the issue.

I was really hoping I that I was at fault, crap.

Thanks Again
Vishal

On Thursday 23 August 2007 10:49:08 Jakub Podlesak wrote:
> Hi Vishal,
>
> I think it is a bug. Could you please submit a new bug report at
> https://jersey.dev.java.net/issues/
> so that we can track it?
>
> Please do not forget to attach your project files.
>
> Thank you a lot!
>
> ~Jakub
>
> On Thu, Aug 23, 2007 at 07:46:44AM +0100, Vishal Vatsa wrote:
> > Hi Guys,
> >
> > I have a class with three functions on the same uritemplate with diffrent
> > httpmethod (get, post, put) for each. Any time I try to use the post
> > method I keep getting 405 method not allowed, but the really odd thing is
> > that if I comment out the functions with the get and put httpmethod, I
> > can use the post method no problem.
> >
> >
> > So in the below src, if I comment out getTransaction and
> > processInstructon funtions, I can use the post methon on uri
> > "/XmlUpdate/blahblah" and hit the acceptResource function just fine, but
> > the way it it right now if I do the post to the url "/XmlUpdate/blahblah"
> > I keep getting a 405 responce.
> >
> > If any one could please point out what I am doing wrong, it would be
> > great as I am reduced to pulling my hair out at this point.
> >
> > Thanks
> > Vishal
> >
> > ###############################################
> > # java src file
> > ###############################################
> > import javax.ws.rs.ConsumeMime;
> > import javax.ws.rs.HttpMethod;
> > import javax.ws.rs.UriParam;
> > import javax.ws.rs.UriTemplate;
> > import javax.ws.rs.core.HttpContext;
> > import javax.ws.rs.core.HttpHeaders;
> > import javax.ws.rs.core.Response;
> >
> > @UriTemplate("/XmlUpdate")
> > public class MTest {
> >
> > @HttpMethod("GET")
> > public Response serviceStatus(@HttpContext HttpHeaders header){
> > return Response.Builder.representation("serviceStatus", "text/plain")
> > .header("Etag", "0000000")
> > .status(200).build();
> > }
> >
> > @HttpMethod("POST")
> > //_at_ConsumeMime("application/x-www-form-urlencoded")
> > public Response createTransaction(@HttpContext HttpHeaders header,
> > String xml){
> >
> >
> > return Response.Builder.representation("createTransaction",
> > "text/plain") .header("Location", "/")
> > .header("Etag", "11111")
> > .status(201).build();
> > }
> >
> > @UriTemplate("{transac_id}")
> > @HttpMethod("POST")
> > @ConsumeMime("*/*")
> > public Response acceptResource(@UriParam("transac_id") String
> > transac_id, @HttpContext HttpHeaders header,
> > String data){
> > return Response.Builder.representation(data, "text/plain")
> > .header("Etag", transac_id)
> > .header("Location", "/")
> > .status(201).build();
> >
> >
> >
> > }
> >
> >
> > @UriTemplate("{transaction_id}")
> > @HttpMethod("GET")
> > public Response getTransactionStatus(@UriParam("transaction_id") String
> > t_id) {
> > return Response.Builder.representation("get transaction", "text/plain")
> > .header("Etag", "222222")
> > .status(200).build();
> > }
> >
> >
> >
> > @UriTemplate("{transaction_id}")
> > @HttpMethod("PUT")
> > public Response processInstruction(@UriParam("transaction_id") String
> > t_id, String xml){
> >
> > return Response.Builder.representation(xml, "text/xml")
> > .header("Etag", "3333333")
> > .status(200).build();
> > }
> >
> >
> >
> > }
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net



-- 
Last song played: Ryan Adams – I See Monsters, on Thu Aug 23 10:17:27 2007