PATCH http verb support for CXF RS.

Solution Verified - Updated -

Issue

  • We have developed a simple echo restful service that accept a request with the PATCH http verb. In order to accomplish it we created a custom PATCH annotation (because JAX-RS 2.0 specification does not support it).
  • Below the annotation definition
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.ws.rs.HttpMethod;

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod("PATCH")
public @interface PATCH {
}
  • This annotation is being used as
This annotation has been used to annotate the service interface:

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

public interface Exposure {

    @PATCH
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/tenant")
    public EchoResponse echoTenant(EchoRequest request);


}
  • However in logs we are getting following WARN message.
12:47:09,295 | WARN  | qtp1417018680-70 | Response                         | 86 - org.eclipse.jetty.aggregate.jetty-all-server - 8.1.19.v20160209 | Committed before 501 Method PATCH is not defined in RFC 2068 and is not supported by the Servlet API 
12:47:09,295 | WARN  | qtp1417018680-70 | ServletHandler                   | 86 - org.eclipse.jetty.aggregate.jetty-all-server - 8.1.19.v20160209 | Error Processing URI: /cxf/multitenancy/tenant/ - (java.lang.IllegalStateException) Committed

Environment

  • Red Hat JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.