odnoklassniki/one-nio

How to implement a request filter in HttpServer

forchid opened this issue · 5 comments

I want to add a user login check handler in my application when using the HttpServer, but I can't find a graceful way to do this in one.nio.http package.

I think HttpServer.handleRequest is a right extension point for this.
What alternatives can you suggest if it does not suit?

If overriding httpServer.handleRequest() , the user must handle the duplicated path and virtualHost route logic. Can we add @filter annotation as @path in Route class? eg. @filter("/member/*"), @filter("*.do").

Well, this is not really a request filter. It's more like partial or wildcard path matching that I'm going to implement some time soon.

@filter really is a filter, as servlet filter, called before any matched @path.

Contributions are welcome.