fixing pathInfo
This commit is contained in:
parent
27ade09793
commit
2683d601b0
|
@ -34,15 +34,15 @@ public class UriResolverDocs {
|
||||||
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException {
|
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException {
|
||||||
logger.info(UriResolverDocs.class.getSimpleName() + " called");
|
logger.info(UriResolverDocs.class.getSimpleName() + " called");
|
||||||
|
|
||||||
String requestURI = req.getRequestURI();
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (requestURI == null)
|
|
||||||
requestURI = "/index.html";
|
|
||||||
|
|
||||||
String pathInfo = req.getPathInfo();
|
String pathInfo = req.getPathInfo();
|
||||||
logger.info("pathInfo {}", pathInfo);
|
logger.info("pathInfo {}", pathInfo);
|
||||||
logger.info("request URI {}", requestURI);
|
try {
|
||||||
|
|
||||||
|
if (pathInfo.equals("docs"))
|
||||||
|
pathInfo += "/index.html";
|
||||||
|
|
||||||
|
logger.info("redirecting to {}", pathInfo);
|
||||||
|
logger.info("request URI {}", req.getRequestURI());
|
||||||
|
|
||||||
String realPath = req.getServletContext().getRealPath(pathInfo);
|
String realPath = req.getServletContext().getRealPath(pathInfo);
|
||||||
return new FileInputStream(new File(realPath));
|
return new FileInputStream(new File(realPath));
|
||||||
|
@ -50,7 +50,7 @@ public class UriResolverDocs {
|
||||||
|
|
||||||
if (!(e instanceof WebApplicationException)) {
|
if (!(e instanceof WebApplicationException)) {
|
||||||
// UNEXPECTED EXCEPTION managing it as 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);
|
throw ExceptionManager.internalErrorException(req, error, this.getClass(), null);
|
||||||
}
|
}
|
||||||
// ALREADY MANAGED AS WebApplicationException
|
// ALREADY MANAGED AS WebApplicationException
|
||||||
|
|
Loading…
Reference in New Issue