Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request forwarding is not working with ServletHttpHandlerAdapter in servlet 3.1 container [SPR-17637] #22167

Closed
spring-issuemaster opened this issue Jan 4, 2019 · 3 comments
Assignees

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jan 4, 2019

codecracker2014 opened SPR-17637 and commented

I'm trying to write reactive view resolver for apache tiles. Tiles forwards request to jsp and jsp calls 

getOutputStream which can't be called twice as already called in org.springframework.http.server.reactive.ServletServerHttpResponse constructor.
Below is the resulting exception.

java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:624)

Is request forwarding not supported with web-flux?


No further details from SPR-17637

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 5, 2019

codecracker2014 commented

Rossen Stoyanchev i'm able to properly render view with overriding getWriter method of http response

as below :

DataBuffer dataBuffer = this.httpResponse.bufferFactory().allocateBuffer();
DataBuffer dataBuffer = this.httpResponse.bufferFactory().allocateBuffer(); this.dataBuffer=dataBuffer; this.printWriter=new ReactivePrintWriter(dataBuffer.asOutputStream());

 Then returning below from renderInternal method of AbstractUrlBasedView

 

return exchange.getResponse().writeWith(Flux.just(dataBuffer));

Need your help to review this approach.

 

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 5, 2019

Brian Clozel commented

codecracker2014 I've answered your question on StackOverflow - please avoid cross-posting.

As mentioned in that answer, this might be a duplicate of #19106. But taking a step back, I don't think it is possible to implement the support for a templating engine that's tied to the Servlet API. So this might be a non-starter.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 7, 2019

Rossen Stoyanchev commented

As Brian Clozel mentioned on StackOverflow, WebFlux supports Servlet containers but not the Servlet API, and by extension that means no support for JSPs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.