コード例 #1
0
  public void service(
      ChannelHandlerContext ctx, HttpRequest request, HttpResponse response, boolean handleNotFound)
      throws IOException {

    try {
      ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
      if (defaultInstance instanceof ThreadLocalResteasyProviderFactory) {
        ThreadLocalResteasyProviderFactory.push(providerFactory);
      }

      SecurityContext securityContext;
      if (domain != null) {
        securityContext = basicAuthentication(request, response);
        if (securityContext == null) // not authenticated
        {
          return;
        }
      } else {
        securityContext = new NettySecurityContext();
      }
      try {

        ResteasyProviderFactory.pushContext(ChannelHandlerContext.class, ctx);
        ResteasyProviderFactory.pushContext(SecurityContext.class, securityContext);
        if (handleNotFound) {
          dispatcher.invoke(request, response);
        } else {
          dispatcher.invokePropagateNotFound(request, response);
        }
      } finally {
        ResteasyProviderFactory.clearContextData();
      }
    } finally {
      ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
      if (defaultInstance instanceof ThreadLocalResteasyProviderFactory) {
        ThreadLocalResteasyProviderFactory.pop();
      }
    }
  }
コード例 #2
0
 @After
 public void tearDown() throws Exception {
   ResteasyProviderFactory.clearContextData();
 }
コード例 #3
0
 public void clearContextData() {
   ResteasyProviderFactory.clearContextData();
   // just in case there were internalDispatches that need to be cleaned up
   MessageBodyParameterInjector.clearBodies();
 }