title: Enable CORS in Java Play Framework 2.2.x
body: <p>I am having trouble of enabling cross domain in Java Play 2.2.x</p>
  
  <p>In Java Play 2.1.3 this code works by putting it in Global.java</p>
  
  <pre><code>public class Global extends GlobalSettings {
  
    private class ActionWrapper extends Action.Simple {
      public ActionWrapper(Action action) {
       this.delegate = action;
    }
  
      @Override
      public Result call(Http.Context ctx) throws java.lang.Throwable {
        Result result = this.delegate.call(ctx);
        Http.Response response = ctx.response();
        response.setHeader("Access-Control-Allow-Origin", "*");
        return result;
      }
    }
  
    @Override
    public Action onRequest(Http.Request request, java.lang.reflect.Method actionMethod) {
      return new ActionWrapper(super.onRequest(request, actionMethod));
    }
  
  }
  </code></pre>
  
  <p>But when I tried to compile on java play 2.2.x, it does not compile anymore.</p>
  
  <p>The compilation error message:</p>
  
  <p>Global.ActionWrapper is not abstract and does not override abstract method call(Context) in Action ...</p>
  
  <p>Is there any equivalent code for java play 2.2.x?</p>
  
  <p>Thanks.</p>