Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 968572

Summary: Overrides REST Response Object on Status 404
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Aslak Knutsen <aknutsen>
Component: RESTEasy, WebAssignee: Weinan Li <weli>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: rhusar, stephan.vollmer
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-07 11:36:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aslak Knutsen 2013-05-29 20:55:44 UTC
Description of problem:

Web Container override JAX-RS Response Object when Response Object return HTTP status 404

Version-Release number of selected component (if applicable):

Tested/Verified on JBoss AS 7.1.1, JBoss EAP 6.1.0, WildFly 8.0.0.Alpha1 

How reproducible:
100%

Steps to Reproduce:
See https://gist.github.com/aslakknutsen/5667696 for JAX-RS Resource code and wire log

Actual results:

Response with Content-Type: text/html and Standard Error page in Body

Expected results:

Response with Content-Type: application/vnd.ced+xml and empty Body as specified by the JAX-RS Response Object.

Comment 1 JBoss JIRA Server 2013-05-29 22:26:43 UTC
Stuart Douglas <stuart.w.douglas> made a comment on jira WFLY-1419

This looks like a jax-rs issue. It is definitily not an Undertow issue ("Server: Apache-Coyote/1.1[\r][\n]").

If resteasy is not forcing the response to be commited then the normal server error page handling will take over, which will reset the headers.

Comment 2 JBoss JIRA Server 2013-05-29 22:41:57 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Sorry, the wire log above was from the JBoss AS 7.1.1 run. This is from WildFly 8.0.0.Alpha1

{code}
DEBUG [org.apache.http.wire] >> "GET /1f7e7eba-2f16-46d1-a09a-cb8b8e451e04/api/conference/2cd3caea-e488-4536-ad88-2eef3f9ad3c8 HTTP/1.1[\r][\n]"
DEBUG [org.apache.http.wire] >> "Accept: */*[\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] << "Connection: keep-alive[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Type: application/vnd.ced+xml; type=conference[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Length: 74[\r][\n]"
DEBUG [org.apache.http.wire] << "[\r][\n]"
DEBUG [org.apache.http.wire] << "<html><head><title>Error</title></head><body>404 - Not Found</body></html>"
HTTP/1.1 404 Not Found
Connection=keep-alive
Content-Type=application/vnd.ced+xml; type=conference
Content-Length=74

<html>
  <head>
    <title>
      Error
    </title>
  </head>
  <body>
    404 - Not Found
  </body>
</html>
{code}


Seems to be coming from this: 
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/error/SimpleErrorPageHandler.java

Comment 3 JBoss JIRA Server 2013-05-29 22:42:39 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

But yea, the fix might be RestEasy telling Undertown it's in control.

Comment 4 JBoss JIRA Server 2013-05-29 22:42:55 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

But yea, the fix might be RestEasy telling Undertow it's in control.

Comment 5 JBoss JIRA Server 2013-05-30 00:27:39 UTC
Stuart Douglas <stuart.w.douglas> made a comment on jira WFLY-1419

I think this should be fixed in upstream Undertow.

Comment 6 JBoss JIRA Server 2013-05-30 00:53:06 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Building master to check.. 

First problem on OpenJDK 1.7:
https://github.com/wildfly/wildfly/blob/master/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L148

;; semicolon cause UnReachable Statement compile error :)

Comment 7 JBoss JIRA Server 2013-05-30 01:04:43 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Same in upstream master

{code}
DEBUG [org.apache.http.wire] << "HTTP/1.1 404 Not Found[\r][\n]"
DEBUG [org.apache.http.wire] << "Connection: keep-alive[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Type: application/vnd.ced+xml; type=conference[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Length: 74[\r][\n]"
DEBUG [org.apache.http.wire] << "[\r][\n]"
DEBUG [org.apache.http.wire] << "<html><head><title>Error</title></head><body>404 - Not Found</body></html>"

{code}

Comment 8 JBoss JIRA Server 2013-05-30 01:10:12 UTC
Stuart Douglas <stuart.w.douglas> made a comment on jira WFLY-1419

Did you build the latest Undertow as well? The fix has not made it into Wildfly yet.

Comment 9 JBoss JIRA Server 2013-05-30 01:17:56 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Yeah;

JBAS017502: Undertow 1.0.0.Alpha18-SNAPSHOT starting

Only did this tho, with Undertow build from : https://github.com/undertow-io/undertow
{code}
-        <version.io.undertow>1.0.0.Alpha17</version.io.undertow>
+        <version.io.undertow>1.0.0.Alpha18-SNAPSHOT</version.io.undertow>
{code}

Not sure if any other upgrades are needed.

Comment 10 JBoss JIRA Server 2013-05-30 01:18:22 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Yeah;

JBAS017502: Undertow 1.0.0.Alpha18-SNAPSHOT starting

Only did this tho in wildfly/pom.xml, with Undertow build from : https://github.com/undertow-io/undertow
{code}
-        <version.io.undertow>1.0.0.Alpha17</version.io.undertow>
+        <version.io.undertow>1.0.0.Alpha18-SNAPSHOT</version.io.undertow>
{code}

Not sure if any other upgrades are needed.

Comment 11 JBoss JIRA Server 2013-05-30 01:30:57 UTC
Stuart Douglas <stuart.w.douglas> made a comment on jira WFLY-1419

Ok, I just submitted another fix to upstream undertow and confirmed that it fixes your issue. I will probably do an Undertow release tomorrow or on the weekend to get this into Wildfly upstream.

Comment 12 JBoss JIRA Server 2013-05-30 01:38:14 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

This doesn't have any effect either

{code}
diff --git a/pom.xml b/pom.xml
index 10d1430..ed10204 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,8 +100,8 @@
         <version.dom4j>1.6.1</version.dom4j>
         <version.gnu.getopt>1.0.13</version.gnu.getopt>
         <version.io.netty>3.6.6.Final</version.io.netty>
-        <version.io.undertow>1.0.0.Alpha17</version.io.undertow>
-        <version.io.undertow.jastow>1.0.0.Alpha2</version.io.undertow.jastow>
+        <version.io.undertow>1.0.0.Alpha18-SNAPSHOT</version.io.undertow>
+        <version.io.undertow.jastow>1.0.0.Alpha3-SNAPSHOT</version.io.undertow.jastow>
         <version.javax.activation>1.1.1</version.javax.activation>
         <version.javax.enterprise>1.1</version.javax.enterprise>
         <version.javax.inject.javax.inject>1</version.javax.inject.javax.inject>
@@ -201,7 +201,7 @@
         <version.org.jboss.remote-naming>1.0.6.Final</version.org.jboss.remote-naming>
         <version.org.jboss.remoting>4.0.0.Beta1</version.org.jboss.remoting>
         <version.org.jboss.remotingjmx.remoting-jmx>2.0.0.Beta1</version.org.jboss.remotingjmx.remoting-jmx
-        <version.org.jboss.resteasy>3.0-beta-4</version.org.jboss.resteasy>
+        <version.org.jboss.resteasy>3.0-rc-1</version.org.jboss.resteasy>
         <version.org.jboss.sasl>1.0.3.Final</version.org.jboss.sasl>
         <version.org.jboss.seam.int>6.0.0.GA</version.org.jboss.seam.int>
         <version.org.jboss.security.jboss-negotiation>2.2.3.Final</version.org.jboss.security.jboss-negotia
@@ -4905,6 +4905,10 @@

{code}

Comment 13 JBoss JIRA Server 2013-05-30 01:44:27 UTC
Aslak Knutsen <aslak> made a comment on jira WFLY-1419

Confirmed fixed by https://github.com/undertow-io/undertow/commit/abe2c9e5db323e886ccbe29d2ab1abb8fb9d189a 

{code}
DEBUG [org.apache.http.wire] >> "GET /51a81fcd-f552-4c04-82cf-dffb9cbb12ae/api/conference/29332d00-61cb-4820-adf5-cacd0df7b50f 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] << "Connection: keep-alive[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Type: application/vnd.ced+xml; type=conference[\r][\n]"
DEBUG [org.apache.http.wire] << "Content-Length: 0[\r][\n]"
{code}

Comment 14 JBoss JIRA Server 2013-06-01 23:18:01 UTC
Stuart Douglas <stuart.w.douglas> updated the status of jira WFLY-1419 to Resolved

Comment 16 Weinan Li 2013-09-02 08:55:33 UTC
Verified that this bug is not fixed in jboss-as-7.3.0-internal-SNAPSHOT (EAP 6.2.0)

Verified that this bug is fixed in wildfly-8.0.0.Beta1-SNAPSHOT