Package java.net

Examples of java.net.URLStreamHandler


    }
  }

  static URL getTempURL(final InputStream resource) {
    try {
      return new URL(null, "temp:#temp", new URLStreamHandler() { //$NON-NLS-1$
       
        @Override
        protected URLConnection openConnection(URL u) throws IOException {
          return new URLConnection(u) {
           
View Full Code Here


            url = new URL(context, spec);
        } catch (MalformedURLException mue) {

            String msg = mue.getMessage();
            if (msg.indexOf(UNKNOWN_PROPTOCL_EX_MSG) != -1) {
                URLStreamHandler handler = findHandler(msg.substring(UNKNOWN_PROPTOCL_EX_MSG.length()));
                if (handler != null) {
                    url = new URL(context, spec, handler);
                }
            }
            if (url == null) {
View Full Code Here

        return url;
    }

    public static URLStreamHandler findHandler(String protocol) {

        URLStreamHandler handler = null;
        String packagePrefixList = System.getProperty(PROTOCOL_HANDLER_PKGS, "");
        StringTokenizer packagePrefixIter = new StringTokenizer(packagePrefixList, "|");
        while (handler == null && packagePrefixIter.hasMoreTokens()) {
            String packagePrefix = packagePrefixIter.nextToken().trim();
            try {
View Full Code Here

    }

    private static URLStreamHandler getDefaultStreamHandler(String protocol)
            throws IOException {
        synchronized (PROTOCOL_HANDLERS) {
            URLStreamHandler handler = (URLStreamHandler)
                    PROTOCOL_HANDLERS.get(protocol);
            if (handler != null) return handler;
            if (factory != null) {
                handler = factory.createURLStreamHandler(protocol);
            }
View Full Code Here

   * @see #getURLHandler(String, URLStreamHandlerFactory)
   * @see #getURLHandlerFactory(URLStreamHandlerFactory)
   */
  public static URL createURL(String spec, URLStreamHandlerFactory urlHandlerFactory)
  {
    URLStreamHandler handler = getURLHandler(spec, urlHandlerFactory);
    URL url;
    try
    {
      if (handler == null)
      {
View Full Code Here

   */
  public static URLStreamHandler getURLHandler(String spec, URLStreamHandlerFactory urlHandlerFact)
  {
    URLStreamHandlerFactory urlHandlerFactory = getURLHandlerFactory(urlHandlerFact);

    URLStreamHandler handler = null;
    if (urlHandlerFactory != null)
    {
      String protocol = getURLProtocol(spec);
      if (protocol != null)
      {
View Full Code Here

    }
    htmlText.append("</table></div></body></html>");

    try {
      // Show built HTML text as a page read from an URL
      showPage(new URL(null, SEARCH_RESULT_PROTOCOL + "://" + htmlText.hashCode(), new URLStreamHandler() {
          @Override
          protected URLConnection openConnection(URL url) throws IOException {
            return new URLConnection(url) {
                @Override
                public void connect() throws IOException {
View Full Code Here

  public URLStreamHandler createURLStreamHandler(String protocol) {
    if (this.handlers.containsKey(protocol))
      return this.handlers.get(protocol);
   
    for (URLStreamHandlerFactory factory : new ArrayList<URLStreamHandlerFactory>(this.factories)) {
      URLStreamHandler handler = factory.createURLStreamHandler(protocol);
      if (handler != null) return handler;
    }
   
    try {
      for (String prefix : new ArrayList<String>(prefixes)) {
View Full Code Here

        // Now allow the URL handling to work.
        URLStreamHandlerFactory ushf = new URLStreamHandlerFactory(){
            public URLStreamHandler createURLStreamHandler(String protocol) {
                if (protocol.equalsIgnoreCase(LOOPBACK)){
                    return new URLStreamHandler(){
                        @Override
                        protected URLConnection openConnection(URL u) throws IOException {
                            return null;// not needed for HttpClient
                        }
                    };
View Full Code Here

        return connection;
    }

    public static ConnectionFactoryImpl createFromURL(final String urlString) throws MalformedURLException
    {
        URL url = new URL(null, urlString, new URLStreamHandler()
                    {
                        @Override
                        protected URLConnection openConnection(URL u) throws IOException
                        {
                            throw new UnsupportedOperationException();
View Full Code Here

TOP

Related Classes of java.net.URLStreamHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.