/** * Indicates to the server that a client side interceptor is interested in the context data that is stored * under the given key. Any object on the context data map (i.e. {@code InvocationContext.getContextData()} that is * present at the end of the server invocation will be serialised and returned to the client. * * If an object is present under this key and is not serializable then the request will fail. * * @param key The context data key the client interceptor is interested in */ public void addReturnedContextDataKey(String key) { Object returnedData = getContextData().get(RETURNED_CONTEXT_DATA_KEY); if(returnedData == null) { getContextData().put(RETURNED_CONTEXT_DATA_KEY, returnedData = new HashSet<>()); } else if(!(returnedData instanceof Set)) { throw Logs.INVOCATION.returnedContextDataKeyOfWrongType(); } Set<String> keys = (Set<String>) returnedData; keys.add(key); }
private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
} else { final Object value = unmarshaller.readObject(); if (value != null) clientInvocationContext.getContextData().put(key, value);
final Map<String, Object> invocationContextData = invocation.getContextData(); if (invocationContextData == null && privateAttachments.isEmpty()) { invocation.getContextData().put(entry.getKey(), entry.getValue());
final Map<String, Object> contextData = invocationContext.getContextData();
/** * Indicates to the server that a client side interceptor is interested in the context data that is stored * under the given key. Any object on the context data map (i.e. {@code InvocationContext.getContextData()} that is * present at the end of the server invocation will be serialised and returned to the client. * * If an object is present under this key and is not serializable then the request will fail. * * @param key The context data key the client interceptor is interested in */ public void addReturnedContextDataKey(String key) { Object returnedData = getContextData().get(RETURNED_CONTEXT_DATA_KEY); if(returnedData == null) { getContextData().put(RETURNED_CONTEXT_DATA_KEY, returnedData = new HashSet<>()); } else if(!(returnedData instanceof Set)) { throw Logs.INVOCATION.returnedContextDataKeyOfWrongType(); } Set<String> keys = (Set<String>) returnedData; keys.add(key); }
/** * Indicates to the server that a client side interceptor is interested in the context data that is stored * under the given key. Any object on the context data map (i.e. {@code InvocationContext.getContextData()} that is * present at the end of the server invocation will be serialised and returned to the client. * * If an object is present under this key and is not serializable then the request will fail. * * @param key The context data key the client interceptor is interested in */ public void addReturnedContextDataKey(String key) { Object returnedData = getContextData().get(RETURNED_CONTEXT_DATA_KEY); if(returnedData == null) { getContextData().put(RETURNED_CONTEXT_DATA_KEY, returnedData = new HashSet<>()); } else if(!(returnedData instanceof Set)) { throw Logs.INVOCATION.returnedContextDataKeyOfWrongType(); } Set<String> keys = (Set<String>) returnedData; keys.add(key); }
private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
} else { final Object value = unmarshaller.readObject(); if (value != null) clientInvocationContext.getContextData().put(key, value);
} else { final Object value = unmarshaller.readObject(); if (value != null) clientInvocationContext.getContextData().put(key, value);
final Map<String, Object> contextData = invocationContext.getContextData();
final Map<String, Object> contextData = invocationContext.getContextData();