Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -793,9 +793,8 @@ public class EmsController {
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_EMAIL_CONTENT, method = RequestMethod.GET)
|
||||
public byte[] downloadStbEmailContent(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam Integer idEmail) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadStbEmailContent(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam Integer idEmail) throws Exception {
|
||||
StbEmailContent stbEmailContent = new StbEmailContent();
|
||||
stbEmailContent.setIdEmail(idEmail);
|
||||
stbEmailContent.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -803,11 +802,7 @@ public class EmsController {
|
||||
stbEmailContent = entityProcessor.processEntity(stbEmailContent, multiDBTransactionManager);
|
||||
|
||||
if (stbEmailContent != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename("email.eml").build().toString());
|
||||
|
||||
byte[] byteArr = null;
|
||||
byte[] byteArr;
|
||||
|
||||
String pattern = "[^\\x00-\\x7F]";
|
||||
Pattern pat = Pattern.compile(pattern);
|
||||
@@ -819,13 +814,18 @@ public class EmsController {
|
||||
byteArr = Base64.decodeBase64(stbEmailContent.getEmailContent());
|
||||
}
|
||||
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename("email.eml")
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
|
||||
@@ -884,12 +884,13 @@ public class EmsController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_ORD_PDF, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbOrdPdf(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String gestione,
|
||||
@RequestParam String dataOrd,
|
||||
@RequestParam Integer numOrd,
|
||||
@RequestParam Integer versione) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbOrdPdf(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String gestione,
|
||||
@RequestParam String dataOrd,
|
||||
@RequestParam Integer numOrd,
|
||||
@RequestParam Integer versione) throws Exception {
|
||||
|
||||
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
|
||||
dtbOrdPdf.setGestione(gestione);
|
||||
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd));
|
||||
@@ -900,17 +901,20 @@ public class EmsController {
|
||||
dtbOrdPdf = entityProcessor.processEntity(dtbOrdPdf, multiDBTransactionManager);
|
||||
|
||||
if (dtbOrdPdf != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString());
|
||||
|
||||
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.POST)
|
||||
|
||||
@@ -26,6 +26,10 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -303,35 +307,28 @@ public class EmsEngineController {
|
||||
return ServiceRestResponse.createPositiveResponse(orientations);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_JTB_DISEGNI_FILES, method = RequestMethod.GET, produces = "application/octet-stream")
|
||||
public byte[] downloadJtbDisegniFiles(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String codDisegno,
|
||||
@RequestParam String fileName
|
||||
) throws IOException {
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_JTB_DISEGNI_FILES, method = RequestMethod.GET)
|
||||
public ResponseEntity<byte[]> downloadJtbDisegniFiles(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String codDisegno,
|
||||
@RequestParam String fileName
|
||||
) throws Exception {
|
||||
JtbDisegniFiles jtbDisegniFiles = emsEngineService.downloadJtbDisegniFiles(codDisegno, fileName);
|
||||
|
||||
try {
|
||||
|
||||
JtbDisegniFiles jtbDisegniFiles = emsEngineService.downloadJtbDisegniFiles(codDisegno, fileName);
|
||||
if (jtbDisegniFiles == null) {
|
||||
throw new Exception("Disegno non trovato!");
|
||||
}
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
|
||||
byte[] byteArr = Base64.decodeBase64(jtbDisegniFiles.getContent());
|
||||
String z = new String(byteArr, StandardCharsets.UTF_8);
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
} catch (Exception e) {
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
if (jtbDisegniFiles == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
byte[] byteArr = Base64.decodeBase64(jtbDisegniFiles.getContent());
|
||||
|
||||
return null;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(fileName)
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,6 +50,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
@@ -321,7 +323,7 @@ public class DocumentController {
|
||||
@RequestMapping(value = "generaCorrispettivi", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse generaCorrispettivi(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
List<EntityBase> entityList = generaCorrispettivi.generaCorrispettivi();
|
||||
return ServiceRestResponse.createEntityPositiveResponse(entityList);
|
||||
}
|
||||
@@ -528,9 +530,9 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_XML_FILECONTENT, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbDocXmlFileContent(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbDocXmlFileContent(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
DtbDocXml dtbDocXml = new DtbDocXml();
|
||||
dtbDocXml.setProgSdi(progSdi);
|
||||
dtbDocXml.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -538,18 +540,20 @@ public class DocumentController {
|
||||
dtbDocXml = entityProcessor.processEntity(dtbDocXml, multiDBTransactionManager);
|
||||
|
||||
if (dtbDocXml != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + dtbDocXml.getFilename() + "\"");
|
||||
|
||||
byte[] byteArr = Base64.decodeBase64(dtbDocXml.getFilecontent());
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
|
||||
return byteArr;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(dtbDocXml.getFilename())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_DTB_DOC_XML_FILECONTENT_PDF_NAME, method = RequestMethod.GET)
|
||||
@@ -577,18 +581,16 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_XML_FILECONTENT_PDF, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbDocXmlFileContentPdf(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbDocXmlFileContentPdf(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
|
||||
DtbDocXml dtbDocXml = new DtbDocXml();
|
||||
dtbDocXml.setProgSdi(progSdi);
|
||||
dtbDocXml.setOperation(OperationType.SELECT_OBJECT);
|
||||
dtbDocXml = entityProcessor.processEntity(dtbDocXml, multiDBTransactionManager);
|
||||
|
||||
if (dtbDocXml != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + dtbDocXml.getFileNamePdf() + "\"");
|
||||
|
||||
FpxToPdfDTO.FpxToPdfFile fpxToPdfFile = new FpxToPdfDTO.FpxToPdfFile();
|
||||
fpxToPdfFile.setFileContentBytes(Base64.decodeBase64(dtbDocXml.getFilecontent()));
|
||||
@@ -607,19 +609,25 @@ public class DocumentController {
|
||||
byteArr = resultFpxFiles.get(0).getFileContentBytes();
|
||||
}
|
||||
|
||||
//byte[] byteArr = Base64.decodeBase64(dtbDocXml.getFileContentPdf());
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(dtbDocXml.getFileNamePdf())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_XML_PDF_ESITO, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbDocXmlPdfEsito(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbDocXmlPdfEsito(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
|
||||
DtbDocXml dtbDocXml = new DtbDocXml();
|
||||
dtbDocXml.setProgSdi(progSdi);
|
||||
dtbDocXml.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -627,23 +635,27 @@ public class DocumentController {
|
||||
dtbDocXml = entityProcessor.processEntity(dtbDocXml, multiDBTransactionManager);
|
||||
|
||||
if (dtbDocXml != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"esito.pdf\"");
|
||||
|
||||
byte[] byteArr = Base64.decodeBase64(dtbDocXml.getPdfEsito());
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(dtbDocXml.getFilename())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_XML_ESITO, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbDocXmlEsito(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbDocXmlEsito(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String progSdi) throws Exception {
|
||||
|
||||
DtbDocXml dtbDocXml = new DtbDocXml();
|
||||
dtbDocXml.setProgSdi(progSdi);
|
||||
dtbDocXml.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -651,17 +663,20 @@ public class DocumentController {
|
||||
dtbDocXml = entityProcessor.processEntity(dtbDocXml, multiDBTransactionManager);
|
||||
|
||||
if (dtbDocXml != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"esito.xml\"");
|
||||
|
||||
byte[] byteArr = Base64.decodeBase64(dtbDocXml.getXmlEsito());
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_XML)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename("esito.xml")
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -690,36 +705,34 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_ACTIVITY_FILE_ATTACHMENT, method = RequestMethod.GET)
|
||||
public byte[] downloadStbActivityFileAttachment(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String id,
|
||||
@RequestParam String fileName,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) {
|
||||
public ResponseEntity<byte[]> downloadStbActivityFileAttachment(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String id,
|
||||
@RequestParam String fileName,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
StbActivityFile stbActivityFile = new StbActivityFile()
|
||||
.setId(id)
|
||||
.setFileName(fileName);
|
||||
stbActivityFile.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
try {
|
||||
StbActivityFile stbActivityFile = new StbActivityFile()
|
||||
.setId(id)
|
||||
.setFileName(fileName);
|
||||
stbActivityFile.setOperation(OperationType.SELECT_OBJECT);
|
||||
stbActivityFile = entityProcessor.processEntity(stbActivityFile, multiDBTransactionManager);
|
||||
|
||||
stbActivityFile = entityProcessor.processEntity(stbActivityFile, multiDBTransactionManager);
|
||||
if (stbActivityFile != null) {
|
||||
byte[] byteArr = requestThumbnail && stbActivityFile.getThumbnail() != null ? stbActivityFile.getThumbnail() : stbActivityFile.getContent();
|
||||
|
||||
if (stbActivityFile != null) {
|
||||
byte[] byteArr = requestThumbnail && stbActivityFile.getThumbnail() != null ? stbActivityFile.getThumbnail() : stbActivityFile.getContent();
|
||||
MediaType mediaType = mimetypesFileTypeMap.getContentType(stbActivityFile.getFileName());
|
||||
|
||||
response.setContentType(mimetypesFileTypeMap.getContentType(stbActivityFile.getFileName()).toString());
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + stbActivityFile.getFileName() + "\"");
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return null;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(mediaType)
|
||||
.contentLength(byteArr.length)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(stbActivityFile.getFileName())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_ACTIVITY_FILE_ATTACHMENT + "/{id}/{fileName}", method = RequestMethod.GET)
|
||||
@@ -761,9 +774,9 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/downloadPdfMinisterialeActive", method = RequestMethod.GET)
|
||||
public byte[] downloadPdfMinisterialeFromProgSDI(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam String progSdi,
|
||||
@RequestParam String type) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadPdfMinisterialeFromProgSDI(
|
||||
@RequestParam String progSdi,
|
||||
@RequestParam String type) throws Exception {
|
||||
|
||||
FpxPDFTypeEnum fpxPDFType = FpxPDFTypeEnum.fromString(type);
|
||||
|
||||
@@ -773,18 +786,21 @@ public class DocumentController {
|
||||
dtbDocXml = entityProcessor.processEntity(dtbDocXml, multiDBTransactionManager);
|
||||
|
||||
if (dtbDocXml != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + dtbDocXml.getFileNamePdf() + "\"");
|
||||
|
||||
byte[] fileContentPdf = documentService.generateFpxPDFMinisteriale(fpxPDFType, dtbDocXml.getFilename(), Base64.decodeBase64(dtbDocXml.getFilecontent()));
|
||||
|
||||
response.setContentLength(fileContentPdf != null ? fileContentPdf.length : 0);
|
||||
return fileContentPdf;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(fileContentPdf != null ? fileContentPdf.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(dtbDocXml.getFilename())
|
||||
.build()
|
||||
.toString())
|
||||
.body(fileContentPdf);
|
||||
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -833,9 +849,9 @@ public class DocumentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "/downloadPdfMinisteriale", method = RequestMethod.GET)
|
||||
public byte[] downloadPdfMinisteriale(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam String idAttach,
|
||||
@RequestParam String type) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadPdfMinisteriale(
|
||||
@RequestParam String idAttach,
|
||||
@RequestParam String type) throws Exception {
|
||||
|
||||
FpxPDFTypeEnum fpxPDFType = FpxPDFTypeEnum.fromString(type);
|
||||
|
||||
@@ -856,18 +872,21 @@ public class DocumentController {
|
||||
|
||||
stbFilesAttached = entityProcessor.processEntity(stbFilesAttached, multiDBTransactionManager);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
|
||||
if (stbFilesAttached != null) {
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + stbFilesAttached.getFileName() + "\"");
|
||||
|
||||
byte[] fileContentPdf = documentService.generateFpxPDFMinisteriale(fpxPDFType, stbFilesAttached);
|
||||
return fileContentPdf;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(fileContentPdf != null ? fileContentPdf.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(stbFilesAttached.getFileName())
|
||||
.build()
|
||||
.toString())
|
||||
.body(fileContentPdf);
|
||||
}
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_TRASFORMA_PREV, method = RequestMethod.POST)
|
||||
|
||||
Reference in New Issue
Block a user