title: Using Wicket in a REST call
body: <p>So I recently started using Wicket and I'm trying to make a REST call to an endpoint setup with RestEasy. I can make the call and can see it get hit successfully, but when trying to use Wicket components I'm getting the following error...</p>
  
  <p><code>org.apache.wicket.WicketRuntimeException: There is no application attached to current thread</code></p>
  
  <p>I'm assuming this is because I'm entering the application through a point that isn't managed by Wicket. I tried to get around the issue by ignoring Wicket, but it's so tightly coupled to our data that I can't find a way around it without rewriting tons of existing code. </p>
  
  <p>Is there a way that I can either tell Wicket that it needs to manage this endpoint, or a way that I can get my application context once I'm inside my REST service?</p>
  
  <p>Here's some relevant code.</p>
  
  <pre><code>@POST
  @Path("/generate/{num}")
  @Produces("text/plain")
  @RolesAllowed({
          AuthorizeRole.ROLE
  })
  public Response generate(@PathParam("num") String num) throws Exception {
      Response response;
      Type incomingType = getType(reportBn);
  
      if(!incomingType.equals(Type.type)) {
          response = Response.status(Response.Status.BAD_REQUEST).entity("Could not process request").build();
          return response;
      }
  
      SomeObject newObj = new SomeObject(num);
  
      //This will cause the error, but it's actually 
      //getting called later, this is just to show why it's thrown.
      Application.get();
  
      response = Response.ok(newObj.getNum()).build();
      return response;
  }
  </code></pre>