示例#1
0
  public void requestHandlerRemoved(ServiceReference<RequestHandler> ref) {

    RequestHandler handler = registeredHandlers.remove(ref);
    System.out.println("Un-Registering Request Handler: " + handler.getClass().getName());
    handler
        .getHandles()
        .forEach(
            (k, v) -> {
              handlerMapping.remove(k);
            });
    registeredHandlers.remove(ref);
  }
示例#2
0
 @ServiceDependency(removed = "requestHandlerRemoved", required = false)
 public void requestHandlerAdded(ServiceReference<RequestHandler> ref, RequestHandler handler) {
   System.out.println("Registering Request Handler: " + handler.getClass().getName());
   registeredHandlers.put(ref, handler);
   handler
       .getHandles()
       .forEach(
           (k, v) -> {
             handlerMapping.put(
                 k.getName(),
                 new HandlerMapping()
                     .setRequestClassName(k.getName())
                     .setRequestHandlerInstance(handler)
                     .setAuthorizationHandlerClassName(v.getName()));
           });
 }
示例#3
0
 @Override
 public Response handle(RequestAsync request) throws HandlerNotFoundException {
   log.debug("handling async request:");
   RequestHandler handler = getHandler(request.getClass());
   return handler.handle(request);
 }
示例#4
0
  @Override
  public Response handle(Request request) throws HandlerNotFoundException {

    RequestHandler handler = getHandler(request.getClass());
    return handler.handle(request);
  }