[ 
https://issues.apache.org/jira/browse/CXF-7322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15961751#comment-15961751
 ] 

Andrei Ivanov commented on CXF-7322:
------------------------------------

Btw, Tomcat 9 will not send a reason phrase and for 8.5 is just optional, after 
a lot of people insisted: https://bz.apache.org/bugzilla/show_bug.cgi?id=60362

> Response.StatusType.getReasonPhrase not working
> -----------------------------------------------
>
>                 Key: CXF-7322
>                 URL: https://issues.apache.org/jira/browse/CXF-7322
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.10
>            Reporter: Vjacheslav Borisov
>            Priority: Minor
>
> I have custom  Response.StatusType class
> {code}
> public class CustomResponseStatus implements Response.StatusType {
>     
>     private final int statusCode;
>     private final String reasonPhrase;
>     public CustomResponseStatus(int statusCode, String reasonPhrase) {
>         this.statusCode = statusCode;
>         this.reasonPhrase = reasonPhrase;
>     }
>     @Override
>     public int getStatusCode() {
>         return statusCode;
>     }
>     @Override
>     public Response.Status.Family getFamily() {
>         return Response.Status.Family.familyOf(statusCode);
>     }
>     @Override
>     public String getReasonPhrase() {
>         return reasonPhrase;
>     }
> }
> {code}
> Usage:
>         Response.StatusType status=new CustomResponseStatus(453,"custom 
> reasonPhrase ");
>         return Response.status(status).entity("Hello " + a + ", Welcome to 
> CXF RS Spring Boot World!!!").build();
> I do not see method getReasonPhrase() gets called and reasonPhrase in 
> response not filled:
> curl -v 
> 'http://localhost:8080/services/helloservice/sayHello/reason/ApacheCxfUser'
> * Hostname was NOT found in DNS cache
> *   Trying ::1...
> * Connected to localhost (::1) port 8080 (#0)
> > GET /services/helloservice/sayHello/reason/ApacheCxfUser HTTP/1.1
> > User-Agent: curl/7.37.0
> > Host: localhost:8080
> > Accept: */*
> > 
> < HTTP/1.1 453 
> E.g. there should be 
> HTTP/1.1 453 custom reasonPhrase
> Example project
> https://github.com/slavb18/spring_boot_scan



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to