Hi Patrick,
The slash should not make any difference, it is redundant. Jersey will
add a slash if not present.
Lakkaraju, my guesses:
- the application has not been deployed correctly,
- there is a proxy in the way that is rejecting PUT requests.
- there is a client limitation, what client are you using?
- the client is sending say a POST or GET request rather than a PUT
request.
You can enable logging and tracing on the server-side by doing the
following:
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</
param-name>
<param-value>com.sun.jersey.api.container.filter.LoggingFilter</
param-value>
</init-param>
<init-param>
<param-
name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.LoggingFilter</
param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.feature.Trace</param-name>
<param-value>true</param-value>
</init-param>
you may get some clues as to why a 405 response is being returned.
Paul.
On Aug 4, 2010, at 7:34 AM, Patrick Dreyer wrote:
> It's all about a missing slash:
>
> Wrong: @Path("{eventType}")
> Correct: @Path("/{eventType}")
>
> Patrick
>
> Am 03.08.2010 18:37, schrieb Lakkaraju Krishna:
>>
>> Hi,
>>
>> I am trying to write a @PUT method using Jersey and upon starting
>> the server, the server is not recognizing the PUT operation.
>>
>> The sample PUT method:
>>
>> @Path("/event")
>> public class EventRestService{
>> @PUT
>> @Path("{eventType}")
>> @Consumes(MediaType.TEXT_PLAIN)
>> public Response updateEventLog(@PathParam("{eventType}")
>> String eventType){
>> //List<Event> eventLst;
>> System.out.println(eventType +" ========> from Server.");
>> return null;
>> }
>> }
>>
>> URL: http:/localhost/rest/event/123
>>
>> I am getting 405 exception, why? Am I doing anything wrong here !
>>
>> - Lakkaraju
>>
>> This e-mail message may contain confidential and/or privileged
>> information. If you are
>> not an addressee or otherwise authorized to receive this message,
>> you should not use,
>> copy, disclose or take any action based on this e-mail or any
>> information contained in the
>> message. If you have received this material in error, please advise
>> the sender immediately
>> by reply e-mail and delete this message.
>>
>> Thank you.
>
> <Patrick.vcf>