updated logs

This commit is contained in:
Francesco Mangiacrapa 2025-01-22 17:05:56 +01:00
parent 136ca99c24
commit 213e57ad59
1 changed files with 14 additions and 12 deletions

View File

@ -42,8 +42,8 @@ import org.slf4j.LoggerFactory;
/**
* The Class GeoportalExporter.
*
* The Geoportal Exporter provides the facilities to export GIS projects stored in
* the Geoportal system provided via D4Science VREs.
* The Geoportal Exporter provides the facilities to export GIS projects stored
* in the Geoportal system provided via D4Science VREs.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
@ -52,8 +52,10 @@ import org.slf4j.LoggerFactory;
@Path("geoportal")
public class GeoportalExporter {
//This parameter is used for sticky session on load balancer, see #28580
private static final String GEOPORTALEXPORT_PRJ = "geoportalexport_prj";
private static final String HEADER_USER_AGENT = "User-Agent";
// This parameter is used for sticky session on load balancer, see #28580
private static final String HEADER_GEOPORTALEXPORT_PRJ = "geoportalexport_prj";
private static final String JOB_CODE = "jobCode";
@ -101,7 +103,8 @@ public class GeoportalExporter {
@PathParam(PATH_USECASE_ID) String ucdID, @PathParam(PATH_PROJECT_ID) String projectID,
@QueryParam(QUERY_PARAMETER_AS_URL) @Nullable String asURL) throws WebApplicationException {
String userAgentName = req.getHeader("User-Agent");
String userAgentName = req.getHeader(HEADER_USER_AGENT);
LOG.info("{} is: {}", HEADER_USER_AGENT, userAgentName);
LOG.info(this.getClass().getSimpleName() + " export - GET starts...");
LOG.info("Params: [" + EXPORT_TYPE + ": {}, " + PATH_USECASE_ID + ": {}, " + PATH_PROJECT_ID + ": {}, "
@ -110,10 +113,9 @@ public class GeoportalExporter {
checkPathParameterNotNull(req, EXPORT_TYPE, export_type);
checkPathParameterNotNull(req, PATH_USECASE_ID, ucdID);
checkPathParameterNotNull(req, PATH_PROJECT_ID, projectID);
String geoportalexport_prj = (String) req.getHeader(GEOPORTALEXPORT_PRJ);
LOG.info(GEOPORTALEXPORT_PRJ+" header: " + geoportalexport_prj);
String geoportalexport_prj = (String) req.getHeader(HEADER_GEOPORTALEXPORT_PRJ);
LOG.info(HEADER_GEOPORTALEXPORT_PRJ + " header: " + geoportalexport_prj);
boolean getAsURL = false;
try {
@ -133,7 +135,7 @@ public class GeoportalExporter {
throw ExceptionManager.forbiddenException(req, "Cannot determine context (the scope)", this.getClass(),
helpURI);
}
final org.gcube.common.authorization.utils.user.User user = secreteManager.getUser();
if (user == null) {
throw ExceptionManager.forbiddenException(req, "Cannot determine user", this.getClass(), helpURI);
@ -196,8 +198,8 @@ public class GeoportalExporter {
String serviceViewPDF_URL = String.format("%s/%s/view/%s", Util.getServerURL(req), "geoportal",
jobCode);
String entity = GeoportalHTMLMessageGenerator.entityHTMLMessage(geoportalexport_prj,"Exporting as PDF...",
"The project with id: " + projectID, true, serviceViewPDF_URL);
String entity = GeoportalHTMLMessageGenerator.entityHTMLMessage(geoportalexport_prj,
"Exporting as PDF...", "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")