خرید بک لینک

Vote count: 0

I have to manage http get response from java spring get request. File downloaded from server is a zip (and inside it a .pdf and .png). This is java code:

@RequestMapping(value="/data/{meetingId}", method = RequestMethod.GET)
public byte[] getMeetingRest(@PathVariable(value="meetingId") String meetingId) {
    byte[] file = new byte[1024];
    Buffer buf =null;
    try {

        String url = getContentServer()+"/data?useame="+getUseame()+"&password="+getPassword()+"&id="+meetingId;
        RestTemplate templ = new RestTemplate();
        file = templ.getForObject(url, byte[].class);

    } catch (Exception e) {
        String msg = "Error retrieving meeting list";
        logger.error(msg, e);
    }
    logger.info("file zip  --> "+file.length);
    retu file;
}

this is agular http.get:

 appControllers.controller('FolderListController', ['$scope', '$routeParams', '$http', '$timeout', '$q', 'global',
                                                   function($scope, $routeParams, $http, $timeout, $q, global){
    console.log("FolderListController");
    var meetingId = $routeParams.meetingId;

    $http.get(CONTEXT_PATH+"/services/data/"+meetingId, {responseType: 'arraybuffer'})
    .success(function(data){
        console.log(data.length);
        console.log(data);
    })
    .error(function(e){
        console.log("Errore chiamate rest data zip   e = "+e);
    });

    //visualizzo i corretti items.
    for(var i=0;i<global.meetings.length;i++){
        console.log("meetingList["+i+"] = "+global.meetings[i]);
        if(global.meetings[i].id == meetingId){
            console.log("trovato id :  id="+global.meetings[i].id+"  --  meetingId  = "+meetingId);
            $scope.items = global.meetings[i];
            break;
        }
    }
}]);

this is output:

undefined controllers.js:108 ArrayBuffer {}.

Some advice guys?

Thanks.

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 16 ارديبهشت 1395 ساعت: 22:50

صفحه بندی