/** * Constructor. * * @param serviceUri * The service URI. * @throws IOException */ public Service(String serviceUri) throws IOException { this(new Client(Protocol.HTTP), serviceUri); }
/** * Constructor. * * @param serviceUri * The service URI. * @param xmlService * The XML introspection document. * @throws IOException */ public Service(String serviceUri, Representation xmlService) throws IOException { this(new Client(Protocol.HTTP), serviceUri, xmlService); }
protected AbstractBaseClient(final ServerContext context) { this(context, new Client(Arrays.asList(Protocol.HTTP, Protocol.HTTPS))); }
/** * Adds a new client connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added client. */ public Client add(Protocol protocol) { final Client result = new Client(protocol); // result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Constructor. * * @param serviceUri * The service URI. * @throws IOException */ public Service(String serviceUri) throws IOException { this(new Client(new Reference(serviceUri).getSchemeProtocol()), serviceUri); }
/** * Constructor. * * @param categoriesUri * The feed URI. * @throws IOException */ public Categories(String categoriesUri) throws IOException { this(new Client(new Reference(categoriesUri).getSchemeProtocol()), categoriesUri); }
/** * Constructor. * * @param serviceUri * The service URI. * @throws IOException */ public Service(String serviceUri) throws IOException { this(new Client(new Reference(serviceUri).getSchemeProtocol()), serviceUri); }
/** * Constructor. * * @param feedUri * The feed URI. * @throws IOException */ public Feed(String feedUri) throws IOException { this(new Client(new Reference(feedUri).getSchemeProtocol()), feedUri); }
/** * Constructor. * * @param entryUri * The entry URI. * @throws IOException */ public Entry(String entryUri) throws IOException { this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri); }
/** * Constructor. * * @param entryUri * The entry URI. * @throws IOException */ public Entry(String entryUri) throws IOException { this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri); }
/** * Constructor. * * @param categoriesUri * The feed URI. * @throws IOException */ public Categories(String categoriesUri) throws IOException { this(new Client(new Reference(categoriesUri).getSchemeProtocol()), categoriesUri); }
/** * Constructor. * * @param feedUri * The feed URI. * @throws IOException */ public Feed(String feedUri) throws IOException { this(new Client(new Reference(feedUri).getSchemeProtocol()), feedUri); }
/** * Constructor. * * @param serviceUri * The service URI. * @param xmlService * The XML introspection document. * @throws IOException */ public Service(String serviceUri, Representation xmlService) throws IOException { this(new Client(new Reference(serviceUri).getSchemeProtocol()), serviceUri, xmlService); }
/** * Constructor. * * @param serviceUri * The service URI. * @param xmlService * The XML introspection document. * @throws IOException */ public Service(String serviceUri, Representation xmlService) throws IOException { this(new Client(new Reference(serviceUri).getSchemeProtocol()), serviceUri, xmlService); }
/** * Adds a new client connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added client. */ public Client add(Protocol protocol) { final Client result = new Client(protocol); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Adds a new client connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added client. */ public Client add(Protocol protocol) { final Client result = new Client(protocol); result.setContext(getContext().createChildContext()); add(result); return result; }
public RestClientHelper( String baseUrl, String username, String password ) { ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC; ChallengeResponse authentication = new ChallengeResponse( scheme, username, password ); this.challenge = authentication; this.baseUrl = baseUrl; this.restContext = new Context(); this.restClient = new Client( restContext, Protocol.HTTP ); xstream = XStreamConfigurator.configureXStream( new XStream( new LookAheadXppDriver() ) ); MIndexerXStreamConfigurator.configureXStream( xstream ); }
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; }
public static void main(String[] args) throws Exception { Client client = new Client(new Context(), Protocol.HTTPS); Series<Parameter> parameters = client.getContext().getParameters(); parameters.add("truststorePath", "src/org/restlet/example/book/restlet/ch05/clientTrust.jks"); parameters.add("truststorePassword", "password"); parameters.add("truststoreType", "JKS"); ClientResource clientResource = new ClientResource( "https://localhost:8183/accounts/chunkylover53/mails/123"); clientResource.setNext(client); MailResource mailClient = clientResource.wrap(MailResource.class); mailClient.store(mailClient.retrieve()); client.stop(); }