Java 8 URLStreamHandlerFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 URLStreamHandlerFactory class.

This code example shows how to use the following methods:createURLStreamHandler
 
	public URLStreamHandler createURLStreamHandler(String protocol) {
		if (JIJConstants.INTERNAL_URL_PROTOCOL.equals(protocol)) 
			return new RsrcURLStreamHandler(classLoader);
		if (chainFac != null)
			return chainFac.createURLStreamHandler(protocol);
		return null; 
	} 
	 
	/** 
	 * Allow one other URLStreamHandler to be added. 
	 * URL.setURLStreamHandlerFactory does not allow 
	 * multiple factories to be added. 
	 * The chained factory is called for all other protocols, 
	 * except "rsrc". Use null to clear previously set Handler.  
	 * @param fac another factory to be chained with ours. 
	 */ 
	public void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) {
		chainFac = fac;
	} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createURLStreamHandler
This code example shows how to use the following methods:createURLStreamHandler
This code example shows how to use the following methods:createURLStreamHandler
		 
		// If the protocol is not supported try any delegate. 
		// Note - we may want to make the order in which the 
		// factories are used configurable. 
		if (ret == null && delegate_ != null)
		  ret = delegate_.createURLStreamHandler(protocol);
		   
		return ret;
	} 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createURLStreamHandler
This code example shows how to use the following methods:createURLStreamHandler
        String protocol = spec.substring(0, spec.indexOf(":"));
 
        // This is the important part: we use a URL Stream Handler Factory to find the URL Stream handler to use for 
        // the nested protocol. 
        this.jarFileURL =
            new URL(null, spec.substring(0, separator++), this.handlerFactory.createURLStreamHandler(protocol));
        this.entryName = null;
 
        /* if ! is the last letter of the innerURL, entryName is null */ 
        if (++separator != spec.length()) {
            this.entryName = spec.substring(separator, spec.length());
            try { 
                // Note: we decode using UTF8 since it's the W3C recommendation. 
                // See http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars 
                this.entryName = URLDecoder.decode(this.entryName, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                // Not supporting UTF-8 as a valid encoding for some reasons. We consider XWiki cannot work 
                // without that encoding. 
                throw new RuntimeException("Failed to URL decode [" + this.entryName + "] using UTF-8.", e);
            } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createURLStreamHandler
     *                if an I/O exception occurs. 
     * @see java.net.URL#openConnection() 
     */ 
    public static URLConnection openConnection(URLStreamHandlerFactory factory, URL url) throws java.io.IOException {
        log.info("openConnection start with url=" + url);
        URLStreamHandler handler = factory.createURLStreamHandler(url.getProtocol());
        URLConnection result = ((HttpHandler)handler).openConnection(url, null);
        log.info("openConnection end with result=" + result);
        return result;
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createURLStreamHandler
		public URLStreamHandler createURLStreamHandler(String protocol) {
			if ("rsrc".equals(protocol)) {
				return new RsrcURLStreamHandler(this.classLoader);
			} 
			if (this.chainFac != null) {
				return this.chainFac.createURLStreamHandler(protocol);
			} 
			return null; 
		} 
 
		public void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) {
			this.chainFac = fac;
		} 
	} 
 
	public static class RsrcURLConnection extends URLConnection {
		private ClassLoader classLoader;
 
		public RsrcURLConnection(URL url, ClassLoader classLoader) {
			super(url);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createURLStreamHandler
 
	public URLStreamHandler createURLStreamHandler(String protocol) {
		if (JIJConstants.INTERNAL_URL_PROTOCOL.equals(protocol)) 
			return new RsrcURLStreamHandler(classLoader);
		if (chainFac != null)
			return chainFac.createURLStreamHandler(protocol);
		return null; 
	} 
	 
	/** 
	 * Allow one other URLStreamHandler to be added. 
	 * URL.setURLStreamHandlerFactory does not allow 
	 * multiple factories to be added. 
	 * The chained factory is called for all other protocols, 
	 * except "rsrc". Use null to clear previously set Handler.  
	 * @param fac another factory to be chained with ours. 
	 */ 
	public void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) {
		chainFac = fac;
	} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 URLStreamHandlerFactory Methods: