com.google.gwt.user.client.rpc.IsSerializable Java Examples
The following examples show how to use
com.google.gwt.user.client.rpc.IsSerializable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandSerializationPolicy.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private boolean isInstantiable(Class<?> clazz) { if (clazz.isPrimitive()) { return true; } if (clazz.isEnum()) { return true; } if (Throwable.class.isAssignableFrom(clazz)) { return true; } if (clazz.isArray()) { return this.isInstantiable(clazz.getComponentType()); } if (IsSerializable.class.isAssignableFrom(clazz)) { return true; } if (Serializable.class.isAssignableFrom(clazz)) { return true; } return SerializabilityUtil.hasCustomFieldSerializer(clazz) != null; }
Example #2
Source File: SimpleSerializationPolicy.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private boolean isSerializable(Class<?> clazz) { if (clazz != null) { if (clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz) || IsSerializable.class.isAssignableFrom(clazz)) { return true; } } return false; }
Example #3
Source File: GwtRpcServlet.java From unitime with Apache License 2.0 | 5 votes |
public static <T extends GwtRpcResponse> T execute(GwtRpcRequest<T> request, ApplicationContext applicationContext, SessionContext sessionContext) throws GwtRpcException { try { // retrieve implementation from given request GwtRpcImplementation<GwtRpcRequest<T>, T> implementation = getImplementation((Class<GwtRpcRequest<T>>)request.getClass(), applicationContext); // execute request T response = implementation.execute(request, sessionContext); // return response return response; } catch (Throwable t) { // re-throw exception as GwtRpcException or IsSerializable runtime exception if (t instanceof GwtRpcException) { GwtRpcException e = (GwtRpcException)t; if (e.hasCause()) sLog.warn("Seen server exception: " + e.getMessage(), e.getCause()); else sLog.info("Seen server exception: " + e.getMessage()); throw e; } if (t instanceof IsSerializable) { if (t.getCause() != null) sLog.error("Seen server exception: " + t.getMessage(), t); else sLog.warn("Seen server exception: " + t.getMessage(), t); throw new GwtRpcException(t.getMessage(), t); } sLog.error("Seen exception: " + t.getMessage(), t); throw new GwtRpcException(t.getMessage()); } }
Example #4
Source File: CommandSerializationPolicy.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void validateDeserialize(Class<?> clazz) throws SerializationException { if (!this.isInstantiable(clazz)) { throw new SerializationException("Type '" + clazz.getName() + "' was not assignableJRE_BLACKSET to '" + IsSerializable.class.getName() + "' and did not have a custom field serializer. " + "For security purposes, this type will not be deserialized."); } }
Example #5
Source File: CommandSerializationPolicy.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void validateSerialize(Class<?> clazz) throws SerializationException { if (!this.isInstantiable(clazz)) { throw new SerializationException("Type '" + clazz.getName() + "' was not assignable to '" + IsSerializable.class.getName() + "' and did not have a custom field serializer." + "For security purposes, this type will not be serialized."); } }
Example #6
Source File: GwtRpcException.java From unitime with Apache License 2.0 | 4 votes |
public GwtRpcException(String message, Throwable cause) { super(message, cause); if (cause instanceof IsSerializable) iCause = cause; }
Example #7
Source File: GwtRpcServlet.java From unitime with Apache License 2.0 | 4 votes |
@Override public <T extends GwtRpcResponse> T execute(GwtRpcRequest<T> request) throws GwtRpcException { // start time long t0 = JProf.currentTimeMillis(); GwtRpcLogging logging = null; // create helper try { // retrieve implementation from given request GwtRpcImplementation<GwtRpcRequest<T>, T> implementation = getImplementation(request); // get logging logging = implementation.getClass().getAnnotation(GwtRpcLogging.class); // execute request T response = implementation.execute(request, getSessionContext()); // log request log(request, response, null, JProf.currentTimeMillis() - t0, getSessionContext(), logging); // return response return response; } catch (Throwable t) { // log exception log(request, null, t, JProf.currentTimeMillis() - t0, getSessionContext(), logging); // re-throw exception as GwtRpcException or IsSerializable runtime exception if (t instanceof GwtRpcException) { GwtRpcException e = (GwtRpcException)t; if (e.hasCause()) sLog.warn("Seen server exception: " + e.getMessage(), e); else sLog.info("Seen server exception: " + e.getMessage()); throw e; } if (t instanceof AccessDeniedException) throw new PageAccessException(t.getMessage(), t); if (t instanceof IsSerializable) { if (t.getCause() != null) sLog.error("Seen server exception: " + t.getMessage(), t); else sLog.warn("Seen server exception: " + t.getMessage(), t); throw new GwtRpcException(t.getMessage(), t); } sLog.error("Seen exception: " + t.getMessage(), t); throw new GwtRpcException(t.getMessage()); } }
Example #8
Source File: GwtRpcServlet.java From unitime with Apache License 2.0 | 4 votes |
@Override public void run() { iRunning = true; Localization.setLocale(iLocale); ApplicationProperties.setSessionId(iContext.getUser() == null ? null : iContext.getUser().getCurrentAcademicSessionId()); // start time long t0 = JProf.currentTimeMillis(); GwtRpcLogging logging = null; try { // retrieve implementation from given request GwtRpcImplementation<GwtRpcRequest<T>, T> implementation = getImplementation(iRequest); // get logging logging = implementation.getClass().getAnnotation(GwtRpcLogging.class); // execute request iResponse = implementation.execute(iRequest, iContext); // log request log(iRequest, iResponse, null, JProf.currentTimeMillis() - t0, iContext, logging); } catch (Throwable t) { // log exception log(iRequest, null, t, JProf.currentTimeMillis() - t0, iContext, logging); // re-throw exception as GwtRpcException or IsSerializable runtime exception if (t instanceof GwtRpcException) { iException = (GwtRpcException)t; if (iException.hasCause()) sLog.warn("Seen server exception: " + t.getMessage(), t.getCause()); else sLog.info("Seen server exception: " + t.getMessage()); } else if (t instanceof IsSerializable) { if (t.getCause() != null) sLog.error("Seen server exception: " + t.getMessage(), t); else sLog.warn("Seen server exception: " + t.getMessage(), t); iException = new GwtRpcException(t.getMessage(), t); } else { sLog.error("Seen exception: " + t.getMessage(), t); iException = new GwtRpcException(t.getMessage()); } } finally { Localization.removeLocale(); Formats.removeFormats(); ApplicationProperties.setSessionId(null); _RootDAO.closeCurrentThreadSessions(); } synchronized (this) { iWaitingThread = null; iRunning = false; iContext = null; } }