mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
provide jetty-compatible entity types for zip resources
This commit is contained in:
parent
d17254e04e
commit
3e7c6840b0
@ -82,7 +82,7 @@ public class DocsysMarkdownEndpoint implements WebServiceObject {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (java.nio.file.Path path : enabled.getPaths()) {
|
for (java.nio.file.Path path : enabled.getPaths()) {
|
||||||
PathWalker.findAll(path).forEach(f -> {
|
PathWalker.findAll(path).forEach(f -> {
|
||||||
sb.append(path.relativize(f).toString()).append("\n");
|
sb.append(path.relativize(f)).append("\n");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
@ -103,7 +103,7 @@ public class DocsysMarkdownEndpoint implements WebServiceObject {
|
|||||||
for (java.nio.file.Path path : enabled.getPaths()) {
|
for (java.nio.file.Path path : enabled.getPaths()) {
|
||||||
PathWalker.findAll(path).forEach(f -> {
|
PathWalker.findAll(path).forEach(f -> {
|
||||||
if (f.toString().endsWith(".md")) {
|
if (f.toString().endsWith(".md")) {
|
||||||
sb.append(path.relativize(f).toString()).append("\n");
|
sb.append(path.relativize(f)).append("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -131,16 +131,19 @@ public class DocsysMarkdownEndpoint implements WebServiceObject {
|
|||||||
/**
|
/**
|
||||||
* @param pathspec the path as known to the manifest
|
* @param pathspec the path as known to the manifest
|
||||||
* @return The contents of a file
|
* @return The contents of a file
|
||||||
|
*
|
||||||
|
* @see <A href="https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/user-guide.html#d0e7648">jersey providers</A>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path(value = "{pathspec:.*}")
|
@Path(value = "{pathspec:.*}")
|
||||||
public Response getFileInPath(@PathParam("pathspec") String pathspec) {
|
public Response getFileInPath(@PathParam("pathspec") String pathspec) {
|
||||||
|
init(false);
|
||||||
try {
|
try {
|
||||||
java.nio.file.Path path = findPath(pathspec);
|
java.nio.file.Path path = findPath(pathspec);
|
||||||
String contentType = Files.probeContentType(path);
|
String contentType = Files.probeContentType(path);
|
||||||
MediaType mediaType = MediaType.valueOf(contentType);
|
MediaType mediaType = MediaType.valueOf(contentType);
|
||||||
|
return Response.ok(Files.newBufferedReader(path), mediaType).build();
|
||||||
return Response.ok(path.toFile(),mediaType).build();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Response.serverError().entity(e.getMessage()).build();
|
return Response.serverError().entity(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user