Bug 61681

Summary: UnsupportedOperationException in ApplicationPushBuilder if request is forwarded
Product: Tomcat 9 Reporter: Michael Ernst <chiptv>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: michaelo
Priority: P2    
Version: 9.0.1   
Target Milestone: -----   
Hardware: PC   
OS: All   
Attachments: maven example application with README.md

Description Michael Ernst 2017-10-27 16:26:33 UTC
Created attachment 35473 [details]
maven example application with README.md

If the request is forwarded, it is not possible to create a ApplicationPushBuilder via the request object. I attached an example maven application which could be deployed to Tomcat 9.0.1 with enabled HTTP/2 support.

Stack:
```
java.lang.UnsupportedOperationException: Unable to find the underlying Coyote request object (which is required to create a push request) from the request of type [org.apache.catalina.connector.RequestFacade]
	org.example.PushFilter.doFilter(PushFilter.java:26)
	org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
	org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
	org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
	org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
```
Comment 1 Remy Maucherat 2017-11-02 16:04:51 UTC
It is pretty obvious in the code why it will not work (ApplicationHttpRequest.newPushBuilder uses this to create the push builder, not good), no test case needed here. However, even though I know how to fix it, I don't know yet how to do so without opening up holes or other problems.
Comment 2 Remy Maucherat 2017-11-03 14:31:56 UTC
This should be fixed in 9.0.2.