Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:40:17+00:00 2026-06-11T06:40:17+00:00

I noticed that in the Netty 4.0.0 alpha releases, an HTTP response object has

  • 0

I noticed that in the Netty 4.0.0 alpha releases, an HTTP response object has a method to to test for chunking (isChunked()). In The 3.5.7.Final release, only the request object has a method to test for chunking. Using 3.5.7.Final how could I go about reading in a chunked response? Code below that I used for a 4.0.0 alpha test:

@Override
public void messageReceived(ChannelHandlerContext context, MessageEvent event) throws Exception {

    try {
        log.trace("Message received");

        if (newMessage) {
            log.trace("New message");
            HttpResponse response = (HttpResponse) event.getMessage();
            log.trace("STATUS: [{}], VERSION [{}]", response.getStatus(), response.getProtocolVersion());

            if (!response.getHeaderNames().isEmpty()) {
                for (String name: response.getHeaderNames()) {
                    for (String value: response.getHeaders(name)) {
                        log.trace("HEADER: [{}] = [{}]", name, value);
                    }
                }
            }
            newMessage = false;
            if (response.isChunked()) {
                requestContentStream = new ByteArrayOutputStream();
                readingChunks = true;
                log.trace("CHUNKED CONTENT {");
                return;
            } else {
                log.trace("Request not chunked");
                writeNonChunkedData(response);
                responseComplete(event);
                return;
            }
        } else if (readingChunks) {
            log.trace("Reading chunks");
            HttpChunk chunk = (HttpChunk) event.getMessage();
            if (chunk.isLast()) {
                log.trace("Read last chunk");
                readingChunks = false;
                writeChunkedData();
                responseComplete(event);
                return;
            } else {
                log.trace("Buffering chunk content to byte buffer");
                requestContentStream.write(chunk.getContent().array());
                return;
            }
        } else {
            log.error("Error handling of MessageEvent, expecting a new message or a chunk from a previous message");
            //setError(context, INTERNAL_SERVER_ERROR);
            super.messageReceived(context, event);
        }
    }catch (Exception ex) {
        log.error("Exception: [{}]", ex);
        //setError(context, INTERNAL_SERVER_ERROR);
        super.messageReceived(context, event);
    }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:40:18+00:00Added an answer on June 11, 2026 at 6:40 am

    HttpResponse.isChunked() also exist in netty 3.5.7. Not sure why you think it doesn’t ..
    See [1] and [2].

    [1] https://github.com/netty/netty/blob/3/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java

    [2] https://github.com/netty/netty/blob/3/src/main/java/org/jboss/netty/handler/codec/http/HttpResponse.java

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that Netty has some internal Concurrent HashMap utilities. I'm curious why Netty
I noticed that every method has comments in the source like: /** * @private
I noticed that DateChooser has the method setFirstDayOfWeek(int) , but since DateChooser does not
I noticed that in Java, you can use a class which has members of
I noticed that when my method runs, nothing is printed to the console: -
I noticed that ColdFusion (version 8 at least) returns the HTTP status code 500
I noticed that the Android Developers Activity section has been updated since I started
I noticed that when a unit test exits, all the threads spawned are automatically
I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but
I noticed that my Designer.vb file of one of my forms has a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.