$scope.$on('fileuploadadd', function(e,data) {

$http({ 
       method: 'POST',

            }).success().error();
}

i know writing above code for single simple file upload, but with blueimp, can i manage progress with my rest service? also is above the right approach? i know there is a data.submit function, but i do not know how can it know to call which server side action.

有帮助吗?

解决方案

You can use annotations to map request method on a restful function according to the Javax RS Api. So it depends of which Restful Java Api you use.

An example from the oracle documentation:

package com.sun.jersey.samples.helloworld.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;

// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class HelloWorldResource {

    // The Java method will process HTTP POST requests
    @POST
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @Produces("text/plain")
    public String getClichedMessage() {
        // Return some cliched textual content
        return "Hello World";
    }
}

The Javascript :

 $('#fileupload').fileupload({
    url: 'http://yourSite/helloworld',
    type: 'POST',
    ...
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top