[
https://issues.apache.org/jira/browse/CXF-4224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246221#comment-13246221
]
Jakub Bocheński commented on CXF-4224:
--------------------------------------
I implemented a custom ResponseHandler that will change the status code to 201
and add Location header - but it needs a custom annotation to identify the
resource-creating methods.
Since those methods are always invoked via the POST verb I figured I will
create an annotataion that would do both things at once (identify factory
method and define the HTTP verb).
Of course I could do sth like:
@POST
@RestFactory
with @RestFactory being a simple runtime annotation.
Anyway I assume this is a rather simple fix when you know where to change it
(OK - I didn't look for it too long) - maybe do it just for the sake of being
spec-compilant?
> Custom HTTP methods (HttpMethod annot) not supported?
> -----------------------------------------------------
>
> Key: CXF-4224
> URL: https://issues.apache.org/jira/browse/CXF-4224
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.5.3
> Reporter: Jakub Bocheński
>
> I wanted to save myself some typing and introduce a custom method annotation
> for use with a response handler:
> @Target(value = METHOD)
> @Retention(value = RUNTIME)
> @HttpMethod(value = POST)
> public @interface POST_create {
> }
> since HATEOS resource creation is done with POST.
> However a method:
> @POST_create
> @Consumes(CONTENT_FORM_URLENCODED)
> @Description(title = "Factory method")
> Dto createSomething( ... );
> is not found as valid resource method.
> When I annotate it with regular POST annot. it works:
> @POST
> @POST_create
> @Consumes(CONTENT_FORM_URLENCODED)
> @Description(title = "Factory method")
> Dto createSomething( ... );
> BTW. While trying to debug this I noticed that the HttpMethod annotation is
> still recognized as a valid resource method annotation ( c.f. CXF-1007 ) in
> org.apache.cxf.jaxrs.utils.AnnotationUtils.initMethodAnnotationClasses() line
> 114
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira