org.restlet.data.Reference.getSchemeProtocol()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.restlet.data.Reference.getSchemeProtocol方法的一些代码示例,展示了Reference.getSchemeProtocol的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getSchemeProtocol方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getSchemeProtocol

Reference.getSchemeProtocol介绍

[英]Returns the protocol associated with the scheme component.
[中]返回与方案组件关联的协议。

代码示例

代码示例来源:origin: org.restlet.osgi/org.restlet

@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;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param entryUri
 *            The entry URI.
 * @throws IOException
 */
public Entry(String entryUri) throws IOException {
  this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param categoriesUri
 *            The feed URI.
 * @throws IOException
 */
public Categories(String categoriesUri) throws IOException {
  this(new Client(new Reference(categoriesUri).getSchemeProtocol()),
      categoriesUri);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param feedUri
 *            The feed URI.
 * @throws IOException
 */
public Feed(String feedUri) throws IOException {
  this(new Client(new Reference(feedUri).getSchemeProtocol()), feedUri);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param entryUri
 *            The entry URI.
 * @throws IOException
 */
public Entry(String entryUri) throws IOException {
  this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param serviceUri
 *            The service URI.
 * @throws IOException
 */
public Service(String serviceUri) throws IOException {
  this(new Client(new Reference(serviceUri).getSchemeProtocol()),
      serviceUri);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param categoriesUri
 *            The feed URI.
 * @throws IOException
 */
public Categories(String categoriesUri) throws IOException {
  this(new Client(new Reference(categoriesUri).getSchemeProtocol()),
      categoriesUri);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param serviceUri
 *            The service URI.
 * @throws IOException
 */
public Service(String serviceUri) throws IOException {
  this(new Client(new Reference(serviceUri).getSchemeProtocol()),
      serviceUri);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Constructor.
 * 
 * @param feedUri
 *            The feed URI.
 * @throws IOException
 */
public Feed(String feedUri) throws IOException {
  this(new Client(new Reference(feedUri).getSchemeProtocol()), feedUri);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * 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);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * 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);
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * 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;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * 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;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@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());
  }
}

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

baseRef.getHostPort(), baseRef.getSchemeProtocol()
        .getSchemeName(), baseRef.getPath(), scheme);
definition.getEndpoints().add(endpoint);

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

baseRef.getHostPort(), baseRef.getSchemeProtocol()
        .getSchemeName(), baseRef.getPath(), scheme);
definition.getEndpoints().add(endpoint);

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
 * 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;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

Protocol protocol = getBaseRef().getSchemeProtocol();
int port = getBaseRef().getHostPort();
boolean exists = false;

代码示例来源:origin: org.restlet/org.restlet

Protocol protocol = xmlConfigReference.getSchemeProtocol();
if (Protocol.FILE.equals(protocol)) {

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * 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;
}

相关文章

Reference类方法