tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fischereit, Jana" <>
Subject AW: Setting the maxHTTPHeaderSize to 'infinity'
Date Tue, 19 Apr 2011 10:42:41 GMT
Thank you for your answer!

First I also thought that they have nothing to do with one another. But when I tried to transfer
a xml-file (size 9kb) it did not work. Afterwards I increased the maxHTTPHeaderSize to 10
kb. So I concluded that the xml-stream is contained in the body of the request-header. 

Here is my java-code I am using to transfer the file to the server:

public static void main(String[] args) {

		OutputStream os = null;
		InputStream is = null;

		try {

			URL url = new URL(args[0]);
			String urlString = url.toString();
			String reportFile = args[1];
			String dataSourceFile = args[2];

			System.out.println("\nURL:  " + args[0]);
			System.out.println("ReportFile:  " + args[1]);
			System.out.println("DataSourceFile: " + args[2]);

			// Prepare HTTP post
			PostMethod post = new PostMethod(urlString);

			File file = new File(dataSourceFile);
			InputStreamRequestEntity requestEntity = new   InputStreamRequestEntity(
					new FileInputStream(dataSourceFile), file.length());

			// Specify content type and encoding
			post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");

			post.addRequestHeader("reportFile=", reportFile);
			post.addRequestHeader("xmlFileSize=", file.length() + "");

			HttpClient httpclient = new HttpClient();

			// Execute request
			try {

				int result = httpclient.executeMethod(post);
				System.out.println("Is post-request sent?: " + post.isRequestSent());

				// Display status code
				System.out.println("Response status code: " + result);

				// Redirect by using a get-method
				URI uri = url.toURI();

			} catch (Exception ex) {
				System.out.println("\nError: " + ex);
			} finally {

		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block

The post.setRequestBody(body) is deprecated and post.setRequestEntity(requestEntity) should
be used instead. I tried the deprecated method as well, but received the same results.

-----Urspr√ľngliche Nachricht-----
Von: André Warnier [] 
Gesendet: Dienstag, 19. April 2011 12:28
An: Tomcat Users List
Betreff: Re: Setting the maxHTTPHeaderSize to 'infinity'

Fischereit, Jana wrote:
> Hi,
> I would like to send xml-files by using the http-post *request-body*. 

(emphasis added)

But I read that the default maxHTTPHeaderSize is 8kb

max HTTP *Header* Size  (emphasis added)

Nothing to do with one another.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message