[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

HTTP 400 Bad Request returned only when Java Applet connects to webserver

Posted on 2009-12-22
5
Medium Priority
?
1,027 Views
Last Modified: 2013-11-21
Experts,

I have a Java applet in my web application for rendering thumbnails. This is always working in most cases. However one of our customer reported that the Applet is not working. They deploy the web application on windows 2008 server. I check the logs and found that when the Java tries to connect to the IIS, I got the following HTTP 400 error:
Data: HTTP/1.1 400 Bad Request\r\nContent-Type: text/html\r\nDate: Thu, 03 Dec 2009 16:17:57 GMT\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<h1>Bad Request</h1>
The url that the Java tried to access to is something like:
Data: GET /App/IrcXmlReq.aspx?Credentials=rxsizb2qnbf5ofddt0ki0zh&What=8&DataSource=CONTENT SERVER

I also tried to visit the url through IE, everything looks OK. I think there's something wrong in the IIS security configuration. Any help or suggestions will be appreciated. Thanks in advance!
private boolean tranSession()
  {
      boolean bRet = false;
      if(sCredentials == null || sTransessionURL == null)
        return false;
      try {
          String tranSessionURLReq = sTransessionURL + "?Credentials=" + sCredentials + "&What=8&DataSource=" + sDataSource;
          URL tranSessionURL = new URL(getCodeBase(), tranSessionURLReq);
          URLConnection con = tranSessionURL.openConnection();
          BufferedInputStream bis = new BufferedInputStream(con.getInputStream());
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          byte[] buf = new byte[BUF_SIZE];
          int bytesRead = 0;
          while ( (bytesRead = bis.read(buf)) != -1) {
            baos.write(buf, 0, bytesRead);
          }
          baos.flush();
          String sRet = baos.toString();
          baos.close();
          bis.close();
          if(sRet.contains("Success") )
            bRet = true;
      }
      catch(Exception e)
      {
      }
      return bRet;
  }

Open in new window

0
Comment
Question by:magicdlf
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Tray896
ID: 26109580
I would check out the httperr log.  That might give you some additional details towards  a resolution.  That log file is located at %windir%\system32\logfiles\httperr
0
 
LVL 9

Author Comment

by:magicdlf
ID: 26110007
I have limited access to the client machine at the moment. I will check the log later. Anything else?
0
 
LVL 6

Accepted Solution

by:
arevuri earned 2000 total points
ID: 26110141
it seems you are directly creating url instead use URLEncoder to construct url. Otherwise replace space with % in CONTENT SERVER. Like CONTENT%SERVER to solve current issue.
0
 
LVL 6

Expert Comment

by:arevuri
ID: 26110144
or there should be some issue with constructing url
0
 
LVL 9

Author Comment

by:magicdlf
ID: 26110298
arevuri, you are correct! The java code didn't encode the url. What a terrible mistake!
Thank you all for your efforts!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
Experts Exchange expands question security options for members.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question