ClientResource cr = new ClientResource("http://targetDomain/path"); cr.put(cr.toRepresentation(myPojo, new Variant(MediaType.APPLICATION_JSON));
/** * Patches a resource with the given object as delta state. Automatically * serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity containing the patch. * @return The optional result entity. * @throws ResourceException * @see <a href="https://tools.ietf.org/html/rfc5789">HTTP PATCH method</a> */ public Representation patch(Object entity) throws ResourceException { try { return patch(toRepresentation(entity)); } catch (IOException e) { throw new ResourceException(e); } }
/** * Puts an object entity. Automatically serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity to post. * @param mediaType * The media type of the representation to retrieve. * @return The response object entity. * @throws ResourceException * @see <a * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6">HTTP * PUT method</a> */ public Representation put(Object entity, MediaType mediaType) throws ResourceException { try { return handle(Method.PUT, toRepresentation(entity), mediaType); } catch (IOException e) { throw new ResourceException(e); } }
/** * Posts an object entity. Automatically serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity to post. * @return The optional result entity. * @throws ResourceException * @see <a * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5">HTTP * POST method</a> */ public Representation post(Object entity) throws ResourceException { try { return post(toRepresentation(entity)); } catch (IOException e) { throw new ResourceException(e); } }
/** * Puts an object entity. Automatically serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity to put. * @return The optional result entity. * @throws ResourceException * @see <a * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6">HTTP * PUT method</a> */ public Representation put(Object entity) throws ResourceException { try { return put(toRepresentation(entity)); } catch (IOException e) { throw new ResourceException(e); } }
/** * Patches a resource with the given object as delta state. Automatically * serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity containing the patch. * @param mediaType * The media type of the representation to retrieve. * @return The response object entity. * @throws ResourceException * @see <a href="https://tools.ietf.org/html/rfc5789">HTTP PATCH method</a> */ public Representation patch(Object entity, MediaType mediaType) throws ResourceException { try { return handle(Method.PATCH, toRepresentation(entity), mediaType); } catch (IOException e) { throw new ResourceException(e); } }
/** * Posts an object entity. Automatically serializes the object using the * {@link org.restlet.service.ConverterService}. * * @param entity * The object entity to post. * @param mediaType * The media type of the representation to retrieve. * @return The response object entity. * @throws ResourceException * @see <a * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5">HTTP * POST method</a> */ public Representation post(Object entity, MediaType mediaType) throws ResourceException { try { return handle(Method.POST, toRepresentation(entity), mediaType); } catch (IOException e) { throw new ResourceException(e); } }
request.setEntity(getClientResource().toRepresentation(value));
try { entityVariants = cs.getVariants(entity.getClass(), null); request.setEntity(toRepresentation( entity, getConnegService().getPreferredVariant(entityVariants,
} else { requestEntity = getClientResource() .toRepresentation(o);