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 6080793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:06:07+00:00 2026-05-23T11:06:07+00:00

How can I make a java-based application server reply with an empty-valued response header,

  • 0

How can I make a java-based application server reply with an empty-valued response header, like this?

content-length:\r\n

Unfortunately when I call

response.setHeader("Content-Length", len)

where len is either an empty string or null, the response will not include the header.

I’ve checked the HttpServletResponse and HttpServletResponseWrapper javadocs but couldn’t figure out what could be overriden to provide my custom behaviour.

Background

I’m building a testing application that is supposed to emulate badly-behaved HTTP server scenarios. The application is supposed to reply to requests with preset pages and HTTP headers, including malformed ones like the above case.
The application is written in grails.

  • 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-23T11:06:08+00:00Added an answer on May 23, 2026 at 11:06 am

    I’m building a testing application that is supposed to emulate badly-behaved HTTP server scenarios.

    In such a case, attempting to get a well-behaving server to mimic such behavior is a bad idea. If you need to mimic a bad server, or a particular set of scenarios you wish to test, then you may do one of the following:

    • write a custom application that listens on a particular port (using the ServerSocket class) that will respond with malformed HTTP headers. Using HTTP libraries may not help, for libraries may have code to detect erroneous conditions and correct them automatically.
    • use a HTTP proxy that is capable of intercepting responses and allows for modifications of these responses. You will find several if you Google for “http debugging proxy”, but if you haven’t heard of any, I would suggest looking at Fiddler, WebScarab or Burp.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make this java generic cast ? public interface IField { }
I'm developing a semantic-based search application in java. To make the application modular, I
I'd like to implement a simple bitmap font drawing in Java AWT-based application. Application
how can i make java program working with multiple languages (frensh, english , arabic
I want to know how I can make a Java program where an unknown
How can i make my Java Swing GUI Components [Right To Left] for Arabic
I wanted to make Map of Collections in Java, so I can make something
In Java, how can you make an ArrayList read-only (so that no one can
I want to make searching on my database with hibernate in Java, how can
I have a Spring framework based Java web application, which has been built in

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.