2014-01-16 1 views
0
$scope.$on('fileuploadadd', function(e,data) { 

$http({ 
     method: 'POST', 

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

내가 하나의 간단한 파일 업로드에 대한 위의 코드를 작성 알고 가능하면, 자바 REST 서비스와 통신 blueimp 수 있지만, blueimp로, 내가 내 나머지 서비스와 진행 상황을 관리 할 수 ​​있습니까? 또한 올바른 접근법 위에 있습니까? data.submit 함수가 있다는 것을 알고 있지만 어떻게 서버 측 동작을 호출 할 수 있는지 알 수 없습니다.어떻게

답변

1

Javax RS API를 사용하여 주석을 사용하여 요청 함수를 편안한 함수로 매핑 할 수 있습니다. 그래서 그것은 어떤 Restful Java API를 사용 하느냐에 달려 있습니다.

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"; 
    } 
} 

자바 스크립트 :

$('#fileupload').fileupload({ 
    url: 'http://yourSite/helloworld', 
    type: 'POST', 
    ... 
+0

내 서비스가 어떻게 – merveotesi

+0

@mervellous 내가 편집 내를했습니다 blueimp 행사에 내 서비스를 호출 할 수 있습니다, 문제는, 준비 게시물을 작성하려면 REST 제어기에 따라 URL과 메소드 유형을 추가하면됩니다. – Fractaliste

+0

너무 쉽게? 고마워. – merveotesi