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

spring-projects-issues opened this issue Jan 4, 2019 · 3 comments
in: web status: invalid


Copy link

@spring-projects-issues spring-projects-issues 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(

Is request forwarding not supported with web-flux?

No further details from SPR-17637

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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.


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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.

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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.

@spring-projects-issues spring-projects-issues added type: bug status: invalid in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web status: invalid
None yet

No branches or pull requests

2 participants