Пример #1
0
  @Override
  public NextAction processRequest(Packet request) {
    try {
      LOGGER.entering();

      assert request.getMessage() != null
          : "Unexpected [null] message in the server-side Tube.processRequest()";

      String clientUID = getClientUID(request);
      if (isMakeConnectionRequest(request)) {
        return handleMakeConnectionRequest(request, clientUID);
      }

      if (clientUID == null) {
        // don't bother - this is not a WS-MC enabled request
        return super.processRequest(request);
      } else {
        // TODO replace with proper code that replaces only address

        // removing replyTo header and faultTo header to prevent addressing server tube from
        // treating this request as non-anonymous
        request.getMessage().getHeaders().remove(configuration.getAddressingVersion().replyToTag);
        request.getMessage().getHeaders().remove(configuration.getAddressingVersion().faultToTag);
      }

      Packet requestCopy = request.copy(true);
      fiberExecutor.start(
          request, new AppRequestProcessingCallback(responseStorage, clientUID, configuration));
      return super.doReturnWith(createEmptyResponse(requestCopy));
    } finally {
      LOGGER.exiting();
    }
  }
Пример #2
0
 @Override
 public AbstractTubeImpl copy(TubeCloner cloner) {
   LOGGER.entering();
   try {
     return new McServerTube(this, cloner);
   } finally {
     LOGGER.exiting();
   }
 }
Пример #3
0
  @Override
  public NextAction processException(Throwable t) {
    try {
      LOGGER.entering();

      return super.processException(t);
    } finally {
      LOGGER.exiting();
    }
  }
Пример #4
0
  @Override
  public NextAction processResponse(Packet response) {
    try {
      LOGGER.entering();

      // with WS-MC enabled messages, this method gets never invoked
      return super.processResponse(response);
    } finally {
      LOGGER.exiting();
    }
  }
Пример #5
0
  private NextAction handleMakeConnectionRequest(Packet request, String clientUID) {
    try {
      LOGGER.entering();

      String selectionUID;
      try {
        MakeConnectionElement mcElement =
            request
                .getMessage()
                .readPayloadAsJAXB(
                    configuration
                        .getMcVersion()
                        .getUnmarshaller(configuration.getAddressingVersion()));
        selectionUID = configuration.getMcVersion().getClientId(mcElement.getAddress().getValue());
      } catch (JAXBException ex) {
        throw LOGGER.logSevereException(
            new RxRuntimeException(
                LocalizationMessages.WSMC_0107_ERROR_UNMARSHALLING_PROTOCOL_MESSAGE(), ex));
      }

      if (selectionUID == null) {
        // TODO return a MissingSelection SOAP fault
        throw LOGGER.logSevereException(
            new RxRuntimeException(LocalizationMessages.WSMC_0108_NULL_SELECTION_ADDRESS()));
      }

      if (!selectionUID.equals(clientUID)) {
        // TODO return a SOAP fault?
        throw LOGGER.logSevereException(
            new RxRuntimeException(
                LocalizationMessages.WSMC_0109_SELECTION_ADDRESS_NOT_MATCHING_WSA_REPLYTO()));
      }

      Packet response = null;
      if (selectionUID != null && responseStorage.hasPendingResponse(selectionUID)) {
        LOGGER.finer(
            LocalizationMessages.WSMC_0110_PENDING_MESSAGE_FOUND_FOR_SELECTION_UUID(selectionUID));
        response = responseStorage.getPendingResponsePacket(selectionUID);
      }

      if (response == null) {
        LOGGER.finer(
            LocalizationMessages.WSMC_0111_NO_PENDING_MESSAGE_FOUND_FOR_SELECTION_UUID(
                selectionUID));
        response = createEmptyResponse(request);
      } else {
        Message message = response.getMessage();
        if (message != null) {
          HeaderList headers = message.getHeaders();
          headers.add(
              Headers.create(
                  configuration.getMcVersion().getJaxbContext(configuration.getAddressingVersion()),
                  new MessagePendingElement(
                      Boolean.valueOf(
                          selectionUID != null
                              && responseStorage.hasPendingResponse(selectionUID)))));
        }
      }

      return super.doReturnWith(response);
    } finally {
      LOGGER.exiting();
    }
  }