@Override public void doError(Status errorStatus) { Representation representation = getResponse().getEntity(); if (representation.getMediaType().equals(MediaType.APPLICATION_JSON)) { // Do not throw an exception here. getLogger().fine("OAuth response is found."); // XXX: after #doError, the representation will disposed in // #handleInbound. return; } // ResourceException will be thrown. super.doError(errorStatus); }
/** * Returns the parent resource. The parent resource is defined in the sense * of hierarchical URIs. If the resource URI is not hierarchical, then an * exception is thrown. * * @return The parent resource. */ public ClientResource getParent() throws ResourceException { ClientResource result = null; if (getReference().isHierarchical()) { result = new ClientResource(this); result.setReference(getReference().getParentRef()); } else { doError(Status.CLIENT_ERROR_BAD_REQUEST, "The resource URI is not hierarchical."); } return result; }
/** * Handles the inbound call. Note that only synchronous calls are processed. * * @param response * @return The response's entity, if any. */ public Representation handleInbound(Response response) { if (response == null) { return null; } // Verify that the request was synchronous if (response.getRequest().isSynchronous()) { if (response.getStatus().isError()) { doError(response.getStatus()); return null; } return response.getEntity(); } return null; }
/** * Returns the child resource defined by its URI relatively to the current * resource. The child resource is defined in the sense of hierarchical * URIs. If the resource URI is not hierarchical, then an exception is * thrown. * * @param relativeRef * The URI reference of the child resource relatively to the * current resource seen as the parent resource. * @return The child resource. * @throws ResourceException */ public ClientResource getChild(Reference relativeRef) throws ResourceException { ClientResource result = null; if ((relativeRef != null) && relativeRef.isRelative()) { result = new ClientResource(this); result.setReference(new Reference(getReference().getTargetRef(), relativeRef).getTargetRef()); } else { doError(Status.CLIENT_ERROR_BAD_REQUEST, "The child URI is not relative."); } return result; }
getClientResource().doError(response.getStatus()); } else if (!annotationInfo.getJavaOutputType().equals( void.class)) {
getClientResource().doError(response.getStatus()); } else if (!annotationInfo.getJavaOutputType().equals( void.class)) {