/** * Sets a textual entity. * * @param value * The represented string. * @param mediaType * The representation's media type. */ @Override public void setEntity(String value, MediaType mediaType) { getWrappedRequest().setEntity(value, mediaType); }
/** * Sets the entity representation. * * @param entity * The entity representation. */ @Override public void setEntity(Representation entity) { getWrappedRequest().setEntity(entity); }
/** * Sets the entity from a higher-level object. This object is converted to a * representation using the Application's converter service. If you want to * use this method to facilitate the setting of entities, you need to * provide a custom implementation of the ConverterService class, overriding * the toRepresentation(Object) method. * * @param object * The higher-level object. * @deprecated Since 1.1, the ConverterService is deprecated, with no * replacement as it doesn't fit well with content negotiation. * Most users prefer to handle those conversion in Resource * subclasses. */ @Override @Deprecated public void setEntity(Object object) { getWrappedRequest().setEntity(object); }
@Override protected int beforeHandle(Request request, Response response) { if (getMode() == MODE_REQUEST) { request.setEntity(transform(request.getEntity())); } return CONTINUE; }
@Override protected int beforeHandle(Request request, Response response) { if (getMode() == MODE_REQUEST) { request.setEntity(transform(request.getEntity())); } return CONTINUE; }
public Response sendRequest( Method method, String url, Representation representation ) { this.logger.debug( "Method: " + method.getName() + " url: " + url ); Request request = new Request(); request.setResourceRef( url ); request.setMethod( method ); if ( !Method.GET.equals( method ) && !Method.DELETE.equals( method ) ) { request.setEntity( representation ); } request.setChallengeResponse( this.challenge ); return this.restClient.handle( request ); }
request.setEntity( representation );
request.setEntity(representation);
private Response request(Method method, Reference uri, Representation representation, MediaType accepts, boolean checkSuccess) throws NotSuccessException { Request request = makeRequest(uri, accepts); request.setMethod(method); if (representation != null) { request.setEntity(representation); } Client client = new Client(Protocol.HTTP); Response response = client.handle(request); if (checkSuccess && !response.getStatus().isSuccess()) { logger.warn("Not success: " + response.getStatus()); throw new NotSuccessException(response.getStatus()); } return response; }
request.setEntity( representation );