org.apache.commons.httpclient.URI.getDefaultProtocolCharset()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(89)

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

URI.getDefaultProtocolCharset介绍

[英]Get the default charset of the protocol.

An individual URI scheme may require a single charset, define a default charset, or provide a way to indicate the charset used.

To work globally either requires support of a number of character sets and to be able to convert between them, or the use of a single preferred character set. For support of global compatibility it is STRONGLY RECOMMENDED that clients and servers use UTF-8 encoding when exchanging URIs.
[中]获取协议的默认字符集。
单个URI方案可能需要单个字符集、定义默认字符集或提供一种指示所用字符集的方法。
要全局工作,要么需要支持多个字符集并能够在它们之间进行转换,要么需要使用单个首选字符集。为了支持全局兼容性,强烈建议客户端和服务器在交换URI时使用UTF-8编码。

代码示例

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as the path component of an URI with
 * the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePath(String unescaped) throws URIException {
  return encodePath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as the path and query components of
 * an URI with the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePathQuery(String unescaped) throws URIException {
  return encodePathQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a given string with allowed characters not to be
 * escaped and the default protocol charset.
 *
 * @param unescaped a string
 * @param allowed allowed characters not to be escaped
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 */
public static String encode(String unescaped, BitSet allowed)
  throws URIException {
  return encode(unescaped, allowed, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Get the all escaped and encoded string with the default protocl charset.
 * It's the same function to use <code>encode(String unescaped, Bitset
 * empty, URI.getDefaultProtocolCharset())</code>.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 *
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeAll(String unescaped) throws URIException {
  return encodeAll(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as within the authority component of
 * an URI with the default protocol charset.
 * Within the authority component, the characters ";", ":", "@", "?", and
 * "/" are reserved.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeWithinAuthority(String unescaped)
  throws URIException {
  return encodeWithinAuthority(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as the query component of an URI with
 * the default protocol charset.
 * When a query string is not misunderstood the reserved special characters
 * ("&amp;", "=", "+", ",", and "$") within a query component, this method
 * is recommended to use in encoding the whole query.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeQuery(String unescaped) throws URIException {
  return encodeQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as within the path component of an
 * URI with the default protocol charset.
 * The path may consist of a sequence of path segments separated by a
 * single slash "/" character.  Within a path segment, the characters
 * "/", ";", "=", and "?" are reserved.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeWithinPath(String unescaped)
  throws URIException {
  return encodeWithinPath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as within the query component of an
 * URI with the default protocol charset.
 * When a query comprise the name and value pairs, it is used in order
 * to encode each name and value string.  The reserved special characters
 * within a query component are being included in encoding the query.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeWithinQuery(String unescaped)
  throws URIException {
  return encodeWithinQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Unescape and decode a given string regarded as an escaped string with the
 * default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * 
 * @throws URIException if the string cannot be decoded (invalid)
 * 
 * @see URI#getDefaultProtocolCharset
 */
public static String decode(String escaped) throws URIException {
  try {
    byte[] rawdata = URLCodec.decodeUrl(EncodingUtil.getAsciiBytes(escaped));
    return EncodingUtil.getString(rawdata, URI.getDefaultProtocolCharset());
  } catch (DecoderException e) {
    throw new URIException(e.getMessage());
  }
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as the path and query components of
 * an URI with the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePathQuery(String unescaped) throws URIException {
  return encodePathQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Escape and encode a string regarded as the path and query components of
 * an URI with the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePathQuery(String unescaped) throws URIException {
  return encodePathQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Escape and encode a string regarded as the path component of an URI with
 * the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePath(String unescaped) throws URIException {
  return encodePath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Escape and encode a string regarded as the path component of an URI with
 * the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePath(String unescaped) throws URIException {
  return encodePath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Escape and encode a string regarded as the path and query components of
 * an URI with the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePathQuery(String unescaped) throws URIException {
  return encodePathQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Get the all escaped and encoded string with the default protocl charset.
 * It's the same function to use <code>encode(String unescaped, Bitset
 * empty, URI.getDefaultProtocolCharset())</code>.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 *
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeAll(String unescaped) throws URIException {
  return encodeAll(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Escape and encode a string regarded as the path and query components of
 * an URI with the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePathQuery(String unescaped) throws URIException {
  return encodePathQuery(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Escape and encode a string regarded as the path component of an URI with
 * the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePath(String unescaped) throws URIException {
  return encodePath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Escape and encode a string regarded as the path component of an URI with
 * the default protocol charset.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 * 
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodePath(String unescaped) throws URIException {
  return encodePath(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Get the all escaped and encoded string with the default protocl charset.
 * It's the same function to use <code>encode(String unescaped, Bitset
 * empty, URI.getDefaultProtocolCharset())</code>.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 *
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeAll(String unescaped) throws URIException {
  return encodeAll(unescaped, URI.getDefaultProtocolCharset());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Get the all escaped and encoded string with the default protocl charset.
 * It's the same function to use <code>encode(String unescaped, Bitset
 * empty, URI.getDefaultProtocolCharset())</code>.
 *
 * @param unescaped an unescaped string
 * @return the escaped string
 * 
 * @throws URIException if the default protocol charset is not supported
 *
 * @see URI#getDefaultProtocolCharset
 * @see #encode
 */
public static String encodeAll(String unescaped) throws URIException {
  return encodeAll(unescaped, URI.getDefaultProtocolCharset());
}

相关文章