Re: POST Requests return with a 405 with @Post annotated method

2010-10-18 Thread Alexander Kampmann
Same error with 2.1...

On 17.10.2010 16:32, Alexander Kampmann wrote:
 I would like to try an own build, but neither ant nor maven work for me.

 On 17.10.2010 14:56, Alexander Kampmann wrote:

 hello,

 I am using the restlet- jars from the maven.restlet.org- Repository (so,
 the public ones). That means, they are refreshed on the 1st and the 15th
 of each month.
 Due to that, Thierry's changes should be in there by now (he reported
 them on 22th of September).

 My Version is JEE Restlet 2.0.1. But in fact I get exactly the error
 Dustin reported about. When I try to POST to my resource, the server
 says 405 - Method not allowed, but the header says Allows: GET,
 POST. The @Post- Annotation is present.

 Maybe the change didn't make it to the maven- repository by now?
 Or is there any possibility things went wrong for other reasons? (I've
 got quite a large Inheritance- Hierarchy, in fact the annotation is in
 an interface and the Restlet- class is inherited from a class, which
 implements the interface and ServerResource, could that be a problem?)

 The environment is a RestletApplication packed as war and deployed to
 Tomcat 6.0.29 as it was for Dustin. All the other resources (using get)
 including the get- Method of that resource work fine.

 Greetings,
 Alex

 On 23.09.2010 01:07, Dustin N. Jenkins wrote:

  
 Lovely, thanks Thierry!

 DNJ


 On 09/22/2010 10:20 AM, Thierry Boileau wrote:



 Hello Dustin,

 thanks for your report. I've fixed this bug in the svn repository (trunk 
 and 2.0 branch).

 Best regards,
 Thierry Boileau

 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2663402


  
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2672749

  
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2672760



--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2673047


Setting cookies

2010-10-18 Thread webpost
I'm having a heck of a time trying to set a cookie.  This is the code I have so 
far:

In the first part attempts to read any cookies that I put there before, this 
always comes up blank.

The second part tries to add a new cookie to the response.  Theres a few places 
that I could have gone wrong:
1) I didn't know how to instantiate a new SeriesCookieSetting, so I grabbed 
the existing one and modified it by by calling 'this.getCookieSettings()'.  
2) I added the cookie by calling 'this.setCookieSettings()'
3) I'm doing this through 'POST'

When I check the response headers 'Set-Cookie' doesn't appear to be there at 
all.

public class TestCookieResource extends ServerResource {

@Post
public Representation post(Representation representation){

// READ COOKIES FROM CLIENT
SeriesCookie cookies = this.getRequest().getCookies();
int cookieNum = cookies.size();
String values = ;
for( Cookie cookie : cookies){
values += cookie.getValue() + \n;
}

// SET NEW COOKIE
CookieSetting cS = new CookieSetting(0, cookieName, 
cookieValue);
SeriesCookieSetting cookieSettings = this.getCookieSettings();
cookieSettings.clear();
cookieSettings.add(cS);
this.setCookieSettings(cookieSettings);

// SEND RESPONSE
this.setStatus(Status.SUCCESS_OK);
//StringRepresentation sR = new 
StringRepresentation(HELP.getJSON(HELP.getMessageMap(Test 
response)).toString());
StringRepresentation sR = new StringRepresentation(test 
response);
return sR;
}
}

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2673132


RE: Re: POST Requests return with a 405 with @Post annotated method

2010-10-18 Thread webpost
I get this problem with 2.0.1 and 2.1 fetched today (18 Oct 2010) (Java SE 
versions) using the internal server.

The example FirstResource application fails.
Problem also occurs with PUT.

2.0.RC4 works (well, that bit did)

Peter Furniss

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2673141