/** * Returns a string that encodes the object. It is an error to try to encode * an object that is not assignable to the service method's return type. * * @param serviceMethod the method whose result we are encoding * @param object the instance that we wish to encode * @return a string that encodes the object, if the object is compatible with * the service method's declared return type * * @throws IllegalArgumentException if the result is not assignable to the * service method's return type * @throws NullPointerException if the service method is <code>null</code> * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForSuccess(Method serviceMethod, Object object) throws SerializationException { return encodeResponseForSuccess(serviceMethod, object, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes an exception. If method is not * <code>null</code>, it is an error if the exception is not in the method's * list of checked exceptions. * * @param serviceMethod the method that threw the exception, may be * <code>null</code> * @param cause the {@link Throwable} that was thrown * @return a string that encodes the exception * * @throws NullPointerException if the cause is <code>null</code> * @throws SerializationException if the result cannot be serialized * @throws UnexpectedException if the result was an unexpected exception (a * checked exception not declared in the serviceMethod's signature) */ public static String encodeResponseForFailure(Method serviceMethod, Throwable cause) throws SerializationException { return encodeResponseForFailure(serviceMethod, cause, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes the result of calling a service method, which * could be the value returned by the method or an exception thrown by it. * * <p> * This method does no security checking; security checking must be done on * the method prior to this invocation. * </p> * * @param target instance on which to invoke the serviceMethod * @param serviceMethod the method to invoke * @param args arguments used for the method invocation * @return a string which encodes either the method's return or a checked * exception thrown by the method * * @throws SecurityException if the method cannot be accessed or if the number * or type of actual and formal arguments differ * @throws SerializationException if an object could not be serialized by the * stream * @throws UnexpectedException if the serviceMethod throws a checked exception * that is not declared in its signature */ public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args) throws SerializationException { return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes an exception. If <code>rpcRequest</code> * is <code>null</code> a default serialization policy and default request * flags will be used. Otherwise these information are taken from * <code>rpcRequest</code>. * <p> * This method should be used if the RPC request could not be decoded or * could not be executed because of an exception thrown, e.g. * {@link IncompatibleRemoteServiceException}, {@link RpcTokenException} * </p> * @param rpcRequest the RPCRequest that failed to execute, may be null * @param cause the {@link Throwable} that was thrown * @return a String that encodes the exception * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForFailedRequest(RPCRequest rpcRequest, Throwable cause) throws SerializationException { if (rpcRequest == null) { return RPC.encodeResponseForFailure(null, cause, getDefaultSerializationPolicy(), AbstractSerializationStream.DEFAULT_FLAGS); } else { return RPC.encodeResponseForFailure(null, cause, rpcRequest.getSerializationPolicy(), rpcRequest.getFlags()); } }
+ moduleBaseURL + "'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result."); serializationPolicy = RPC.getDefaultSerializationPolicy();
/** * Returns a string that encodes the object. It is an error to try to encode * an object that is not assignable to the service method's return type. * * @param serviceMethod the method whose result we are encoding * @param object the instance that we wish to encode * @return a string that encodes the object, if the object is compatible with * the service method's declared return type * * @throws IllegalArgumentException if the result is not assignable to the * service method's return type * @throws NullPointerException if the service method is <code>null</code> * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForSuccess(Method serviceMethod, Object object) throws SerializationException { return encodeResponseForSuccess(serviceMethod, object, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes an exception. If method is not * <code>null</code>, it is an error if the exception is not in the method's * list of checked exceptions. * * @param serviceMethod the method that threw the exception, may be * <code>null</code> * @param cause the {@link Throwable} that was thrown * @return a string that encodes the exception * * @throws NullPointerException if the cause is <code>null</code> * @throws SerializationException if the result cannot be serialized * @throws UnexpectedException if the result was an unexpected exception (a * checked exception not declared in the serviceMethod's signature) */ public static String encodeResponseForFailure(Method serviceMethod, Throwable cause) throws SerializationException { return encodeResponseForFailure(serviceMethod, cause, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes the object. It is an error to try to encode * an object that is not assignable to the service method's return type. * * @param serviceMethod the method whose result we are encoding * @param object the instance that we wish to encode * @return a string that encodes the object, if the object is compatible with * the service method's declared return type * * @throws IllegalArgumentException if the result is not assignable to the * service method's return type * @throws NullPointerException if the service method is <code>null</code> * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForSuccess(Method serviceMethod, Object object) throws SerializationException { return encodeResponseForSuccess(serviceMethod, object, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes an exception. If method is not * <code>null</code>, it is an error if the exception is not in the method's * list of checked exceptions. * * @param serviceMethod the method that threw the exception, may be * <code>null</code> * @param cause the {@link Throwable} that was thrown * @return a string that encodes the exception * * @throws NullPointerException if the cause is <code>null</code> * @throws SerializationException if the result cannot be serialized * @throws UnexpectedException if the result was an unexpected exception (a * checked exception not declared in the serviceMethod's signature) */ public static String encodeResponseForFailure(Method serviceMethod, Throwable cause) throws SerializationException { return encodeResponseForFailure(serviceMethod, cause, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes the result of calling a service method, which * could be the value returned by the method or an exception thrown by it. * * <p> * This method does no security checking; security checking must be done on * the method prior to this invocation. * </p> * * @param target instance on which to invoke the serviceMethod * @param serviceMethod the method to invoke * @param args arguments used for the method invocation * @return a string which encodes either the method's return or a checked * exception thrown by the method * * @throws SecurityException if the method cannot be accessed or if the number * or type of actual and formal arguments differ * @throws SerializationException if an object could not be serialized by the * stream * @throws UnexpectedException if the serviceMethod throws a checked exception * that is not declared in its signature */ public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args) throws SerializationException { return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes the result of calling a service method, which * could be the value returned by the method or an exception thrown by it. * * <p> * This method does no security checking; security checking must be done on * the method prior to this invocation. * </p> * * @param target instance on which to invoke the serviceMethod * @param serviceMethod the method to invoke * @param args arguments used for the method invocation * @return a string which encodes either the method's return or a checked * exception thrown by the method * * @throws SecurityException if the method cannot be accessed or if the number * or type of actual and formal arguments differ * @throws SerializationException if an object could not be serialized by the * stream * @throws UnexpectedException if the serviceMethod throws a checked exception * that is not declared in its signature */ public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args) throws SerializationException { return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy()); }
/** * Returns a string that encodes an exception. If <code>rpcRequest</code> * is <code>null</code> a default serialization policy and default request * flags will be used. Otherwise these information are taken from * <code>rpcRequest</code>. * <p> * This method should be used if the RPC request could not be decoded or * could not be executed because of an exception thrown, e.g. * {@link IncompatibleRemoteServiceException}, {@link RpcTokenException} * </p> * @param rpcRequest the RPCRequest that failed to execute, may be null * @param cause the {@link Throwable} that was thrown * @return a String that encodes the exception * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForFailedRequest(RPCRequest rpcRequest, Throwable cause) throws SerializationException { if (rpcRequest == null) { return RPC.encodeResponseForFailure(null, cause, getDefaultSerializationPolicy(), AbstractSerializationStream.DEFAULT_FLAGS); } else { return RPC.encodeResponseForFailure(null, cause, rpcRequest.getSerializationPolicy(), rpcRequest.getFlags()); } }
public final SerializationPolicy getSerializationPolicy( String moduleBaseURL, String strongName) { SerializationPolicy serializationPolicy = getCachedSerializationPolicy( moduleBaseURL, strongName); if (serializationPolicy != null) { return serializationPolicy; } serializationPolicy = doGetSerializationPolicy(getThreadLocalRequest(), moduleBaseURL, strongName); if (serializationPolicy == null) { // Failed to get the requested serialization policy; use the default getServletContext() .log( "WARNING: Failed to get the SerializationPolicy '" + strongName + "' for module '" + moduleBaseURL + "'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result."); serializationPolicy = RPC.getDefaultSerializationPolicy(); } // This could cache null or an actual instance. Either way we will not // attempt to lookup the policy again. putCachedSerializationPolicy(moduleBaseURL, strongName, serializationPolicy); return serializationPolicy; }
/** * Returns a string that encodes an exception. If <code>rpcRequest</code> * is <code>null</code> a default serialization policy and default request * flags will be used. Otherwise these information are taken from * <code>rpcRequest</code>. * <p> * This method should be used if the RPC request could not be decoded or * could not be executed because of an exception thrown, e.g. * {@link IncompatibleRemoteServiceException}, {@link RpcTokenException} * </p> * @param rpcRequest the RPCRequest that failed to execute, may be null * @param cause the {@link Throwable} that was thrown * @return a String that encodes the exception * @throws SerializationException if the result cannot be serialized */ public static String encodeResponseForFailedRequest(RPCRequest rpcRequest, Throwable cause) throws SerializationException { if (rpcRequest == null) { return RPC.encodeResponseForFailure(null, cause, getDefaultSerializationPolicy(), AbstractSerializationStream.DEFAULT_FLAGS); } else { return RPC.encodeResponseForFailure(null, cause, rpcRequest.getSerializationPolicy(), rpcRequest.getFlags()); } }
public final SerializationPolicy getSerializationPolicy(String moduleBaseURL, String strongName) { SerializationPolicy serializationPolicy = getCachedSerializationPolicy( moduleBaseURL, strongName); if (serializationPolicy != null) { return serializationPolicy; } serializationPolicy = doGetSerializationPolicy(getThreadLocalRequest(), moduleBaseURL, strongName); if (serializationPolicy == null) { // Failed to get the requested serialization policy; use the default log( "WARNING: Failed to get the SerializationPolicy '" + strongName + "' for module '" + moduleBaseURL + "'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result.", null); serializationPolicy = RPC.getDefaultSerializationPolicy(); } // This could cache null or an actual instance. Either way we will not // attempt to lookup the policy again. putCachedSerializationPolicy(moduleBaseURL, strongName, serializationPolicy); return serializationPolicy; }
+ moduleBaseURL + "'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result."); serializationPolicy = RPC.getDefaultSerializationPolicy();
+ moduleBaseURL + "'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result."); serializationPolicy = RPC.getDefaultSerializationPolicy();
} else { serializationPolicy = RPC.getDefaultSerializationPolicy(); flags = 0;