{"id":2501,"date":"2015-12-16T16:25:46","date_gmt":"2015-12-16T14:25:46","guid":{"rendered":"https:\/\/adrhc.go.ro\/wordpress\/?p=2501"},"modified":"2017-05-10T22:08:54","modified_gmt":"2017-05-10T20:08:54","slug":"apache-cxf-3-0-3","status":"publish","type":"post","link":"https:\/\/adrhc.go.ro\/blog\/apache-cxf-3-0-3\/","title":{"rendered":"Apache CXF 3.0.3"},"content":{"rendered":"<pre>\r\n<strong>Scenario 1<\/strong>\r\nAll jax-rs annotation are applied on interface.\r\nNo jax-rs annotation are applied on class.\r\n\r\n@POST\r\n@Consumes({ APPLICATION_XML })\r\nmethod1(InputStream istream)\r\n\r\n@POST\r\n@Consumes({ APPLICATION_FORM_URLENCODED })\r\nmethod2a(@FormParam(\"\") final Pojo2 p2)        -> won't detect it as a resource method\r\n\r\n@POST\r\n@Consumes({ APPLICATION_FORM_URLENCODED })\r\n@Produces({ APPLICATION_XML })\r\n@Path(\"\/method2b\")\r\nmethod2b(@FormParam(\"\") final Pojo2 p2)\r\n\r\n<strong>Scenario 2<\/strong>\r\nAll jax-rs annotation are applied on interface as specified above in <em>scenario 1<\/em>.\r\nThe class only have the jax-rs annotations specified below.\r\n\r\n@Override\r\nmethod2a(@FormParam(\"\") final Pojo2 p2)        -> won't detect it as a resource method\r\n@Override\r\nmethod2b(@FormParam(\"\") final Pojo2 p2)        -> won't detect it as a resource method\r\n\r\n<strong>Scenario 3<\/strong>\r\nAll jax-rs annotation are applied on interface as specified above in <em>scenario 1<\/em>.\r\nThe class only have the jax-rs annotations specified below.\r\n\r\n@Override\r\nmethod1(InputStream istream)\r\n\r\n@Override\r\n@POST\r\n@Consumes({ APPLICATION_FORM_URLENCODED })\r\nmethod2a(@FormParam(\"\") final Pojo2 p2)\r\n\r\n@Override\r\n@POST\r\n@Consumes({ APPLICATION_FORM_URLENCODED })\r\n@Produces({ APPLICATION_XML })\r\n@Path(\"\/method2b\")\r\nmethod2b(@FormParam(\"\") final Pojo2 p2)\r\n\r\nEverything is working as expected.\r\n\r\n<strong>Scenario 4<\/strong>\r\nAll jax-rs annotation are applied on interface as specified above in <em>scenario 1<\/em>.\r\nThe class only have the jax-rs annotations specified below.\r\n\r\n@Override\r\nmethod1(InputStream istream)\r\n\r\n@Override\r\n@POST\r\nmethod2a(final Pojo2 p2)\r\n\r\n@Override\r\nmethod2b(final Pojo2 p2)\r\n\r\nmethod2a is mapped to mediaType=\"*\/*\" (though the interface is specifying application\/x-www-form-urlencoded).\r\nmethod2a won't accept application\/x-www-form-urlencoded payload (seems to ignore @FormParam annotation from interface).\r\nEverything else is working as expected.\r\n\r\n<strong>Scenario 5<\/strong>\r\nAll jax-rs annotation are applied on interface as specified above in <em>scenario 1<\/em>.\r\nThe class only have the jax-rs annotations specified below.\r\n\r\n@Override\r\nmethod1(InputStream istream)\r\n\r\n@Override\r\n@POST\r\n@Consumes({ APPLICATION_FORM_URLENCODED })\r\nmethod2a(final Pojo2 p2)\r\n\r\n@Override\r\nmethod2b(final Pojo2 p2)\r\n\r\nmethod2a is mapped to mediaType=\"application\/x-www-form-urlencoded\" (as the interface is specifying).\r\nmethod2a won't accept application\/x-www-form-urlencoded payload (seems to ignore @FormParam annotation from interface).\r\nEverything else is working as expected.\r\n\r\n<strong>Scenario 6<\/strong>\r\nAll jax-rs annotation are applied on interface as specified above in <em>scenario 1<\/em>.\r\nThe class only have the jax-rs annotations specified below.\r\n\r\n@Override\r\nmethod1(InputStream istream)\r\n\r\n@Override\r\n@POST\r\nmethod2a(@FormParam(\"\") final Pojo2 p2)\r\n\r\n@Override\r\nmethod2b(final Pojo2 p2)\r\n\r\nEverything is working as expected.\r\n\r\n<em>CXF JAX-RS configuration<\/em>: <a href=\"http:\/\/cxf.apache.org\/docs\/jaxrs-services-configuration.html\" target=\"_blank\">http:\/\/cxf.apache.org\/docs\/jaxrs-services-configuration.html<\/a>\r\n\r\n<strong>CXF specific<\/strong>\r\n<em>QueryParam(\"\")<\/em> - CXF extension supporting the injection of all the parameters of specific JAX-RS type (example, QueryParam(\"\") MyBean).\r\n<em>StreamingResponse<T><\/em> - use it instead of StreamingOutput in order to auto-serialize T\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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(&#8220;&#8221;) final Pojo2 p2) -> won&#8217;t detect it as a resource method @POST @Consumes({ [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/adrhc.go.ro\/blog\/apache-cxf-3-0-3\/#more-2501\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">Apache CXF 3.0.3<\/span><\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,10],"tags":[72],"class_list":["post-2501","post","type-post","status-publish","format-standard","hentry","category-java","category-programming","tag-cxf"],"_links":{"self":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/2501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/comments?post=2501"}],"version-history":[{"count":0,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/2501\/revisions"}],"wp:attachment":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/media?parent=2501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/categories?post=2501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/tags?post=2501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}