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

Get HTTP response body #441

Open
LittaKake opened this issue Nov 13, 2020 · 0 comments
Open

Get HTTP response body #441

LittaKake opened this issue Nov 13, 2020 · 0 comments

Comments

@LittaKake
Copy link

Hi!

I am trying to get the http body of the response.

So far I have under HttpFiltersSourceAdapter added

@Override
 public int getMaximumRequestBufferSizeInBytes() {
        return 1048576;
}

I am able to
System.out.println(httpObject.toString());

But when I try to cast the HttpObject to FullHttpResponse like this ((FullHttpResponse) httpObject).content(); I get an error like below

`Exception in thread "Thread-42" java.lang.ClassCastException: class io.netty.handler.codec.http.DefaultHttpResponse cannot be cast to class io.netty.handler.codec.http.FullHttpResponse (io.netty.handler.codec.http.DefaultHttpResponse and io.netty.handler.codec.http.FullHttpResponse are in module [email protected] of loader 'app')
at sample/sample.HttpResponseHandler.run(HttpResponseHandler.java:18)
at java.base/java.lang.Thread.run(Thread.java:832)

Exception in thread "Thread-43" Exception in thread "Thread-44" java.lang.ClassCastException: class io.netty.handler.codec.http.LastHttpContent$1 cannot be cast to class io.netty.handler.codec.http.FullHttpResponse (io.netty.handler.codec.http.LastHttpContent$1 and io.netty.handler.codec.http.FullHttpResponse are in module [email protected] of loader 'app')
at sample/sample.HttpResponseHandler.run(HttpResponseHandler.java:18)
at java.base/java.lang.Thread.run(Thread.java:832)

java.lang.ClassCastException: class io.netty.handler.codec.http.DefaultHttpContent cannot be cast to class io.netty.handler.codec.http.FullHttpResponse (io.netty.handler.codec.http.DefaultHttpContent and io.netty.handler.codec.http.FullHttpResponse are in module [email protected] of loader 'app')
at sample/sample.HttpResponseHandler.run(HttpResponseHandler.java:18)
at java.base/java.lang.Thread.run(Thread.java:832)

Exception in thread "Thread-45" java.lang.ClassCastException: class io.netty.handler.codec.http.DefaultHttpResponse cannot be cast to class io.netty.handler.codec.http.FullHttpResponse (io.netty.handler.codec.http.DefaultHttpResponse and io.netty.handler.codec.http.FullHttpResponse are in module [email protected] of loader 'app')
at sample/sample.HttpResponseHandler.run(HttpResponseHandler.java:18)
at java.base/java.lang.Thread.run(Thread.java:832)

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant