仅在服务器上解析HTTP请求标头时出错,在本地主机上正常工作

时间:2016-08-16 17:28:21

标签: javascript google-chrome spring-mvc tomcat web-applications

我正在尝试获取一些数据并将其作为Excel下载呈现。我通过以下代码执行此操作:

      "ajax": {
      url: $('#url').val(),
      type: "POST",
      data: function (d) {
          //("in data function");

                 if( $('#filter0').val() !=''){
                         d.columns[0]['search']['regex'] = true;
                         d.columns[0]['search']['value'] = $('#filter0').val();
                         $('#pageHeaderL2').html("<button class='myButton' style='cursor:default;' type='button' name='" +  $('#filter0').val() + "'>" + $('#filter0').val() + "</button>");
                         //("set default facility");
                 }
                 if( $('#filter1').val() !=''){
                         d.columns[1]['search']['regex'] = true;
                         d.columns[1]['search']['value'] = $('#filter1').val();
                         $('#pageHeaderL5').html("<button class='myButton' style='cursor:default;' type='button' name='" +  $('#filter0').val() + ":" + $('#filter1').val() + "'>" + $('#filter0').val() + ":" + $('#filter1').val()  + "</button>");
                         //("set default module");
                 }


                 if($('#searchValueIn').val() != "")// depending on if you module search or global search the search string is stored in a different location, this saves the search val in a string
                    var searchVal = $('#searchValueIn').val();
                 else
                    var searchVal = $('#searchValueLocal').val();

         var dd = $.extend({}, d, {
          "originalSearchValue": searchVal
          //"useDefaultFacility": $('#filter0').val() !='' ? true : false,
          //"useDefaultModule": $('#filter1').val() !='' ? true : false,
                    });

         currentTableMeta = dd;

         return dd;
      },
      dataSrc: function(json) {
             for ( var i=0, ien=json.data.length ; i<ien ; i++ ) {
                 json.data[i][0] = '<a href="/message/'+json.data[i][0]+'>View message</a>';
                 }

          if($('#searchValueIn').val() != "")
              var searchVal = $('#searchValueIn').val();
          else
              var searchVal = $('#searchValueLocal').val();

         var hrefExcel= $('#excelurl').val() +'?searchValue='+ searchVal +'&' +  $.param(currentTableMeta) ;
         // debugger;

          if($('#tableExcel').length < 1) {
              $('#partTable_filter').css({left: 10, position:'absolute'});
              $('#partTable_filter').prepend($('<a id="tableExcel" href="' + hrefExcel + '" class="btn" style="float:right; margin-left: 5px;"><i class="icon-table"></i> Excel</a>'));
                /* $('#tableExcel').on("click",function(e) {
                  //var abc = $(currentTableMeta).serialize();
                  var abc = $.param(currentTableMeta);
                  debugger;                });  */
                 // alert("in the IF");
            $('#partTable_processing').before("<br /><br />");
          }else{
            $("#tableExcel").attr('href',hrefExcel);
            //alert("in the else");   
            alert("After the Click");
          }
          tableSortRowObj = $("#sortRowState");


          //("this current sort:" + tableSortRowObj);

          updateFilterFields(json);
          //("to isnert:" + newRowOfFilters);


          return json.data;
      }
  },

如果我使用Chrome或firefox在我的本地tomcat服务器上运行它,这完全有效,但是一旦我将代码部署到我的测试服务器,它就不能使用chrome或IE工作。 Firefox可以下载excel,但它不能通过文件扩展名下载。这是我从服务器得到的错误:

Aug 16, 2016 12:16:20 PM org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header

在我的本地主机上,尝试使用IE运行时出现以下错误。

org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error

0 个答案:

没有答案