public static String encodeResponseForFailure(Method serviceMethod, Throwable cause, SerializationPolicy serializationPolicy, int flags) throws SerializationException { if (cause == null) { throw new NullPointerException("cause cannot be null"); } if (serializationPolicy == null) { throw new NullPointerException("serializationPolicy"); } if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) { throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod) + "' threw an unexpected exception: " + cause.toString(), cause); } return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy); }
private AtmosphereResource getAtmosphereResource() { AtmosphereResource atm = (AtmosphereResource) getThreadLocalRequest().getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); if (atm == null) { throw new UnexpectedException("Failed to find Atmosphere resource have you setup Atmosphere?", null); } return atm; }
public static String encodeResponseForFailure(Method serviceMethod, Throwable cause, SerializationPolicy serializationPolicy, int flags) throws SerializationException { if (cause == null) { throw new NullPointerException("cause cannot be null"); } if (serializationPolicy == null) { throw new NullPointerException("serializationPolicy"); } if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) { throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod) + "' threw an unexpected exception: " + cause.toString(), cause); } return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy); }
public static String encodeResponseForFailure(Method serviceMethod, Throwable cause, SerializationPolicy serializationPolicy, int flags) throws SerializationException { if (cause == null) { throw new NullPointerException("cause cannot be null"); } if (serializationPolicy == null) { throw new NullPointerException("serializationPolicy"); } if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) { throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod) + "' threw an unexpected exception: " + cause.toString(), cause); } return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy); }
protected boolean isSuspended() { AtmosphereResource atm = getAtmosphereResource(); if (atm == null) { throw new UnexpectedException("Failed to find Atmosphere resource have you setup Atmosphere?", null); } Boolean var = (Boolean) atm.getRequest().getAttribute(GWT_SUSPENDED); return Boolean.TRUE.equals(var); }
protected SuspendInfo suspend() { AtmosphereResource atm = getAtmosphereResource(); if (atm == null) { throw new UnexpectedException("Failed to find Atmosphere resource have you setup Atmosphere?", null); } atm.getRequest().setAttribute(GWT_SUSPENDED, true); atm.suspend(-1, false); return new SuspendInfo(atm); }