/** * Updates the client preferences to accept the given metadata (media types, * character sets, etc.) with a given quality in addition to existing ones. * * @param metadata * The metadata to accept. * @param quality * The quality to set. * @see ClientInfo#accept(Metadata, float) */ public void accept(Metadata metadata, float quality) { getClientInfo().accept(metadata, quality); }
/** * Handles the call by cloning the prototype request, setting the method and * entity. * * @param method * The request method to use. * @param entity * The request entity to set. * @return The optional response entity. */ protected Representation handle(Method method, Representation entity) { return handle(method, entity, getClientInfo()); }
/** * Updates the client preferences to accept the given metadata (media types, * character sets, etc.) with a 1.0 quality in addition to existing ones. * * @param metadata * The metadata to accept. * @see ClientInfo#accept(Metadata...) */ public void accept(Metadata... metadata) { getClientInfo().accept(metadata); }
final Context context = new Context(); context.getParameters().set("maxConnectionsPerHost", "20"); final ClientResource requestResource = new ClientResource(context, "http://localhost:8182/request"); requestResource.getClientInfo().setAgent("Example-Client/1.0");
connNegList.add(new Preference<MediaType>(MediaType.TEXT_HTML, 1.0f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
throws ResourceException { org.restlet.service.ConverterService cs = getConverterService(); ClientInfo clientInfo = getClientInfo();
connNegList.add(new Preference<MediaType>(MediaType.APPLICATION_JSON, 0.9f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
connNegList.add(new Preference<MediaType>(MediaType.APPLICATION_JSON, 0.9f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
connNegList.add(new Preference<MediaType>(MediaType.TEXT_HTML, 0.9f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
connNegList.add(new Preference<MediaType>(RestletUtilMediaType.APPLICATION_RDF_JSON, 1.0f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
connNegList.add(new Preference<MediaType>(MediaType.APPLICATION_RDF_XML, 1.0f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);
connNegList.add(new Preference<MediaType>(mediaType, 1.0f)); creationClientResource.getClientInfo().setAcceptedMediaTypes(connNegList);