com.v5analytics.webster.HandlerChain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webster Show documentation
Show all versions of webster Show documentation
Minimalist web framework, that has an express.js like API.
The newest version!
package com.v5analytics.webster;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HandlerChain {
private final RequestResponseHandler[] handlers;
private int nextHandlerIndex = 0;
public HandlerChain(RequestResponseHandler[] handlers) {
this.handlers = handlers;
}
public void next(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (nextHandlerIndex < handlers.length) {
RequestResponseHandler handler = handlers[nextHandlerIndex];
nextHandlerIndex++;
handler.handle(request, response, this);
}
}
}