JRPRINT Output format throws a 404 using REST


I am quite new to Jasper server, so am struggling with a very basic problem here:

I am able to fetch the list of resources under a folder from the repository and then make a PUT request to get a report. Once I get the UUID of the report, I make a GET request to run the report and get the output. However, that throws a 404 to me. Please see the code and my logs below:



My logs show:



URI HERE IS:http://host1:8080/jasperserver-pro/rest/report/Test/SingleChart?RUN_OUTPUT_FORMAT=JRPRINT

Response status line:HTTP/1.1 201 Created

SS - Get the RDs: <report>






<file type="application/octet-stream"><![CDATA[jasperPrint]]></file>





sending Request. url: http://host1:8080/jasperserver-pro/rest/report/158abadc-db7c-4d3b-b2ab-42ffcc83e304?file=report req verb: GET

response status line: HTTP/1.1 404 Not Found


Download failed: HTTP/1.1 404 Not Found


Can someone help me figure out what I'm doing wrong?




httpReq = new HttpPut();
reqEntity.setContent(new ByteArrayInputStream(requestXml.getBytes()));
reqEntity.setContent(new ByteArrayInputStream(requestXml.getBytes()));
((HttpEntityEnclosingRequestBase) httpReq).setEntity(reqEntity);
URI uri = createURI("/report/Test/SingleChart?RUN_OUTPUT_FORMAT=JRPRINT", null, false);			
httpRes = httpClient.execute(httpReq, httpContext);
System.out.println("Response status line:"+httpRes.getStatusLine());
String responseReportRD = EntityUtils.toString(httpRes.getEntity());
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = domFactory.newDocumentBuilder();
StringReader sr = new StringReader(responseReportRD);
InputSource is = new InputSource(sr);
Document xmlDoc = builder.parse(is);
//Extracting the report's UUID
NodeList nodes = xmlDoc.getElementsByTagName("uuid");
String reportUuid = nodes.item(0).getTextContent();
//Setting GET request to download the report
String reportFileURL = "http://host1:8080/jasperserver-pro/rest/report/"+reportUuid+"?file=report";
httpReq = new HttpGet();
httpRes = sendRequest(httpReq, "/report/"+reportUuid+"?file=report");
//Send GET request to download the report

Post Edited by javafreak at 06/14/2012 18:58

Post Edited by javafreak at 06/14/2012 19:18
javafreak's picture
Joined: May 9 2012 - 12:00pm
Last seen: 11 years 4 months ago

1 Answer:

Found the issue...I am using file=report instead of file=jasperPrint. It works fine when I set the parameter file as jasperPrint.
javafreak's picture
Joined: May 9 2012 - 12:00pm
Last seen: 11 years 4 months ago