magicdlf
asked on
HTTP 400 Bad Request returned only when Java Applet connects to webserver
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?Creden tials=rxsi zb2qnbf5of ddt0ki0zh& What=8&Dat aSource=CO NTENT 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!
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?Creden
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;
}
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
ASKER
I have limited access to the client machine at the moment. I will check the log later. Anything else?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or there should be some issue with constructing url
ASKER
arevuri, you are correct! The java code didn't encode the url. What a terrible mistake!
Thank you all for your efforts!
Thank you all for your efforts!