0

I am having below class to check the incoming request.

public class SecuredAction extends Action.Simple 
{  


    @Override
    public Promise<Result> call(Context ctx) throws Throwable 
    {
        // Not doing anything now. Just interrupting it
        return delegate.call(ctx);
    }
}

And I am applying it on another controller like

@With(SecuredAction.class) 
public class TestController extends BasicController {
public Result method1(){}
public Result method2(){}
--
}

Problem is, in case of multiple requests coming from browser, the requests are getting corrupted / responses are getting mixed up.. In above case, calls to both method1 and method2 are going through only one of them when @With(SecuredAction.class) is used. I am not seeing this issue if this annotation is removed. Is it something to do with Context? Is it not hread safe? What is the right way to do? Any help please?

Shiva Kodityala
  • 105
  • 1
  • 10

1 Answers1

2

Looks like Making SecuredAction a non -singleton (@Scope("prototype") ) solves the problem. Not seeing the issue any more after this.

That means the delegate gets shared among incoming requests / thread unsafe.

Shiva Kodityala
  • 105
  • 1
  • 10