Skip to content

Instantly share code, notes, and snippets.

@ybonnel
Created September 21, 2013 11:47
Show Gist options
  • Save ybonnel/6649841 to your computer and use it in GitHub Desktop.
Save ybonnel/6649841 to your computer and use it in GitHub Desktop.
public AbstractHandler getHandler() {
return new AbstractHandler() {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
if (request.getPathInfo().equals(route + "/nextCommand")) {
String nextCommand;
synchronized (elevator) {
nextCommand = elevator.nextCommand();
}
response.getWriter().print(nextCommand);
response.getWriter().flush();
response.getWriter().close();
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment