This discussion is archived
1 Reply Latest reply: Apr 2, 2012 10:12 PM by 164415 RSS

sending over 2048 bytes data to Weblogic using HttpConnection

927650 Newbie
Currently Being Moderated
Hi all,
I cannot send over 2048 bytes from applet to servlet in Weblogic (version 8.1, jdk 1.4). If I send to servlet in Tomcat server (jdk 1.6), it works fine.

URL servleturl = new URL(servlet);
HttpURLConnection servletconnection = (HttpURLConnection) servleturl.openConnection();
servletconnection.setDoInput(true);
servletconnection.setDoOutput(true);
servletconnection.setRequestProperty("Content-Type", "application/octet-stream");
servletconnection.setRequestProperty("Content-Length",Integer.toString(stream.toByteArray().length));
servletconnection.setRequestMethod("POST");
BufferedOutputStream out = new BufferedOutputStream(servletconnection.getOutputStream());

byte buf[] = new byte[2000];
while ((bytesread = in.read(buf)) > -1) {
out.write(buf, 0, bytesread);
}

out.flush();
out.close();
int code=servletconnection.getResponseCode();

BufferedReader bufferIn = new BufferedReader(new InputStreamReader(
servletconnection.getInputStream()));
String inputLine;
while ((inputLine = bufferIn.readLine()) != null)
System.out.println(inputLine);
in.close();


java.io.IOException: Server returned HTTP response code: 500 for URL: http://xxxx:8081/servlet/TC/SigningServlet

I don't know why ? Please help me!
Thanks and Best Regards,
  • 1. Re: sending over 2048 bytes data to Weblogic using HttpConnection
    164415 Oracle ACE
    Currently Being Moderated
    WebLogic has an option to configure DoS attack prevention with POST:

    http://docs.oracle.com/cd/E13222_01/wls/docs81/adminguide/web_server.html#100466

    You don't seem to be getting the documented response code:

    An HTTP error code 413 (Request Entity Too Large) is sent back to the client.

    So perhaps not. But still worth checking to see if those are set?

    Can I also ask why 8.1? That's very old now, perhaps try a later release if possible.

    -steve-

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points