Home > Software engineering >  what is the difference about ServletServerHttpRequest and ServerHttpRequest
what is the difference about ServletServerHttpRequest and ServerHttpRequest

Time:09-21

I am using reactive spring, now I found the class ServletServerHttpRequest. what the class ServletServerHttpRequest designed for? is it possible to get ServletServerHttpRequest from reactive http request org.springframework.http.server.reactive.ServerHttpRequest?

CodePudding user response:

From ServletServerHttpRequest Javadocs:

Adapt ServerHttpRequest to the Servlet HttpServletRequest.

ServletServerHttpRequest is an implementation of ServerHttpRequest used when reactive application runs on servlet container.

If you are sure, that the actual instance of ServetHttpRequest is ServletServerHttpRequest you can just cast it.

CodePudding user response:

As per the documentation Reactive-Class-Use

public class ServletServerHttpRequest
extends AbstractServerHttpRequest

and relationship between org.springframework.http.server.reactive.ServerHttpRequest is that,

Methods inherited from interface org.springframework.http.server.reactive.ServerHttpRequest is mutate

mutate()

Return a builder to mutate properties of this request by wrapping it with ServerHttpRequestDecorator and returning either mutated values or delegating back to this instance.

  • Related