I make a request like this:
$.ajax({type : 'GET', url : URL_APP_CONSULTA_BOLETO_DIVIDA_ATIVA + url});
I have a java method that returns something like this:
return (Response.ok(output).header("content-disposition", "attachment; filename = " + filename).type( "application/pdf").build());
If we look at http we have the following:
Request URL:http://xxxxx:8080/app/ConsultaDividaAtiva/boleto/100008621/3npm54
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Cookie:JSESSIONID=6EE1049F45C246F7AB91CD196BC6ADF5
Host:localhost:8080
Referer:http://localhost:8080/view-app/EmiteBoletoDividaAtiva.html
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
X-Requested-With:XMLHttpRequest
Response Headersview source
content-disposition:attachment; filename = boleto_20022014115213.pdf
Content-Type:application/pdf
Date:Thu, 20 Feb 2014 14:52:13 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
X-Powered-By:Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0;
The question is: how to display / download the PDF returned by the REST service in java?