Apache CXF 3.0.3

Scenario 1
All jax-rs annotation are applied on interface.
No jax-rs annotation are applied on class.

@POST
@Consumes({ APPLICATION_XML })
method1(InputStream istream)

@POST
@Consumes({ APPLICATION_FORM_URLENCODED })
method2a(@FormParam("") final Pojo2 p2)        -> won't detect it as a resource method

@POST
@Consumes({ APPLICATION_FORM_URLENCODED })
@Produces({ APPLICATION_XML })
@Path("/method2b")
method2b(@FormParam("") final Pojo2 p2)

Scenario 2
All jax-rs annotation are applied on interface as specified above in scenario 1.
The class only have the jax-rs annotations specified below.

@Override
method2a(@FormParam("") final Pojo2 p2)        -> won't detect it as a resource method
@Override
method2b(@FormParam("") final Pojo2 p2)        -> won't detect it as a resource method

Scenario 3
All jax-rs annotation are applied on interface as specified above in scenario 1.
The class only have the jax-rs annotations specified below.

@Override
method1(InputStream istream)

@Override
@POST
@Consumes({ APPLICATION_FORM_URLENCODED })
method2a(@FormParam("") final Pojo2 p2)

@Override
@POST
@Consumes({ APPLICATION_FORM_URLENCODED })
@Produces({ APPLICATION_XML })
@Path("/method2b")
method2b(@FormParam("") final Pojo2 p2)

Everything is working as expected.

Scenario 4
All jax-rs annotation are applied on interface as specified above in scenario 1.
The class only have the jax-rs annotations specified below.

@Override
method1(InputStream istream)

@Override
@POST
method2a(final Pojo2 p2)

@Override
method2b(final Pojo2 p2)

method2a is mapped to mediaType="*/*" (though the interface is specifying application/x-www-form-urlencoded).
method2a won't accept application/x-www-form-urlencoded payload (seems to ignore @FormParam annotation from interface).
Everything else is working as expected.

Scenario 5
All jax-rs annotation are applied on interface as specified above in scenario 1.
The class only have the jax-rs annotations specified below.

@Override
method1(InputStream istream)

@Override
@POST
@Consumes({ APPLICATION_FORM_URLENCODED })
method2a(final Pojo2 p2)

@Override
method2b(final Pojo2 p2)

method2a is mapped to mediaType="application/x-www-form-urlencoded" (as the interface is specifying).
method2a won't accept application/x-www-form-urlencoded payload (seems to ignore @FormParam annotation from interface).
Everything else is working as expected.

Scenario 6
All jax-rs annotation are applied on interface as specified above in scenario 1.
The class only have the jax-rs annotations specified below.

@Override
method1(InputStream istream)

@Override
@POST
method2a(@FormParam("") final Pojo2 p2)

@Override
method2b(final Pojo2 p2)

Everything is working as expected.

CXF JAX-RS configuration: http://cxf.apache.org/docs/jaxrs-services-configuration.html

CXF specific
QueryParam("") - CXF extension supporting the injection of all the parameters of specific JAX-RS type (example, QueryParam("") MyBean).
StreamingResponse - use it instead of StreamingOutput in order to auto-serialize T

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.