private HashMap<String, Object> getMetaDataMap(MethodCallRequest call) { HashMap<String, Object> metaData = new HashMap<String, Object>(); metaData.put("callId", call.getCallId()); metaData.put("destination", call.getDestination()); return metaData; }
@Override protected MethodResultMessage doFilter(MethodCallRequest input, Map<String, Object> metadata) { metadata.put("callId", input.getCallId()); metadata.put("answer", input.isAnswer()); MethodResult result = requestHandler.handleCall(input.getMethodCall()); return new MethodResultMessage(result, input.getCallId()); }
@Override protected String doFilter(String input, Map<String, Object> metaData) { SecureRequest request; try { LOGGER.trace("attempt to read SecureRequest from inputData"); request = mapper.readValue(input, SecureRequest.class); } catch (IOException e) { throw new FilterException(e); } String callId = request.getMessage().getCallId(); LOGGER.info("extracted callId \"{}\" from message", callId); metaData.put("callId", callId); LOGGER.debug("converting arguments of inputmessage"); JsonUtils.convertAllArgs(request.getMessage()); LOGGER.debug("invoking next filter: {}", next.getClass().getName()); SecureResponse response = (SecureResponse) next.filter(request, metaData); LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response); try { return mapper.writeValueAsString(response); } catch (IOException e) { throw new FilterException(e); } }
@Override protected byte[] doFilter(byte[] input, Map<String, Object> metaData) { SecureRequest request; try { LOGGER.trace("attempt to read SecureRequest from inputData"); request = mapper.readValue(input, SecureRequest.class); } catch (IOException e) { throw new FilterException(e); } String callId = request.getMessage().getCallId(); LOGGER.info("extracted callId \"{}\" from message", callId); metaData.put("callId", callId); LOGGER.debug("converting arguments of inputmessage"); JsonUtils.convertAllArgs(request.getMessage()); LOGGER.debug("invoking next filter: {}", next.getClass().getName()); SecureResponse response = (SecureResponse) next.filter(request, metaData); LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response); try { return mapper.writeValueAsBytes(response); } catch (IOException e) { throw new FilterException(e); } }