fixing pathInfo

This commit is contained in:
Francesco Mangiacrapa 2022-03-24 16:29:53 +01:00
parent 27ade09793
commit 2683d601b0
1 changed files with 7 additions and 7 deletions

View File

@ -34,15 +34,15 @@ public class UriResolverDocs {
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException {
logger.info(UriResolverDocs.class.getSimpleName() + " called");
String requestURI = req.getRequestURI();
String pathInfo = req.getPathInfo();
logger.info("pathInfo {}", pathInfo);
try {
if (requestURI == null)
requestURI = "/index.html";
if (pathInfo.equals("docs"))
pathInfo += "/index.html";
String pathInfo = req.getPathInfo();
logger.info("pathInfo {}", pathInfo);
logger.info("request URI {}", requestURI);
logger.info("redirecting to {}", pathInfo);
logger.info("request URI {}", req.getRequestURI());
String realPath = req.getServletContext().getRealPath(pathInfo);
return new FileInputStream(new File(realPath));
@ -50,7 +50,7 @@ public class UriResolverDocs {
if (!(e instanceof WebApplicationException)) {
// UNEXPECTED EXCEPTION managing it as WebApplicationException
String error = requestURI + " not found. Please, contact the support!";
String error = pathInfo + " not found. Please, contact the support!";
throw ExceptionManager.internalErrorException(req, error, this.getClass(), null);
}
// ALREADY MANAGED AS WebApplicationException