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

  • Home
  • SEARCH
  • 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 6006823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:35:41+00:00 2026-05-23T01:35:41+00:00

Hi I am following the code from this link: Capture and log the response

  • 0

Hi I am following the code from this link: Capture and log the response body

However the server return error 503 which is really weird?

This is my code:

        final CopyPrintWriter writer = new CopyPrintWriter(servletresponse.getWriter());
        chain.doFilter(servletrequest, new MyResponseWrapper( 
                (HttpServletResponse) servletresponse){
                @Override
                public PrintWriter getWriter() {
                    return writer;
                }

        });
        log.debug("Test - " + writer.getCopy());
        writer.close();

Inside the filter class I added some logging:

12:03:22,404         INFO MyFilter:43 - Before invoking chain
12:03:24,107        DEBUG MyFilter:59 - Test - 
12:03:24,108         INFO MyFilter:73 - After invoking chain

The client side receives HTTP error 503 from this code. And also from the log writer.getCopy() returns an empty string? What could be the reason?

EDIT: Removing the CopyPrintWriter related codes and not overriding getWriter(), the server returns OK with html.

  • 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-05-23T01:35:42+00:00Added an answer on May 23, 2026 at 1:35 am

    Could be because you are creating a writer , whereas the servlet invocation after filter invocation is writing the content to stream by getting it from HttpServletResponse.getOutputStream().

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

Sidebar

Related Questions

I'm using following code but cannot return data from MySQL. This is the output:
I've used the following code from this link. Getting signals from a MIDI port
I have found the following code from this link: iphone - How to draw
Hi I found the following code from this page JQuery UI DatePicker using 2
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
I have the following piece of code from a book. There is this function
I am using the following code to generate excel from sql through php.this is
I am using following code to get bitmap from url. This function is used
Is this possible to do the following in ExpressionEngine: (code taken from here )
This is from project Euler, problem 2. I wrote the following seemingly innocent code:

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.