jquery Upload Plugin uploadify error HTTP Error 302 workaround one of the workarounds

Source: Internet
Author: User

When the jquery upload plugin uploadify was used in the previous period, there was always an error 302 the System reporting HTTP error.

On-line collection of information, basically, the session value is lost , according to the solution provided by users to modify, the problem is not resolved.

So, not to rule out that this is one of the workarounds for solving the 302 error, but I'm going to come up with another solution that takes into account the problem of asynchronous transmission for your reference (I succeeded anyway).

the first is uploadify initialization :

$ (function () {
$ (' #projectfile '). Uploadify ({
' swf ': ' ${ctxstatic}/scripts/jqext/uploadify/uploadify.swf ',
' Uploader ': ' ${ctx}/utmmanager/utm/insert ',

The scenario for the session is to add the value of this uploader: jsessionid=${pagecontext.session.id},

' auto ': true, and add one line ' FormData ': {' jsessionid ': ' ${pagecontext.session.id} '},
' ButtonText ': ' Import ',
' Multi ': false,
' Fileobjname ': ' File ',
' method ': ' Post ',
' Onuploadsuccess ': function (file,data,response) {
var json_data=eval ("(" +data+ ")");
Alert ("<br> successfully imported entries:" +json_data.successlen+ "<br> failed import entry number://The JSON data needs to be returned here,

"+json_data.errorlen+" <br> Import failed entry:<br> "+json_data.errordata); is not a jump path. See below for more detailed analysis.
},
' Onuploaderror ': function () {
Alert ("failure");
}
});
});

Next is the Controller method:

Need to add @responsebody

@responsebody indicates that the return result of the method is written directly to the HTTP response body, which is generally used when fetching data asynchronously.

After using @requestmapping, the return value is usually resolved to a jump path , and the returned result is not resolved to a jump path after the @responsebody is added.

Instead, it is written directly to the HTTP response body. For example, asynchronously fetching JSON data, plus @responsebody, will return the JSON data directly.

function:

The annotation is used to convert the object returned by the controller's method to the specified format by the appropriate httpmessageconverter.

Writes to the body data area of the response object.

Time:

The returned data is not a page of HTML tags, but is used in some other form of data (JSON, XML, etc.);

Chocoo

2016.4.18

----------------------------------------------------------------------------------------------------------- -------------------------------------

jquery Upload Plugin uploadify error HTTP Error 302 workaround one of the workarounds

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.