当前位置: 代码迷 >> Java Web开发 >> linux下request.getInputStream()接收的参数为空,windows下没有这个有关问题,为什么
  详细解决方案

linux下request.getInputStream()接收的参数为空,windows下没有这个有关问题,为什么

热度:950   发布时间:2016-04-17 14:17:15.0
linux下request.getInputStream()接收的参数为空,windows下没有这个问题,为什么?
接收的jsp页面代码如下:

InputStream   in     =   request.getInputStream();
                adcap.setTest( "in: "+in);  
                System.out.println( "in: "+in);
    BufferedReader   br   =   new   BufferedReader(new   InputStreamReader(in));
    adcap.setTest( "br: "+br.toString());                                 //linux   下写入日志文件
    System.out.println( "br: "+br.toString());                       //本机,windows下打印在控制台
    String   str   =   null;
    StringBuffer   sb   =   new   StringBuffer();
    while   ((str   =   br.readLine())   !=   null)   {
      sb.append(str);
      adcap.setTest( "strec1: "+str);  
      System.out.println( "strec1: "+str);
    }  
    adcap.setTest( "strec2: "+sb.toString());                                                         //日志
    System.out.println( "strec2: "+sb.toString());
                temp   =   java.net.URLDecoder.decode(sb.toString(), "utf-8 ");
          strec   =   temp.substring(temp.indexOf( "= ")+1,temp.length());
          adcap.setTest( "strec3: "+strec);                                                                         //日志
          System.out.println( "strec3: "+strec);  
          System.out.println( "bossinter.jsp   strec: "+strec);  

 

在本机(windows)下测试,能正确接收到参数

控制台打印如下:

in:org.apache.coyote.tomcat5.CoyoteInputStream@15b6aad
br:java.io.BufferedReader@114ef62
strec1:%24xml=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0D%0A%3CProvBOSS%3E%0D%0A++++%3CBIPCode%3EBIP4B726%3C%2FBIPCode%3E%0D%0A++++%3CBIPVer%3E0100%3C%2FBIPVer%3E%0D%0A++++%3CActivityCode%3ET4101702%3C%2FActivityCode%3E%0D%0A++++%3CActionCode%3E0%3C%2FActionCode%3E%0D%0A++++%3CProcID%3E2007031410393700001855%3C%2FProcID%3E%0D%0A++++%3CTransIDO%3E2007031410393700018678%3C%2FTransIDO%3E%0D%0A++++%3CProcessTime%3E20070314103937%3C%2FProcessTime%3E%0D%0A++++%3CTestFlag%3E0%3C%2FTestFlag%3E%0D%0A++++%3CMsgSender%3E7311%3C%2FMsgSender%3E%0D%0A++++%3CMsgReceiver%3E7310%3C%2FMsgReceiver%3E%0D%0A++++%3CSvcConVer%3E0100%3C%2FSvcConVer%3E%0D%0A++++%3CSvcCont%3E%3C%21%5BCDATA%5B%3CSyncInfo%3E%0D%0A++++%3CSIBizInfo%3E%0D%0A++++++++%3CSIID%3E631771%3C%2FSIID%3E%0D%0A++++++++%3CSIBaseAccessNo%3E123456782103%3C%2FSIBaseAccessNo%3E%0D%0A++++++++%3CSIName%3Esi%CD%F8%BF%CD1%3C%2FSIName%3E%0D%0A++++++++%3CSITel%3E0253333854%3C%2FSITel%3E%0D%0A++++++++%3CSIOprType%3E01%3C%2FSIOprType%3E%0D%0A++++%3C%2FSIBizInfo%3E%0D%0A%3C%2FSyncInfo%3E%0D%0A%5D%5D%3E%3C%2FSvcCont%3E%0D%0A%3C%2FProvBOSS%3E&sub=%CC%E1%BD%BB
strec2:%24xml=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0D%0A%3CProvBOSS%3E%0D%0A++++%3CBIPCode%3EBIP4B726%3C%2FBIPCode%3E%0D%0A++++%3CBIPVer%3E0100%3C%2FBIPVer%3E%0D%0A++++%3CActivityCode%3ET4101702%3C%2FActivityCode%3E%0D%0A++++%3CActionCode%3E0%3C%2FActionCode%3E%0D%0A++++%3CProcID%3E2007031410393700001855%3C%2FProcID%3E%0D%0A++++%3CTransIDO%3E2007031410393700018678%3C%2FTransIDO%3E%0D%0A++++%3CProcessTime%3E20070314103937%3C%2FProcessTime%3E%0D%0A++++%3CTestFlag%3E0%3C%2FTestFlag%3E%0D%0A++++%3CMsgSender%3E7311%3C%2FMsgSender%3E%0D%0A++++%3CMsgReceiver%3E7310%3C%2FMsgReceiver%3E%0D%0A++++%3CSvcConVer%3E0100%3C%2FSvcConVer%3E%0D%0A++++%3CSvcCont%3E%3C%21%5BCDATA%5B%3CSyncInfo%3E%0D%0A++++%3CSIBizInfo%3E%0D%0A++++++++%3CSIID%3E631771%3C%2FSIID%3E%0D%0A++++++++%3CSIBaseAccessNo%3E123456782103%3C%2FSIBaseAccessNo%3E%0D%0A++++++++%3CSIName%3Esi%CD%F8%BF%CD1%3C%2FSIName%3E%0D%0A++++++++%3CSITel%3E0253333854%3C%2FSITel%3E%0D%0A++++++++%3CSIOprType%3E01%3C%2FSIOprType%3E%0D%0A++++%3C%2FSIBizInfo%3E%0D%0A%3C%2FSyncInfo%3E%0D%0A%5D%5D%3E%3C%2FSvcCont%3E%0D%0A%3C%2FProvBOSS%3E&sub=%CC%E1%BD%BB
  相关解决方案