|
|
|
@ -45,7 +45,7 @@ public class UriResolverDocs {
|
|
|
|
|
logger.info("pathInfo {}", pathInfo);
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if (pathInfo.equals("/docs/"))
|
|
|
|
|
if (pathInfo.endsWith("/docs/"))
|
|
|
|
|
pathInfo += "index.html";
|
|
|
|
|
|
|
|
|
|
logger.info("redirecting to {}", pathInfo);
|
|
|
|
@ -65,36 +65,4 @@ public class UriResolverDocs {
|
|
|
|
|
throw (WebApplicationException) e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Index.
|
|
|
|
|
*
|
|
|
|
|
* @param req the req
|
|
|
|
|
* @return the input stream
|
|
|
|
|
* @throws WebApplicationException the web application exception
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
// @Produces({ MediaType.TEXT_HTML })
|
|
|
|
|
@Path("")
|
|
|
|
|
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException {
|
|
|
|
|
logger.info(UriResolverDocs.class.getSimpleName() + " index called");
|
|
|
|
|
|
|
|
|
|
String pathInfo = "/docs/index.html";
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String realPath = req.getServletContext().getRealPath(pathInfo);
|
|
|
|
|
return new FileInputStream(new File(realPath));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
if (!(e instanceof WebApplicationException)) {
|
|
|
|
|
// UNEXPECTED EXCEPTION managing it as WebApplicationException
|
|
|
|
|
String error = pathInfo + " not found. Please, contact the support!";
|
|
|
|
|
throw ExceptionManager.internalErrorException(req, error, this.getClass(), null);
|
|
|
|
|
}
|
|
|
|
|
// ALREADY MANAGED AS WebApplicationException
|
|
|
|
|
logger.error("Exception:", e);
|
|
|
|
|
throw (WebApplicationException) e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|