Skip to content

Commit

Permalink
Fix webserver to be compatible with Webbit 0.4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob--W authored and Andreas Tolf Tolfsen committed Aug 9, 2013
1 parent 424b5a1 commit e4c6255
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,26 @@ public ImprovedStaticFileHandler(File dir) {
enableDirectoryListing(true);
}

}
@Override
protected void serve(final String mimeType,
final byte[] staticContents,
HttpControl control,
final HttpResponse response,
final HttpRequest request,
final String path) {
control.execute(new Runnable() {
public void run() {
if (mimeType != null) {
response.header("Content-Type", mimeType.split(";")[0]);
}
ByteBuffer contents = ByteBuffer.wrap(staticContents);

response
.header("Content-Length", contents.remaining())
.content(contents)
.end();
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ protected File resolveFile(String path) throws IOException {
}
}

}
}

0 comments on commit e4c6255

Please sign in to comment.