fixing UriResolverDocs

This commit is contained in:
Francesco Mangiacrapa 2022-03-24 15:59:07 +01:00
parent 645709a701
commit 50c822904e
1 changed files with 40 additions and 27 deletions

View File

@ -21,24 +21,22 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Oct 22, 2018
* Oct 22, 2018
*/ */
@Path("docs/*") @Path("docs")
public class UriResolverDocs { public class UriResolverDocs {
private static Logger logger = LoggerFactory.getLogger(UriResolverDocs.class); private static Logger logger = LoggerFactory.getLogger(UriResolverDocs.class);
@GET @GET
@Produces({ MediaType.TEXT_HTML }) @Produces({ MediaType.TEXT_HTML })
@Path("") @Path("/")
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(); String requestURI = req.getRequestURI();
try { try {
if (requestURI == null) if (requestURI == null)
requestURI = "/index.html"; requestURI = "/index.html";
@ -60,5 +58,20 @@ public class UriResolverDocs {
throw (WebApplicationException) e; throw (WebApplicationException) e;
} }
} }
@GET
@Produces({ MediaType.TEXT_HTML })
@Path("*")
public InputStream toDoc1(@Context HttpServletRequest req) throws WebApplicationException {
logger.info(UriResolverDocs.class.getSimpleName() + " toDoc1 called");
return index(req);
} }
@GET
@Produces({ MediaType.TEXT_HTML })
@Path("/*")
public InputStream toDoc2(@Context HttpServletRequest req) throws WebApplicationException {
logger.info(UriResolverDocs.class.getSimpleName() + " toDoc2 called");
return index(req);
}
}