use of com.bonree.brfs.disknode.server.handler.impl.DeleteMessageHandler in project BRFS by zhangnianli.
the class Test method main.
public static void main(String[] args) throws Exception {
int port = 8899;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
}
JettyDiskNodeHttpServer s = new JettyDiskNodeHttpServer(port);
DiskWriterManager nodeManager = new DiskWriterManager();
nodeManager.start();
DiskJettyHttpRequestHandler httpRequestHandler = new DiskJettyHttpRequestHandler();
httpRequestHandler.put(DiskOperation.OP_OPEN, new OpenMessageHandler(nodeManager));
httpRequestHandler.put(DiskOperation.OP_WRITE, new WriteMessageHandler(nodeManager));
httpRequestHandler.put(DiskOperation.OP_READ, new ReadMessageHandler());
httpRequestHandler.put(DiskOperation.OP_CLOSE, new CloseMessageHandler(nodeManager));
httpRequestHandler.put(DiskOperation.OP_DELETE, new DeleteMessageHandler(nodeManager));
ContextHandler handler = new ContextHandler("/disk");
handler.setHandler(httpRequestHandler);
// handler.setHandler(new AbstractHandler() {
//
// @Override
// public void handle(String target, Request baseRequest,
// HttpServletRequest request, HttpServletResponse response)
// throws IOException, ServletException {
// System.out.println("length=" + request.getContentLength());
// int contentLength = request.getContentLength();
// System.out.println("content length############" + contentLength);
// byte[] data = new byte[Math.max(contentLength, 0)];
// if(request.getContentLength() > 0) {
// InputUtils.readBytes(request.getInputStream(), data, 0, data.length);
//
// System.out.println(new String(data));
// }
// baseRequest.setHandled(true);
// }
// });
s.addContextHandler(handler);
s.start();
System.out.println("####################SERVER STARTED#####################");
}
use of com.bonree.brfs.disknode.server.handler.impl.DeleteMessageHandler in project BRFS by zhangnianli.
the class Test method main.
public static void main(String[] args) throws Exception {
int port = 8899;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
}
NettyHttpServer s = new NettyHttpServer(port);
DiskWriterManager nodeManager = new DiskWriterManager();
nodeManager.start();
DiskNettyHttpRequestHandler diskHttpRequestHandler = new DiskNettyHttpRequestHandler();
diskHttpRequestHandler.put(DiskOperation.OP_OPEN, new OpenMessageHandler(nodeManager));
diskHttpRequestHandler.put(DiskOperation.OP_WRITE, new WriteMessageHandler(nodeManager));
diskHttpRequestHandler.put(DiskOperation.OP_READ, new ReadMessageHandler());
diskHttpRequestHandler.put(DiskOperation.OP_CLOSE, new CloseMessageHandler(nodeManager));
diskHttpRequestHandler.put(DiskOperation.OP_DELETE, new DeleteMessageHandler(nodeManager));
s.addContextHandler(new NettyHttpContextHandler("/disk", diskHttpRequestHandler));
s.start();
}
Aggregations