Exemplo n.º 1
0
 public void uploadHandlerRemoved(ServiceReference<RequestUploadHandler> ref) {
   RequestUploadHandler handler = registeredUploadHandlers.remove(ref);
   System.out.println("Un-Registering Upload Handler: " + handler.getClass().getName());
   handler
       .getHandlerDataTypes()
       .forEach(
           (k, v) -> {
             uploadHandlers.remove(k);
           });
   uploadHandlers.remove(handler.getClass().getName());
 }
Exemplo n.º 2
0
 @ServiceDependency(removed = "uploadHandlerRemoved", required = false)
 public void uploadHandlerAdded(
     ServiceReference<RequestUploadHandler> ref, RequestUploadHandler uploadHandler) {
   System.out.println("Registering Upload Handler: " + uploadHandler.getClass().getName());
   registeredUploadHandlers.put(ref, uploadHandler);
   uploadHandler
       .getHandlerDataTypes()
       .forEach(
           (k, v) -> {
             uploadHandlers.put(
                 k,
                 new UploadHandlerMapping()
                     .setDataType(k)
                     .setAuthorizationHandlerClassName(v.getName())
                     .setRequestHandlerInstance(uploadHandler));
           });
 }