RestFilter, RestHandler, BaseRestHandler alternate Solution


(Arul Narasimhan) #1

Hi all,

I have an Authentication plugin written in ES 5.1 has the following Classes.

  1. Public Class SecurityFilter extends RestFilter
    Where
    public void process(final RestRequest request, final RestChannel channel, final NodeClient client,
    final RestFilterChain filterChain) {
    Does some validation and forward the request to Handlers using
    filterChain.continueProcessing(request, channel, client);

  2. Public Class RoleAction implements RestHandler

  3. Public Class DefaultAction implements RestHandler

  4. Public Class UserAction implements RestHandler

And the SecurityFilter was registered using
RestController.registerFilter method.

With the above setting, SecurityFilter receives the request first and forwards to Respective Handlers.

With ES5.6 upgrade, Support for
RestFilter and RestController.registerFilter has been been removed.

My question is whether the following code alternate is correct for ES 5.6 upgrade

#1. Public Class SecurityFilter implements RestHandler
Where
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
Need to same validation and forward the request to Handlers.

How do I register the SecurityFilter as the initial Entry point as all other action Classes are also RestHandlers

#2. In case if #1 is correct way of doing it, how do I forward the request to other Handlers once Authentication is done.

Have been stuck with this code for quiet a while and didnt have any solution.
Could you please guide?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.