javax.ws.rs.NotFoundException:HTTP 404 Not Found angular 1.5

时间:2018-03-28 15:52:21

标签: java angularjs http web jersey

我有这个客户端角度1.5代码

    var getGroupForUser = function () {
        var deferred = $q.defer();
        $http.get(env.domain+'/Voices/authorize').then(
            function successCallback(response) {


                // self.isAdOps = response.data.;

                deferred.resolve(response.data);

            }, function errorCallback(response) {
                console.log(response.data.errorMsg);
                self.isAdOps = true;
                deferred.reject("data: "+response.data+" code:"+response.status+" "+response.statusText+", please look at the web console");
            });
        return deferred.promise;
    };

和服务器上的这个jersey java代码:

@Path("/Voices")
public class VoicesOperation {

    @Path("/search")
    @GET
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    public List<VoiceUi> search(@QueryParam("q") String searchTerm) throws Exception {...
}


    @Path("/authorize")
    @GET
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    public String authorize() {

        logger.info("in voicesOperation - authorization");
        logger.error("checking error log ==== in voicesOperation - authorization");

然而,我在服务器中遇到错误:

javax.ws.rs.NotFoundException: HTTP 404 Not Found
我错过了什么?

1 个答案:

答案 0 :(得分:0)

只需修改下面的内容,然后尝试: -

public String authorize(@Context UriInfo info) {
    .
    .
 }