Package java.net

Examples of java.net.URI$Parser


    this.url2DocumentPointer = url2DocumentPointer;
  }

  public void context( final Document document ) {
    try {
      documentURI = new URI( document.uri().toString() ).normalize();
    }
    catch ( URISyntaxException e ) {
      documentURI = null;
    }
  }
View Full Code Here


    }
  }

  public int resolve( final CharSequence virtualDocumentSpec ) {
    try {
      URI virtualURI = URI.create( virtualDocumentSpec.toString() ).normalize();
      if ( ! virtualURI.isAbsolute() ) {
        if ( documentURI == null ) return -1;
        virtualURI = documentURI.resolve( virtualURI );
      }

      // TODO discard opaque?
      return (int)url2DocumentPointer.getLong( virtualURI.toString() );
    } catch ( Exception e ) {
      return -1;
    }
  }
View Full Code Here

         
        return( getVuzeFile( new FileInputStream( test_file )));
       
      }else{
       
        URL  url = new URI( target ).toURL();
       
        String  protocol = url.getProtocol().toLowerCase();
       
        if ( protocol.equals( "http" ) || protocol.equals( "https" )){
         
View Full Code Here

        synchronized (lock) {
            if (localAddress == null) {
                localAddress = connector.accept(handShakeAction());
            }
           
            URI localAddress;
            try {
                localAddress = new URI(String.format("channel:%s!%d", this.localAddress, nextId++));
            } catch (URISyntaxException e) {
                throw UncheckedException.asUncheckedException(e);
            }
            pendingActions.put(localAddress, action);
            return localAddress;
View Full Code Here

    }

    private void handshake(ConnectEvent<Connection<Object>> connectEvent) {
        Connection<Object> connection = connectEvent.getConnection();
        ConnectRequest request = (ConnectRequest) connection.receive();
        URI localAddress = request.getDestinationAddress();
        Action<ConnectEvent<Connection<Object>>> channelConnection;
        synchronized (lock) {
            channelConnection = pendingActions.remove(localAddress);
        }
        if (channelConnection == null) {
View Full Code Here

        localAddresses = TcpOutgoingConnector.findLocalAddresses();
    }

    public URI accept(Action<ConnectEvent<Connection<Object>>> action) {
        ServerSocketChannel serverSocket;
        URI localAddress;
        try {
            serverSocket = ServerSocketChannel.open();
            serverSockets.add(serverSocket);
            serverSocket.socket().bind(new InetSocketAddress(0));
            localAddress = new URI(String.format("tcp://localhost:%d", serverSocket.socket().getLocalPort()));
            LOGGER.debug("Listening on {}.", localAddress);
        } catch (Exception e) {
            throw UncheckedException.asUncheckedException(e);
        }
View Full Code Here

                    SocketChannel socket = serverSocket.accept();
                    InetSocketAddress remoteAddress = (InetSocketAddress) socket.socket().getRemoteSocketAddress();
                    if (!localAddresses.contains(remoteAddress.getAddress())) {
                        LOGGER.error("Cannot accept connection from remote address {}.", remoteAddress.getAddress());
                    }
                    URI remoteUri = new URI(String.format("tcp://localhost:%d", remoteAddress.getPort()));
                    LOGGER.debug("Accepted connection from {}.", remoteUri);
                    action.execute(new ConnectEvent<Connection<Object>>(new SocketConnection<Object>(socket, localAddress, remoteUri, classLoader), localAddress, remoteUri));
                }
            } catch (ClosedChannelException e) {
                // Ignore
View Full Code Here

        }
        return null;
    }

    public static File getClasspathForClass(Class<?> targetClass) {
        URI location;
        try {
            location = targetClass.getProtectionDomain().getCodeSource().getLocation().toURI();
        } catch (URISyntaxException e) {
            throw new UncheckedIOException(e);
        }
        if (!location.getScheme().equals("file")) {
            throw new GradleException(String.format("Cannot determine Gradle home using codebase '%s'.", location));
        }
        return new File(location.getPath());
    }
View Full Code Here

    public Connection<Message> connect(URI destinationAddress) {
        if (!destinationAddress.getScheme().equals("channel")) {
            throw new IllegalArgumentException(String.format("Cannot create a connection to destination URI with unknown scheme: %s.",
                    destinationAddress));
        }
        URI connectionAddress = toConnectionAddress(destinationAddress);
        Connection<Message> connection = connector.connect(connectionAddress);
        try {
            connection.dispatch(new ConnectRequest(destinationAddress));
        } catch (Throwable e) {
            connection.stop();
View Full Code Here

        return connection;
    }

    private URI toConnectionAddress(URI destinationAddress) {
        String content = destinationAddress.getSchemeSpecificPart();
        URI connectionAddress;
        try {
            connectionAddress = new URI(StringUtils.substringBeforeLast(content, "!"));
        } catch (URISyntaxException e) {
            throw new UncheckedException(e);
        }
        return connectionAddress;
    }
View Full Code Here

TOP

Related Classes of java.net.URI$Parser

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.