updated export
This commit is contained in:
parent
3fa182d803
commit
f9f1f3bf1f
|
@ -147,11 +147,14 @@ public class GeoportalExporter {
|
||||||
try {
|
try {
|
||||||
LOG.info("Serving request as getAsURL...");
|
LOG.info("Serving request as getAsURL...");
|
||||||
FileReference pdfRef = exportAsPDF(req, ucdID, projectID, null, context, user);
|
FileReference pdfRef = exportAsPDF(req, ucdID, projectID, null, context, user);
|
||||||
return Response.ok(pdfRef.getStorageVolatileURL().toURI()).build();
|
String theURL = pdfRef.getStorageVolatileURL().toString();
|
||||||
} catch (URISyntaxException e) {
|
LOG.info("returning URL {}", theURL);
|
||||||
|
return Response.ok(theURL).build();
|
||||||
|
} catch (Exception e) {
|
||||||
LOG.error("Error on performing export by url", e);
|
LOG.error("Error on performing export by url", e);
|
||||||
throw ExceptionManager.internalErrorException(req,
|
throw ExceptionManager.internalErrorException(req,
|
||||||
"Sorry, error occurred when generating the project URL", this.getClass(), helpURI);
|
"Sorry, error occurred when generating the project URL. Error is: " + e.getMessage(),
|
||||||
|
this.getClass(), helpURI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +188,7 @@ public class GeoportalExporter {
|
||||||
String entity = HTML_Page.entityHTMLMessage("Exporting as PDF...",
|
String entity = HTML_Page.entityHTMLMessage("Exporting as PDF...",
|
||||||
"The project with id: " + projectID, true, serviceViewPDF_URL);
|
"The project with id: " + projectID, true, serviceViewPDF_URL);
|
||||||
|
|
||||||
|
LOG.info("returning waiting HTML page");
|
||||||
return Response.ok(entity).encoding("UTF-8").header(ConstantsResolver.CONTENT_TYPE, "text/html")
|
return Response.ok(entity).encoding("UTF-8").header(ConstantsResolver.CONTENT_TYPE, "text/html")
|
||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +197,7 @@ public class GeoportalExporter {
|
||||||
// returning as stream
|
// returning as stream
|
||||||
InputStream input = pdfRef.getStorageVolatileURL().openStream();
|
InputStream input = pdfRef.getStorageVolatileURL().openStream();
|
||||||
StreamingOutput so = new SingleFileStreamingOutput(input);
|
StreamingOutput so = new SingleFileStreamingOutput(input);
|
||||||
|
LOG.info("returning project streaming...");
|
||||||
return Response.ok(so)
|
return Response.ok(so)
|
||||||
.header(ConstantsResolver.CONTENT_DISPOSITION,
|
.header(ConstantsResolver.CONTENT_DISPOSITION,
|
||||||
"inline; filename=\"" + pdfRef.getFileName() + "\"")
|
"inline; filename=\"" + pdfRef.getFileName() + "\"")
|
||||||
|
|
Loading…
Reference in New Issue