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

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

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

Reference.setAuthority介绍

[英]Sets the authority component for hierarchical identifiers.
[中]设置层次标识符的权限组件。

代码示例

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

/**
 * Sets the user info component for server based hierarchical identifiers.
 * 
 * @param userInfo
 *            The user info component for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority part has not been defined.
 */
public void setUserInfo(String userInfo) {
  final String authority = getAuthority();
  if (authority != null) {
    final int index = authority.indexOf('@');
    final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
    if (index != -1) {
      setAuthority(newUserInfo + authority.substring(index + 1));
    } else {
      setAuthority(newUserInfo + authority);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Sets the user info component for server based hierarchical identifiers.
 * 
 * @param userInfo
 *            The user info component for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority part has not been defined.
 */
public void setUserInfo(String userInfo) {
  final String authority = getAuthority();
  if (authority != null) {
    final int index = authority.indexOf('@');
    final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
    if (index != -1) {
      setAuthority(newUserInfo + authority.substring(index + 1));
    } else {
      setAuthority(newUserInfo + authority);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

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

/**
 * Sets the user info component for server based hierarchical identifiers.
 * 
 * @param userInfo
 *            The user info component for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority part has not been defined.
 */
public void setUserInfo(String userInfo) {
  final String authority = getAuthority();
  if (authority != null) {
    final int index = authority.indexOf('@');
    final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
    if (index != -1) {
      setAuthority(newUserInfo + authority.substring(index + 1));
    } else {
      setAuthority(newUserInfo + authority);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

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

setAuthority(domain);
} else {
  if (domain == null) {
      setAuthority(authority.substring(0, indexUI + 1) + domain
          + authority.substring(indexP));
    } else {
      setAuthority(authority.substring(0, indexUI + 1) + domain);
      setAuthority(domain + authority.substring(indexP));
    } else {
      setAuthority(domain);

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

setAuthority(domain);
} else {
  if (domain == null) {
      setAuthority(authority.substring(0, index1 + 1) + domain
          + authority.substring(index2));
    } else {
      setAuthority(authority.substring(0, index1 + 1) + domain);
      setAuthority(domain + authority.substring(index2));
    } else {
      setAuthority(domain);

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

/**
 * Sets the optional port number for server based hierarchical identifiers.
 * 
 * @param port
 *            The optional port number for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority has not been defined.
 */
public void setHostPort(Integer port) {
  final String authority = getAuthority();
  if (authority != null) {
    final int index1 = authority.indexOf('@');
    // We must prevent the case where the userinfo part contains ':'
    final int index = authority.indexOf(':',
        (index1 == -1 ? 0 : index1));
    final String newPort = (port == null) ? "" : ":" + port;
    if (index != -1) {
      setAuthority(authority.substring(0, index) + newPort);
    } else {
      setAuthority(authority + newPort);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

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

/**
 * Sets the optional port number for server based hierarchical identifiers.
 * 
 * @param port
 *            The optional port number for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority has not been defined.
 */
public void setHostPort(Integer port) {
  final String authority = getAuthority();
  if (authority != null) {
    // We must prevent the case where the userinfo part contains ':'
    // and the case of IPV6 addresses
    int indexUI = authority.indexOf('@'); // user info
    int indexIPV6 = authority.indexOf(']'); // IPV6
    int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI
        : indexIPV6);
    String newPort = (port == null) ? "" : ":" + port;
    if (index != -1) {
      setAuthority(authority.substring(0, index) + newPort);
    } else {
      setAuthority(authority + newPort);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

setAuthority(domain);
} else {
  if (domain == null) {
      setAuthority(authority.substring(0, indexUI + 1) + domain
          + authority.substring(indexP));
    } else {
      setAuthority(authority.substring(0, indexUI + 1) + domain);
      setAuthority(domain + authority.substring(indexP));
    } else {
      setAuthority(domain);

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Sets the optional port number for server based hierarchical identifiers.
 * 
 * @param port
 *            The optional port number for server based hierarchical
 *            identifiers.
 * @throws IllegalArgumentException
 *             If the autority has not been defined.
 */
public void setHostPort(Integer port) {
  final String authority = getAuthority();
  if (authority != null) {
    // We must prevent the case where the userinfo part contains ':'
    // and the case of IPV6 addresses
    int indexUI = authority.indexOf('@'); // user info
    int indexIPV6 = authority.indexOf(']'); // IPV6
    int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI
        : indexIPV6);
    String newPort = (port == null) ? "" : ":" + port;
    if (index != -1) {
      setAuthority(authority.substring(0, index) + newPort);
    } else {
      setAuthority(authority + newPort);
    }
  } else {
    throw new IllegalArgumentException(
        "No authority defined, please define a host name first");
  }
}

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

result.setAuthority(authority);
  result.setPath(path);
  result.setQuery(query);
} else {
  result.setAuthority(baseReference.getAuthority());

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

result.setAuthority(authority);
  result.setPath(path);
  result.setQuery(query);
} else {
  result.setAuthority(baseReference.getAuthority());

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

result.setAuthority(authority);
  result.setPath(path);
  result.setQuery(query);
} else {
  result.setAuthority(baseReference.getAuthority());

相关文章

Reference类方法