@Override public void setEntity(Object entity) { acr.setEntity(entity); }
@Override public void setEntity(Object entity, Type entityType) { acr.setEntity(entity, entityType); }
@Override public void setEntity(Object entity) { setEntity(entity, (entity == null) ? null : entity.getClass()); }
@Override public void setResponse(Response response) { this.isCommitted = false; this.out = null; this.response = response = (response != null) ? response : Responses.noContent().build(); this.mappedThrowable = null; if (response instanceof ResponseImpl) { final ResponseImpl responseImpl = (ResponseImpl)response; setStatusType(responseImpl.getStatusType()); setHeaders(response.getMetadata()); setEntity(responseImpl.getEntity(), responseImpl.getEntityType()); } else { setStatus(response.getStatus()); setHeaders(response.getMetadata()); setEntity(response.getEntity()); } }
@Override public void setEntity(Object entity, Type entityType) { acr.setEntity(entity, entityType); }
@Override public void setEntity(Object entity) { acr.setEntity(entity); }
@Override public void setEntity(Object entity) { acr.setEntity(entity); }
@Override public void setEntity(Object entity, Type entityType) { acr.setEntity(entity, entityType); }
@Override public void setEntity(Object entity) { setEntity(entity, (entity == null) ? null : entity.getClass()); }
@Override public void setEntity(Object entity) { setEntity(entity, (entity == null) ? null : entity.getClass()); }
public class MyFilter implements ContainerResponseFilter { @Override public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { response.setEntity(new Transaction(response.getEntity())); return response; } }
public class PurgeErrorEntityResponseFilter implements ContainerResponseFilter { @Override public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { if(response.getStatus() == 400) { response.setEntity(null); } return response; } }
public void run() { Entry msg = null; try { msg = messages.take(); // Leader/follower bc.getExecutorService().submit(this); if (msg.eventsToPush == null) { for (ContainerResponse r : containerResponses) { synchronized (r) { r.reset(); r.setEntity(msg.message); broadcast(r); } } } } catch (InterruptedException ex) { LoggerUtils.getLogger().log(Level.SEVERE, null, ex); } finally { if (msg != null){ msg.f.done(); } } } });
@Override public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { if (!MediaType.APPLICATION_JSON_TYPE.isCompatible(response.getMediaType())) { return response; } final List<String> fieldsParam = request.getQueryParameters().get("fields"); if (fieldsParam == null) { return response; } final Object entity = response.getEntity(); if (entity == null) { return response; } final JsonNode tree = mapper.convertValue(entity, JsonNode.class); final Set<String> fields = expandFields(fieldsParam); if (tree.isObject()) { filterFields("", (ObjectNode) tree, fields); response.setEntity(tree); } else if (tree.isArray()) { filterFields("", (ArrayNode) tree, fields); response.setEntity(tree); } return response; }
@Override public void setResponse(Response response) { this.isCommitted = false; this.out = null; this.response = response = (response != null) ? response : Responses.noContent().build(); this.mappedThrowable = null; if (response instanceof ResponseImpl) { final ResponseImpl responseImpl = (ResponseImpl)response; setStatusType(responseImpl.getStatusType()); setHeaders(response.getMetadata()); setEntity(responseImpl.getEntity(), responseImpl.getEntityType()); } else { setStatus(response.getStatus()); setHeaders(response.getMetadata()); setEntity(response.getEntity()); } }
@Override public void setResponse(Response response) { this.isCommitted = false; this.out = null; this.response = response = (response != null) ? response : Responses.noContent().build(); this.mappedThrowable = null; if (response instanceof ResponseImpl) { final ResponseImpl responseImpl = (ResponseImpl)response; setStatusType(responseImpl.getStatusType()); setHeaders(response.getMetadata()); setEntity(responseImpl.getEntity(), responseImpl.getEntityType()); } else { setStatus(response.getStatus()); setHeaders(response.getMetadata()); setEntity(response.getEntity()); } }
void broadcast(ContainerResponse r, AtmosphereEvent e){ Object o = r.getEntity(); // Something went wrong if null. if (o instanceof Broadcastable) { addFilter(((Broadcastable<String>) o).b); r.setEntity(((Broadcastable<String>) o).broadcast()); } else if (o != null) { addFilter(e.getBroadcaster()); try { e.getBroadcaster().broadcast(o).get(); } catch (InterruptedException ex) { logger.log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { logger.log(Level.SEVERE, null, ex); } } }
response.setEntity(null); r.suspend(timeout); } catch (IOException ex) {