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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:09:56+00:00 2026-05-23T18:09:56+00:00

My problem is that getInputStream() hangs when I try to open a stream after

  • 0

My problem is that getInputStream() hangs when I try to open a stream after posting to a server. The server, written in python, gives an error message that leads me to believe that it is not able to parse my query string correctly. Please help me diagnose this problem.

I’m posting to a web server with the following code:

String boundarySolo = "--158211729626281";
String boundary = boundarySolo + "\r\n";
String contentHeader = "Content-Disposition: form-data; name=\"";
URL requestUrl;
URLConnection connection;
String queryString = new String();

try{
    requestUrl = new URL(config.getServerUrl());
    connection = requestUrl.openConnection();
    connection.setReadTimeout(1000);
    connection.setDoOutput(true);
    connection.setDoInput(true);

    connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundarySolo);

. . .

    outStream = new DataOutputStream(connection.getOutputStream());

    System.out.println("Writing bytes...");
    outStream.writeUTF(queryString);
    System.out.println("Bytes written");
    outStream.flush();
    System.out.println("Buffer flushed.");
    outStream.close();
    System.out.println("Stream closed.");

    try{
    inStream = new DataInputStream(connection.getInputStream());
    String buffer;

    System.out.println("Entering the loop.");

    while((buffer = inStream.readLine())!= null)
        System.out.println(buffer);

    System.out.println("Leaving the loop.");

    }
    catch (SocketTimeoutException e) {
    System.out.println("Socket timed out.");
    }

The query string consists of this (with \r\n at the end of each line):

  --158211729626281
  Content-Disposition: form-data; name="view"

  a
  --158211729626281
  Content-Disposition: form-data; name="termdb"

  Saccharomyces_cerevisiae.etd
  --158211729626281
  Content-Disposition: form-data; name="raw_weights"

  blank
  --158211729626281
  Content-Disposition: form-data; name="MAX_FILE_SIZE"

  256
  --158211729626281
  Content-Disposition: form-data; name="cutoff_Evalue"

  0.01
  --158211729626281
  Content-Disposition: form-data; name="min_term_size"

  2
  --158211729626281
  Content-Disposition: form-data; name="effective_tdb_size"

  0
  --158211729626281
  Content-Disposition: form-data; name="stats"

  wsum
  --158211729626281
  Content-Disposition: form-data; name="transform_weights"

  null
  --158211729626281
  Content-Disposition: form-data; name="cutoff_type"

  none
  --158211729626281
  Content-Disposition: form-data; name="output"

  tab
  --158211729626281--
  • 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-23T18:09:57+00:00Added an answer on May 23, 2026 at 6:09 pm

    Try to test your payload with something like http://apikitchen.com/
    and see what is returned.

    The alternative would be to avoid doing this yourself altogether.
    HTTPClient, Jersey Client and Resty (which I’m the author of) solve this problem without you having to dive into the depths of HTTP and mime types.

    Here is a Resty example to get you started:

    import us.monoid.web.Resty;
    import static us.monoid.web.Resty.*;
    
    Resty r = new Resty();
    String result = r.text(config.getServerUrl(), 
           form(data("MAX_FILE_SIZE","256"), 
                data("stats", "wsum"),...etc.etc.).toString();
    

    (Assuming that text/* is being returned by the server)

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

Sidebar

Related Questions

I have written some code in Java that will decode a SHOUTcast stream and
One problem that I come across regularly and yet don't have a solution to
A problem that we need to solve regularly at my workplace is how to
The problem that I am having has to do with the need to keep
A problem that has frequently come up in my career is I have some
Simple problem that I can't figure out... How can I print a '%' character
I have a problem that confuses my users, being that although an item is
This has been a problem that I haven't been able to figure out for
I have the problem that an specific step in Ant can only be executed
I am having the problem that I cannot select a specific XML node which

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.