title: Access asset file based on current context in play framework 2.3
body: <p>How can I return an Asset file based on user permission.
  means that I want show page based on user access level.</p>
  
  <p>with using this method , current context is not available:</p>
  
  <pre><code>public play.api.mvc.Action&lt;AnyContent&gt; index() {
      try {
          if (securityService.getCurrentSession(Controller.ctx()) == null) {
              return Assets.at("/public", "/main.html", false);
          }else
              return Assets.at("/public", "/index/index.html", false);
      } catch (Exception e) {
          return Assets.at("/public", "/index/index.html", false);
      }
  }
  </code></pre>
  
  <p>due to this error:</p>
  
  <pre><code>There is no HTTP Context available from here.
  </code></pre>
  
  <p>and using this method return asset as download file:</p>
  
  <pre><code>public Result index() {
      try {
          if (securityService.getCurrentSession(Controller.ctx()) == null) {
              return Results.ok(Play.application().getFile("/public/index/index.html"));
          }else
              return Results.ok(Play.application().getFile("/public/main.html"));
      } catch (Exception e) {
          return Results.ok(Play.application().getFile("/public/index/index.html"));
      }
  }
  </code></pre>
  
  <p>How can I show index page based on user privilege?</p>