[jboss-jira] [JBoss JIRA] (WFLY-1419) Overrides REST Response Object on Status 404

Aslak Knutsen (JIRA) jira-events at lists.jboss.org
Wed May 29 16:43:55 EDT 2013


Aslak Knutsen created WFLY-1419:
-----------------------------------

             Summary: Overrides REST Response Object on Status 404
                 Key: WFLY-1419
                 URL: https://issues.jboss.org/browse/WFLY-1419
             Project: WildFly
          Issue Type: Bug
          Components: Web (Undertow)
    Affects Versions: 8.0.0.Alpha1
         Environment: JBoss AS 7.1.1, JBoss EAP 6.1.0, WildFly 8.0.0.Alpha1
Linux, Java 1.7
            Reporter: Aslak Knutsen
            Assignee: Stuart Douglas


*Given*:

{code:title=JAX-RS Resource Code}
@Path("/conference")
public class ConferenceResource implements Resource {

    private static final String BASE_MEDIA_TYPE = "application/vnd.ced+xml";
    private static final String CONFERENCE_MEDIA_TYPE = BASE_MEDIA_TYPE + ";type=conference";
    private static final String SESSION_MEDIA_TYPE = BASE_MEDIA_TYPE + ";type=session";

...

    @GET
    @Path("/{id}")
    @Produces("application/vnd.ced+xml")
    public Response get(@PathParam("id") String id) {
        Conference conference = repository.get(id);
        if(conference == null) {
            return Response.status(Status.NOT_FOUND).type(CONFERENCE_MEDIA_TYPE).build();
        }
        return Response.ok(
                new ConferenceRepresentation(conference, uriInfo.getAbsolutePathBuilder()))
                .type(CONFERENCE_MEDIA_TYPE).build();
    }
...
}
{code}

*Then*:
The Body and MediaType is overwritten by the WebContainer and standard text/html Error Page is returned. 

{code:title=Wire Log}
DEBUG [org.apache.http.wire] >> "GET /c5b53d1f-e6fd-40a2-8656-2e36e7e92997/api/conference/d4c6bdb2-51a0-44f8-99bc-75a18ee76228 HTTP/1.1[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept: application/vnd.ced+xml;type=conference[\r][\n]"
DEBUG [org.apache.http.wire] >> "Host: 127.0.0.1:8080[\r][\n]"
DEBUG [org.apache.http.wire] >> "Connection: Keep-Alive[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept-Encoding: gzip,deflate[\r][\n]"
DEBUG [org.apache.http.wire] >> "[\r][\n]"

DEBUG [org.apache.http.wire] << "HTTP/1.1 200 OK[\r][\n]"
DEBUG [org.apache.http.wire] << "Server: Apache-Coyote/1.1[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Type: application/vnd.ced+xml;type=conference[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Length: 422[\r][\n]"
DEBUG [org.apache.http.wire] << "Date: Wed, 29 May 2013 02:54:22 GMT[\r][\n]"
DEBUG [org.apache.http.wire] << "[\r][\n]"
DEBUG [org.apache.http.wire] << "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns3:conference xmlns:ns2="urn:ced:link" xmlns:ns3="urn:ced:conference"><ns2:link href="http://127.0.0.1:8080/c5b53d1f-e6fd-40a2-8656-2e36e7e92997/api/conference/d4c6bdb2-51a0-44f8-99bc-75a18ee76228/session" rel="session"/><end>2013-05-29T04:54:22.213+02:00</end><name>Test</name><start>2013-05-29T04:54:22.213+02:00</start><tagLine>Tagline</tagLine></ns3:conference>"


DEBUG [org.apache.http.wire] >> "DELETE /c5b53d1f-e6fd-40a2-8656-2e36e7e92997/api/conference/d4c6bdb2-51a0-44f8-99bc-75a18ee76228 HTTP/1.1[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept: */*[\r][\n]"
DEBUG [org.apache.http.wire] >> "Content-Length: 0[\r][\n]"
DEBUG [org.apache.http.wire] >> "Host: 127.0.0.1:8080[\r][\n]"
DEBUG [org.apache.http.wire] >> "Connection: Keep-Alive[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept-Encoding: gzip,deflate[\r][\n]"
DEBUG [org.apache.http.wire] >> "[\r][\n]"

DEBUG [org.apache.http.wire] << "HTTP/1.1 204 No Content[\r][\n]"
DEBUG [org.apache.http.wire] << "Server: Apache-Coyote/1.1[\r][\n]"
DEBUG [org.apache.http.wire] << "Date: Wed, 29 May 2013 02:55:44 GMT[\r][\n]"
DEBUG [org.apache.http.wire] << "[\r][\n]"


DEBUG [org.apache.http.wire] >> "GET /c5b53d1f-e6fd-40a2-8656-2e36e7e92997/api/conference/d4c6bdb2-51a0-44f8-99bc-75a18ee76228 HTTP/1.1[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept: application/vnd.ced+xml;type=conference[\r][\n]"
DEBUG [org.apache.http.wire] >> "Host: 127.0.0.1:8080[\r][\n]"
DEBUG [org.apache.http.wire] >> "Connection: Keep-Alive[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept-Encoding: gzip,deflate[\r][\n]"
DEBUG [org.apache.http.wire] >> "[\r][\n]"

DEBUG [org.apache.http.wire] << "HTTP/1.1 404 Not Found[\r][\n]"
DEBUG [org.apache.http.wire] << "Server: Apache-Coyote/1.1[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Type: text/html;charset=utf-8[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Length: 956[\r][\n]"
DEBUG [org.apache.http.wire] << "Date: Wed, 29 May 2013 02:55:45 GMT[\r][\n]"
DEBUG [org.apache.http.wire] << "[\r][\n]"
DEBUG [org.apache.http.wire] << "<html><head><title>JBoss Web/7.0.13.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The requested resource () is not available.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.13.Final</h3></body></html>"
HTTP/1.1 404 Not Found
Server=Apache-Coyote/1.1
Content-Type=text/html;charset=utf-8
Content-Length=956
Date=Wed, 29 May 2013 02:55:45 GMT

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
      JBoss Web/7.0.13.Final - Error report
    </title>
    <style>
      &lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--&gt;
    </style>
  </head>
  <body>
    <h1>
      HTTP Status 404 -
    </h1>
    <hr noshade="noshade" size="1"/>
    <p>
      <b>
        type
      </b>
      Status report
    </p>
    <p>
      <b>
        message
      </b>
      <u/>
    </p>
    <p>
      <b>
        description
      </b>
      <u>
        The requested resource () is not available.
      </u>
    </p>
    <hr noshade="noshade" size="1"/>
    <h3>
      JBoss Web/7.0.13.Final
    </h3>
  </body>
</html>
{code}


*Expected*: Return the JAX-RS Response Object as defined by the JAX-RS Service.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list