1 Reply Latest reply: Apr 3, 2012 12:12 AM by Steve Button-Oracle RSS

    sending over 2048 bytes data to Weblogic using HttpConnection

    927650
      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
          Steve Button-Oracle
          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-