Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-21

Issue in request.getInputStream() in jboss

    XMLWordPrintable

Details

    • High

    Description

      It is a strange issue
      MyClient Application

      String data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
      "<PreferenceXMLRequest>" +
      "<ApiName>getAppComponentPreferenceGroupMapping</ApiName>" +
      "<PreferenceInData>" +
      "<AppCode>RL</AppCode>" +
      "</PreferenceInData>" +
      "</PreferenceXMLRequest>";
      StringBuilder objBuilder = new StringBuilder("");
      try
      {
      System.out.println("Input XML :\n" + data);
      //URL url = new URL("http://"+ SERVER_NAME + "/preference-web-" + PreferenceServiceVersion.LOCAL_VERSION + "/preference");
      URL url = new URL("http://localhost:8080/Game/Playhere?tokenid=TEST01ST");
      URLConnection conn = url.openConnection();
      conn.setDoOutput(true);
      data = URLEncoder.encode(data, "UTF-8");
      BufferedWriter out = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
      out.write(data);
      out.flush();
      out.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      String response;
      System.out.println("\nOutput XML :");
      while ((response = in.readLine()) != null)

      { //response = URLDecoder.decode(response, "UTF-8"); //<Label>% Difference</Label> objBuilder.append(response); System.out.println(response); }

      in.close();
      }

      <b>Servlet : Playhere.java</b>

      dopost method

      InputStream in = null;
      String inputXml = "";
      boolean isUrnPresent = false;
      try
      {

      String userToken = request.getParameter("tokenid");
      in = request.getInputStream();
      .......................

      here is what is happening:

      in Playhere.java, if userToken = request.getParameter("tokenid")is placed above the assignment of "in" variable (the way it is happening in the shown snippet), then request.getInputStream returns null in JBoss and tomcat. while, in WebLogic, it returns the stream.

      if "in" variable is assigned the stream before the assignment of "UserToken" variable, then it works perfect!

      Can anyone pls explain the issue ?

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            b.sourabh26 Sourabh Jain (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified