Examples of URI


Examples of java.net.URI

    }
   
    @Test
    public void filesWithSameNameAndUriHaveDifferentClassName() throws URISyntaxException {
        ScriptSource source1 = new UriScriptSource("<file-type>", new File(testDir, "build.gradle"));
        ScriptSource source2 = new UriScriptSource("<file-type>", new URI("http://localhost/build.gradle"));
        assertThat(source1.getClassName(), not(equalTo(source2.getClassName())));

        ScriptSource source3 = new UriScriptSource("<file-type>", new File(testDir, "build.gradle"));
        assertThat(source1.getClassName(), equalTo(source3.getClassName()));
    }
View Full Code Here

Examples of java.net.URI

        templateHeader.append("<th>Size</td>");
        templateHeader.append("\n</tr>\n");
    }

    private void addFilesAndFolders( HttpRequest request, File[] files, StringBuffer templateHeader ) throws IOException {
        URI rootUri = this.root.toURI();
        ComparableComparator comp = new ComparableComparator();
        TreeMap dirMap = new TreeMap( comp );
        TreeMap fileMap = new TreeMap( comp );
        StringBuffer fileBuffer = new StringBuffer();
        for( int i = 0; i < files.length; i++ ) {
View Full Code Here

Examples of java.net.URI

     * index. If it is null, we assume it is a property file and load it. Otherwise, we
     * assume it is a valid property file URI and try to download it. */
   
    final String uriString = uri.toString();
    if ( uriString.startsWith( "mg4j:" ) ) {
      final URI u = new URI( uriString );
      return IndexServer.getIndex( u.getHost(), u.getPort(), randomAccess, documentSizes );
    }

    final String basename, query;
   
    if ( uriString.startsWith( "file:" ) ) {
      final URI u = new URI( uriString );
      basename = u.getPath();
      query = u.getQuery();
    }
    else {
      final int questionMarkPos = uriString.indexOf( '?' );
      basename = questionMarkPos == -1 ? uriString : uriString.substring( 0, questionMarkPos );
      query = questionMarkPos == -1 ? null : uriString.substring( questionMarkPos + 1 );
View Full Code Here

Examples of java.net.URI

    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

Examples of java.net.URI

    }
  }

  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

Examples of java.net.URI

         
        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

Examples of java.net.URI

        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

Examples of java.net.URI

    }

    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

Examples of java.net.URI

        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

Examples of java.net.URI

                    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
TOP
Copyright © 2018 www.massapi.com. 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.