当前位置: 首页>>代码示例>>Java>>正文


Java UrlUtil类代码示例

本文整理汇总了Java中com.sun.jndi.toolkit.url.UrlUtil的典型用法代码示例。如果您正苦于以下问题:Java UrlUtil类的具体用法?Java UrlUtil怎么用?Java UrlUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UrlUtil类属于com.sun.jndi.toolkit.url包,在下文中一共展示了UrlUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DnsUrl

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
public DnsUrl(String url) throws MalformedURLException {
    super(url);

    if (!scheme.equals("dns")) {
        throw new MalformedURLException(
                url + " is not a valid DNS pseudo-URL");
    }

    domain = path.startsWith("/")
        ? path.substring(1)
        : path;
    domain = domain.equals("")
        ? "."
        : UrlUtil.decode(domain);

    // Debug
    // System.out.println("host=" + host + " port=" + port +
    //                    " domain=" + domain);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:DnsUrl.java

示例2: constructProviderUrl

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
private static String constructProviderUrl(String domain,
                                           String[] servers) {
    String path = "";
    if (!domain.equals(".")) {
        try {
            path = "/" + UrlUtil.encode(domain, "ISO-8859-1");
        } catch (java.io.UnsupportedEncodingException e) {
            // assert false : "ISO-Latin-1 charset unavailable";
        }
    }

    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < servers.length; i++) {
        if (i > 0) {
            buf.append(' ');
        }
        buf.append("dns://").append(servers[i]).append(path);
    }
    return buf.toString();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:DnsContextFactory.java

示例3: toUrlString

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
static String toUrlString(String host, int port, String dn, boolean useSsl)
    {

    try {
        String h = (host != null) ? host : "";
        if ((h.indexOf(':') != -1) && (h.charAt(0) != '[')) {
            h = "[" + h + "]";          // IPv6 literal
        }
        String p = (port != -1) ? (":" + port) : "";
        String d = (dn != null) ? ("/" + UrlUtil.encode(dn, "UTF8")) : "";

        return useSsl ? "ldaps://" + h + p + d : "ldap://" + h + p + d;
    } catch (UnsupportedEncodingException e) {
        // UTF8 should always be supported
        throw new IllegalStateException("UTF-8 encoding unavailable");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LdapURL.java

示例4: constructProviderUrl

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
private static String constructProviderUrl(String domain,
                                           String[] servers) {
    String path = "";
    if (!domain.equals(".")) {
        try {
            path = "/" + UrlUtil.encode(domain, "ISO-8859-1");
        } catch (java.io.UnsupportedEncodingException e) {
            // assert false : "ISO-Latin-1 charset unavailable";
        }
    }

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < servers.length; i++) {
        if (i > 0) {
            sb.append(' ');
        }
        sb.append("dns://").append(servers[i]).append(path);
    }
    return sb.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:DnsContextFactory.java

示例5: showDocument

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
@Override
public void showDocument(URL url, String target) {
    // If it is a javascript document, eval on current page.
    if ("javascript".equals(url.getProtocol())) {
        // Snip protocol off string
        String evalString = url.toString().substring("javascript:".length());
        eval(getWindow(), evalString);
        return;
    }
    try {
        Long reference = getRequestIdentifier();
        write("reference " + reference +  " LoadURL " + UrlUtil.encode(url.toString(), "UTF-8") + " " + target);
    } catch (IOException exception) {
        // Deliberately ignore IOException.  showDocument may be
        // called from threads other than the main thread after
        // streamhandler.pluginOutputStream has been closed.
    }
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:19,代码来源:PluginAppletViewer.java

示例6: put

import com.sun.jndi.toolkit.url.UrlUtil; //导入依赖的package包/类
@Override
public void put(URI uri,
        Map<String, List<String>> responseHeaders) throws IOException {
    super.put(uri, responseHeaders);

    for (Map.Entry<String, List<String>> headerEntry : responseHeaders.entrySet()) {
        String type = headerEntry.getKey();
        if ("Set-Cookie".equalsIgnoreCase(type) || "Set-Cookie2".equalsIgnoreCase(type)) {
            List<String> cookies = headerEntry.getValue();
            for (String cookie : cookies) {
                streamHandler.write("plugin PluginSetCookie reference -1 " + UrlUtil.encode(uri.toString(), "UTF-8") + " " + cookie);
            }
        }

    }
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:17,代码来源:PluginCookieManager.java


注:本文中的com.sun.jndi.toolkit.url.UrlUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。