You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Henning Matschoss <he...@gmail.com> on 2014/11/20 15:42:58 UTC

Status code 913 impossible with CXF?

Hello!

I am using Apache CXF 3.0.2 for a ReSTful server application and I need to
be able to send javax.ws.rs.core.Responses including custom non-HTTP status
codes. These status codes are greater than 599, which is rejected by
org.apache.cxf.jaxrs.impl.ResponseBuilderImpl.status() (line 77 checks, if
the status code is < 100 || > 599).

The HTTP specification does not forbid sending custom status codes like
e.g. 913 which do not belong to the standard classes (1xx - 5xx).

I already tried a lot to solve this problem by configuring CXF
(interceptors, filters), but nothing helped. ResponseBuilderImpl is
implemented as "final" and I cannot find a workaround to solve this
problem.
Is there a way to let CXF send me a custom status code?

Thanx a lot for any help.
Best regards,
Henning

Re: Status code 913 impossible with CXF?

Posted by Sergey Beryozkin <sb...@gmail.com>.
I made ResponseBuilderImpl non final...

Sergey
On 20/11/14 18:36, Sergey Beryozkin wrote:
> Hi
>
> See
> https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/Response.html#status(int)
>
>
> However this method is less strict:
> https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ContainerResponseContext.html#setStatus(int)
>
>
> I'd encourage you to clarify at the jaxrs users list if the intention
> was to relax the Response.status restriction or not to make sure that if
> you a response filter to set the code outside if that range then it will
> always work...
>
> Thanks, Sergey
>
> On 20/11/14 15:42, Henning Matschoss wrote:
>> Hello!
>>
>> I am using Apache CXF 3.0.2 for a ReSTful server application and I
>> need to
>> be able to send javax.ws.rs.core.Responses including custom non-HTTP
>> status
>> codes. These status codes are greater than 599, which is rejected by
>> org.apache.cxf.jaxrs.impl.ResponseBuilderImpl.status() (line 77
>> checks, if
>> the status code is < 100 || > 599).
>>
>> The HTTP specification does not forbid sending custom status codes like
>> e.g. 913 which do not belong to the standard classes (1xx - 5xx).
>>
>> I already tried a lot to solve this problem by configuring CXF
>> (interceptors, filters), but nothing helped. ResponseBuilderImpl is
>> implemented as "final" and I cannot find a workaround to solve this
>> problem.
>> Is there a way to let CXF send me a custom status code?
>>
>> Thanx a lot for any help.
>> Best regards,
>> Henning
>>
>


Re: Status code 913 impossible with CXF?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

See
https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/Response.html#status(int)

However this method is less strict:
https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ContainerResponseContext.html#setStatus(int)

I'd encourage you to clarify at the jaxrs users list if the intention 
was to relax the Response.status restriction or not to make sure that if 
you a response filter to set the code outside if that range then it will 
always work...

Thanks, Sergey

On 20/11/14 15:42, Henning Matschoss wrote:
> Hello!
>
> I am using Apache CXF 3.0.2 for a ReSTful server application and I need to
> be able to send javax.ws.rs.core.Responses including custom non-HTTP status
> codes. These status codes are greater than 599, which is rejected by
> org.apache.cxf.jaxrs.impl.ResponseBuilderImpl.status() (line 77 checks, if
> the status code is < 100 || > 599).
>
> The HTTP specification does not forbid sending custom status codes like
> e.g. 913 which do not belong to the standard classes (1xx - 5xx).
>
> I already tried a lot to solve this problem by configuring CXF
> (interceptors, filters), but nothing helped. ResponseBuilderImpl is
> implemented as "final" and I cannot find a workaround to solve this
> problem.
> Is there a way to let CXF send me a custom status code?
>
> Thanx a lot for any help.
> Best regards,
> Henning
>