Skip to content

Commit

Permalink
Enable guide-extension to serve grass files (#7)
Browse files Browse the repository at this point in the history
Since there's no supported builtin way of loading a local grass file
(see neo4j/neo4j-browser#171), hosting grass files using the guide-extension
would be handy.
  • Loading branch information
dhimmel authored and jexp committed Jun 10, 2016
1 parent 8d64269 commit 4922a4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions guide-extension/readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ This is the core idea of exposing static web resources under the mountpoint.
[source,java]
----
@GET
@Path("{file:(?i).+\\.(png|jpg|jpeg|svg|gif|html?|js|css|txt)}")
@Path("{file:(?i).+\\.(png|jpg|jpeg|svg|gif|html?|js|css|txt|grass)}")
public Response file(@PathParam("file") String file) throws IOException {
InputStream fileStream = findFileStream(file);
if (fileStream == null) return Response.status(Response.Status.NOT_FOUND).build();
else return Response.ok(fileStream, mediaType(file)).build();
}
----

Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public StaticWebResource(@Context Config configuration, @Context WebServer serve
if (path == null) path = "guides";
File file = new File(path);
this.directory = file.exists() ? file : null;

}

@Path("/")
@Produces("text/html")
@GET
Expand All @@ -44,7 +44,7 @@ public Response index() throws IOException {
static Map<String,File> resources = new ConcurrentHashMap<>();

@GET
@Path("{file:(?i).+\\.(png|jpg|jpeg|svg|gif|html?|js|css|txt)}")
@Path("{file:(?i).+\\.(png|jpg|jpeg|svg|gif|html?|js|css|txt|grass)}")
public Response file(@PathParam("file") String file) throws IOException {
InputStream fileStream = findFileStream(file);
if (fileStream == null) return Response.status(Response.Status.NOT_FOUND).build();
Expand Down

0 comments on commit 4922a4f

Please sign in to comment.