title: How to access header values of request in Java Restlet?
body: <p>I am developing web services using <strong>Restlet Java</strong>.</p>
  
  <p>For this I want to protect some webservices from unauthorized clients. So I have written Filter class. In that Filter class I want to get the <strong>headers</strong>  of the Request. But I am getting the following error - </p>
  
  <pre><code>java.lang.ClassCastException: org.restlet.engine.http.HttpRequest cannot be cast to javax.servlet.http.HttpServletRequest
  </code></pre>
  
  <p>The coding is - </p>
  
  <pre><code>public class MyFilter extends Filter {
  
      @Override
      protected int beforeHandle(Request request, Response response) {
  
          int result = STOP;
  
          HttpServletRequest httpReq = (HttpServletRequest) request;
          String user_token = httpReq.getHeader("auth");
  
          if(user_token.equals("xyz")) {
              result = CONTINUE;
          }
  
          return result;
      }
  }
  </code></pre>
  
  <p><strong>Please suggest me a way to access the header values of Request in Java Restlet?</strong></p>