@Override public Restlet getNext(Request request, Response response) { Restlet result = super.getNext(request, response); if (result == null) { getLogger() .warning( "The protocol used by this request is not declared in the list of client connectors. (" + request.getResourceRef() .getSchemeProtocol() + "). In case you are using an instance of the Component class, check its \"clients\" property."); } return result; }
/** * 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 entryUri * The entry URI. * @throws IOException */ public Entry(String entryUri) throws IOException { this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri); }
/** * 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 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); }
/** * Returns the protocol used or to be used, if known. * * @return The protocol used or to be used. */ public Protocol getProtocol() { Protocol result = this.protocol; if ((result == null) && (getResourceRef() != null)) { // Attempt to guess the protocol to use // from the target reference scheme result = getResourceRef().getSchemeProtocol(); // Fallback: look at base reference scheme if (result == null) { result = (getResourceRef().getBaseRef() != null) ? getResourceRef() .getBaseRef().getSchemeProtocol() : null; } } return result; }
/** * Returns the protocol by first returning the resourceRef.schemeProtocol * property if it is set, or the baseRef.schemeProtocol property otherwise. * * @return The protocol or null if not available. */ public Protocol getProtocol() { Protocol result = null; if (getResourceRef() != null) { // Attempt to guess the protocol to use // from the target reference scheme result = getResourceRef().getSchemeProtocol(); // Fallback: look at base reference scheme if (result == null) { result = (getResourceRef().getBaseRef() != null) ? getResourceRef() .getBaseRef().getSchemeProtocol() : null; } } return result; }
@Override public void handle(Request request, Response response) { Protocol rProtocol = request.getProtocol(); Reference rReference = request.getResourceRef(); Protocol protocol = (rProtocol != null) ? rProtocol : (rReference != null) ? rReference .getSchemeProtocol() : null; if (protocol != null) { Client c = clients.get(protocol); if (c == null) { c = new Client(protocol); clients.put(protocol, c); getLogger().fine( "Added runtime client for protocol: " + protocol.getName()); } c.handle(request, response); } else { response.setStatus(Status.SERVER_ERROR_INTERNAL, "The server isn't properly configured to handle client calls."); getLogger().warning( "There is no protocol detected for this request: " + request.getResourceRef()); } }
baseRef.getHostPort(), baseRef.getSchemeProtocol() .getSchemeName(), baseRef.getPath(), scheme); definition.getEndpoints().add(endpoint);
baseRef.getHostPort(), baseRef.getSchemeProtocol() .getSchemeName(), baseRef.getPath(), scheme); definition.getEndpoints().add(endpoint);
/** * Attaches an application created from a WADL description document * available at a given URI reference. * * @param wadlRef * The URI reference to the WADL description document. * @return The created WADL application. */ public WadlApplication attach(Reference wadlRef) { WadlApplication result = null; // Adds some common client connectors to load the WADL documents if (!getClients().contains(wadlRef.getSchemeProtocol())) { getClients().add(wadlRef.getSchemeProtocol()); } // Get the WADL document final Response response = getContext().getClientDispatcher().handle( new Request(Method.GET, wadlRef)); if (response.getStatus().isSuccess() && response.isEntityAvailable()) { result = attach(response.getEntity()); } return result; }
Protocol protocol = getBaseRef().getSchemeProtocol(); int port = getBaseRef().getHostPort(); boolean exists = false;
Protocol protocol = xmlConfigReference.getSchemeProtocol(); if (Protocol.FILE.equals(protocol)) {
/** * Creates a next Restlet is no one is set. By default, it creates a new * {@link Client} based on the protocol of the resource's URI reference. * * @return The created next Restlet or null. */ protected Uniform createNext() { Uniform result = null; // Prefer the outbound root result = getApplication().getOutboundRoot(); if ((result == null) && (getContext() != null)) { // Try using directly the client dispatcher result = getContext().getClientDispatcher(); } if (result == null) { // As a final option, try creating a client connector Protocol rProtocol = getProtocol(); Reference rReference = getReference(); Protocol protocol = (rProtocol != null) ? rProtocol : (rReference != null) ? rReference.getSchemeProtocol() : null; if (protocol != null) { org.restlet.engine.util.TemplateDispatcher dispatcher = new org.restlet.engine.util.TemplateDispatcher(); dispatcher.setContext(getContext()); dispatcher.setNext(new Client(protocol)); result = dispatcher; } } return result; }