Fixing docs

This commit is contained in:
Luca Frosini 2022-09-27 11:50:07 +02:00
parent 3e14830902
commit a307a32180
3 changed files with 57 additions and 52 deletions

View File

@ -366,6 +366,11 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
* Please note that even the user indicates <code>social_post=true</code> the social post
* is create only and only if the Catalogue-Manager enabled this feature, see <code>socialPostEnabled</code> property in
* <a href="resource_Configuration.html#resource_Configuration_read_context_GET">Read Configuration</a>.
* When the social post is created the a notification to the VRe user is sent if the property
* <code>notificationToUsersEnabled</code> is true in the above mentioned configuration.
* If false <code>notificationToUsersEnabled=false</code> the social post will not produce a notification
* to the VRE user which will be only informed about the item pubblication by reading the generated
* social post in the VRE.
* </p>
*
*

View File

@ -17,36 +17,36 @@ import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI-CNR)
*/
@Path("api-docs")
//@Path("api-docs")
public class ApiDocs {
private static Logger logger = LoggerFactory.getLogger(ApiDocs.class);
@GET
@Path("{any:.*}")
public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
logger.trace("Called method to redirect to api-docs/index.html");
String pathInfo = req.getPathInfo();
try {
if (pathInfo.endsWith("/api-docs")) {
pathInfo += "/index.html";
}
if (pathInfo.endsWith("/api-docs/")) {
pathInfo += "index.html";
}
logger.info("redirecting to {}", pathInfo);
String realPath = req.getServletContext().getRealPath(pathInfo);
return new FileInputStream(new File(realPath));
} catch (Exception e) {
throw new InternalServerErrorException(e);
}
}
// @GET
// @Path("{any:.*}")
// public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
// logger.trace("Called method to redirect to api-docs/index.html");
//
// String pathInfo = req.getPathInfo();
// try {
//
// if (pathInfo.endsWith("/api-docs")) {
// pathInfo += "/index.html";
// }
//
// if (pathInfo.endsWith("/api-docs/")) {
// pathInfo += "index.html";
// }
//
// logger.info("redirecting to {}", pathInfo);
//
// String realPath = req.getServletContext().getRealPath(pathInfo);
// return new FileInputStream(new File(realPath));
//
// } catch (Exception e) {
// throw new InternalServerErrorException(e);
// }
// }
}

View File

@ -17,36 +17,36 @@ import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI-CNR)
*/
@Path("docs")
// @Path("docs")
public class Docs {
private static Logger logger = LoggerFactory.getLogger(Docs.class);
@GET
@Path("{any:.*}")
public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
logger.trace("Called method to redirect to docs/index.html");
String pathInfo = req.getPathInfo();
try {
if (pathInfo.endsWith("/docs")) {
pathInfo += "/index.html";
}
if (pathInfo.endsWith("/docs/")) {
pathInfo += "index.html";
}
logger.info("redirecting to {}", pathInfo);
String realPath = req.getServletContext().getRealPath(pathInfo);
return new FileInputStream(new File(realPath));
} catch (Exception e) {
throw new InternalServerErrorException(e);
}
}
// @GET
// @Path("{any:.*}")
// public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
// logger.trace("Called method to redirect to docs/index.html");
//
// String pathInfo = req.getPathInfo();
// try {
//
// if (pathInfo.endsWith("/docs")) {
// pathInfo += "/index.html";
// }
//
// if (pathInfo.endsWith("/docs/")) {
// pathInfo += "index.html";
// }
//
// logger.info("redirecting to {}", pathInfo);
//
// String realPath = req.getServletContext().getRealPath(pathInfo);
// return new FileInputStream(new File(realPath));
//
// } catch (Exception e) {
// throw new InternalServerErrorException(e);
// }
// }
}