New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make httpAction and wsAction accept action #40

flowersinthesand opened this Issue Jan 15, 2015 · 0 comments


None yet
1 participant

flowersinthesand commented Jan 15, 2015

Now a typical code to normalize platform resource into ServerHttpExchange looks like:

context.addServlet(VibeServlet.class.getName(), new VibeServlet() {
    protected Action<ServerHttpExchange> httpAction() {
        return httpAction;

It was to make bridge like VibeServlet lightweight as possible but looks tedious for users certainly. With Actions, it can save 5 lines by providing VibeServlet httpAction((Action<ServerHttpExchange>) action) method like server.socketAction((Action<Socket>) action). Then, it will look like:

context.addServlet(VibeServlet.class.getName(), new VibeServlet().httpAction(httpAction));

Moreover, it brings out advantages of Actions. For example, multiple actions can be added.

Servlet s = new VibeServlet().httpAction(logAction).httpAction(corsAction).httpAction(myAction);

@flowersinthesand flowersinthesand added this to the 3.0.0-Alpha9 milestone Jan 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment