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

Sam Peters commented on WICKET-7071:
------------------------------------

Thank you for debugging! I added some debugging on the quickstart, see update 
in 
[https://github.com/gluser1357/jerseyissues/tree/wicket-issue-7071-quickstart]. 
When I run Start.java, press the link with getInputStream(), followed by the 
the link without, I get the output below. Its obvious that all form parameters 
retrieved by getParameterMap() are missing if getInputStream() has been called 
before (query parameters are not affected). I agree that the spec does not 
explain this behaviour.

Workarounds would be to a) not calling getInputStream() in all preceeding 
filters before WicketFilter starts (in my case it's Jersey wo does that even if 
no data is read), or b) make Wicket check if getInputStream() has data, and if 
it's the case, read and parse the form params from the stream instead using the 
Servlet getParameter() API. But, the cleanest solution for me would be, as you 
said, to fix this issue in Jetty and Tomcat, or at least say something about 
this behaviour in the Servlet docs you mentioned. If I find the time I'll try 
to open appropriate tickets.

=== OUTPUT ===
{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - {color}

{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - QueryString: 
0-1.0-mainMenu-form-rowPanel-addRowWith{color}

{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - Content-Type: 
application/x-www-form-urlencoded; charset=UTF-8{color}

{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - Content-Length: 
55{color}

{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - Call 
getInputStream(){color}

{color:#172b4d}[qtp94345706-21] INFO gluser1357.FirstFilter - Call 
getParameterMap(){color}

{color:#00875a}[qtp94345706-21] INFO gluser1357.FirstFilter - Parameter count: 
1{color}

{color:#00875a}[qtp94345706-21] INFO gluser1357.FirstFilter - 
0-1.0-mainMenu-form-rowPanel-addRowWith=[Ljava.lang.String;@fed9457{color}

{color:#172b4d}[qtp94345706-22] INFO gluser1357.FirstFilter - {color}

{color:#172b4d}[qtp94345706-22] INFO gluser1357.FirstFilter - QueryString: 
0-1.0-mainMenu-form-rowPanel-addRow____{color}

{color:#172b4d}[qtp94345706-22] INFO gluser1357.FirstFilter - Content-Type: 
application/x-www-form-urlencoded; charset=UTF-8{color}

{color:#172b4d}[qtp94345706-22] INFO gluser1357.FirstFilter - Content-Length: 
55{color}

{color:#172b4d}[qtp94345706-22] INFO gluser1357.FirstFilter - Call 
getParameterMap(){color}

{color:#ff0000}[qtp94345706-22] INFO gluser1357.FirstFilter - Parameter count: 
3{color}

{color:#ff0000}[qtp94345706-22] INFO gluser1357.FirstFilter - 
0-1.0-mainMenu-form-rowPanel-addRow____=[Ljava.lang.String;@439c0485{color}

{color:#ff0000}[qtp94345706-22] INFO gluser1357.FirstFilter - 
rowPanel:rows:0:text=[Ljava.lang.String;@349efca6{color}

{color:#ff0000}[qtp94345706-22] INFO gluser1357.FirstFilter - 
rowPanel:addRow____=[Ljava.lang.String;@653a62ef{color}

 

> Problems when calling request.getInputStream() before executing WicketFilter
> ----------------------------------------------------------------------------
>
>                 Key: WICKET-7071
>                 URL: https://issues.apache.org/jira/browse/WICKET-7071
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 10.0.0-M1, 9.14.0
>         Environment: Java 17 or 21-ea; Jetty 11 or Tomcat 10.1.x; Wicket 
> 10.0.0-M1 or 9.3+.
>            Reporter: Sam Peters
>            Priority: Major
>             Fix For: 9.15.0, 10.0.0-M2
>
>         Attachments: wicket-7071-first-getInputStream.png, 
> wicket-7071-getParameters.png
>
>
> Calling request.getInputStream() (without reading any data from the stream), 
> followed by a WicketFilter, causes certain wicket requests to fail.
> If no call to request.getInputStream() is made, everything works as expected.
> See runnable, minimal Maven project here: 
> [https://github.com/gluser1357/jerseyissues/tree/issue-4867-wicket10|https://github.com/gluser1357/jerseyissues/tree/issue-4867-wicket10]
>  > readme.txt.
> The issue is always reproducable e. g. in Jetty 11 and Tomcat 10.1.x (Jakarta 
> Servlet 5+).
> A use case for the described filter combination is e. g. to add an existing 
> Jersey-based authorization filter in front of a Wicket application. Since 
> Jersey calls at some point request.getInputStream(), our Wicket application 
> fails at then. See more details on this here: 
> [https://github.com/eclipse-ee4j/jersey/issues/4867|https://github.com/eclipse-ee4j/jersey/issues/4867]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to