fix an issue in file server
This commit is contained in:
parent
c2ed21a2c5
commit
8d9b66e7d7
1 changed files with 6 additions and 8 deletions
|
@ -64,22 +64,20 @@ public class FileServer implements IRequestCatcher, RequestHandler.Listener {
|
|||
return r;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/style.css")
|
||||
public void style(Request request, Callback<Response> res, Callback<Throwable> rej) {
|
||||
res.call(new Response(request, request.context.file("style.css"), 200, "OK", "text/css"));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path(".*/")
|
||||
public void onIndex(Request request, Callback<Response> res, Callback<Throwable> rej) {
|
||||
res.call(new Response(request, fileContent(request, data.getString("dir") + request.path.replace("..", "") + "/index.html"), 200, "OK"));
|
||||
res.call(new Response(request, fileContent(request, data.getString("dir") + request.realPath.replace("..", "") + "/index.html"), 200, "OK"));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/.+")
|
||||
public void onFile(Request request, Callback<Response> res, Callback<Throwable> rej) {
|
||||
res.call(new Response(request, fileContent(request, data.getString("dir") + request.path.replace("..", "")), 200, "OK"));
|
||||
if(request.realPath.equals("/style.css")) {
|
||||
res.call(new Response(request, request.context.file("style.css"), 200, "OK", "text/css"));
|
||||
return;
|
||||
}
|
||||
res.call(new Response(request, fileContent(request, data.getString("dir") + request.realPath.replace("..", "")), 200, "OK"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue