users@glassfish.java.net

Re: HTTP 405 error

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 22 Jun 2010 13:27:16 -0700

Hi,

Does that remote machine have a HTTP proxy between it and the service?

Under such conditions i would expect the PUT to more likely fail than
the POST as some proxies block PUT requests.

Can you enable logging of the service, add the following to the
servlet init params:

      <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>

to see if there is anything odd with the client requests that reach
the service from the remote machine.

Paul.

On Jun 22, 2010, at 12:49 PM, Marcus Veloso wrote:

> import...
>
> @Path("test")
> public class TestResource {
> @Context
> ...
> @GET
> @Produces("application/xml")
> public String getXml() {
> return test_resource.toXML(); // String generated by
> "Test_Resource" object.
> }
>
> @POST
> @Consumes("application/xml")
> public String postXml(String content) {
> // update "Test_Resource" object
> return "Ok";
> }
>
> @PUT
> @Consumes("application/xml")
> public String putXml(String content) {
> // update "Test_Resource" object
> return "Ok";
> }
> }
>