Package java.net

Examples of java.net.URI$Helper


        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


                Class<?> desktopClass = Class.forName("java.awt.Desktop");
                // Desktop.isDesktopSupported()
                Boolean supported = (Boolean) desktopClass.
                    getMethod("isDesktopSupported").
                    invoke(null, new Object[0]);
                URI uri = new URI(url);
                if (supported) {
                    // Desktop.getDesktop();
                    Object desktop = desktopClass.getMethod("getDesktop").
                        invoke(null, new Object[0]);
                    // desktop.browse(uri);
View Full Code Here

                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                String collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
View Full Code Here

                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
View Full Code Here

        // which may be empty. The base-uri property of all other node types is the empty sequence.       
        switch(nodekind) {
            case NodeKind.DOCUMENT:
            case NodeKind.ELEMENT: {
                final String uri = node.baseUri();
                final URI baseUri = dynEnv.getStaticContext().getBaseURI();
                if(uri == null) {
                    if(node.getDataModel() == XQueryDataModel.INSTANCE) {
                        if(baseUri != null) {
                            return AnyURIValue.valueOf(baseUri);
                        }
                    }
                    break;
                } else {
                    if(baseUri == null) {
                        return AnyURIValue.valueOf(uri);
                    } else {
                        final URI resolved = baseUri.resolve(uri);
                        return AnyURIValue.valueOf(resolved);
                    }
                }
            }
            case NodeKind.PROCESSING_INSTRUCTION:
View Full Code Here

        // If $relative is the empty sequence, the empty sequence is returned.
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        final URI relative;
        String relativeStr = firstItem.stringValue();
        try {
            if(relativeStr.length() == 0) {
                relative = null;
            } else {
                relative = new URI(relativeStr);
                if(relative.isAbsolute()) {// If $relative is an absolute URI reference, it is returned unchanged.
                    return AnyURIValue.valueOf(relative);
                }
            }
        } catch (URISyntaxException e) {
            throw new DynamicError("err:FORG0002", "Invalid URI form: " + relativeStr);
        }
        final URI baseUri;
        final int arglen = argv.size();
        if(arglen == 2) {
            Item secondItem = argv.getItem(1);
            String baseStr = secondItem.stringValue();
            baseUri = URI.create(baseStr);
        } else {
            baseUri = dynEnv.getStaticContext().getBaseURI();
            if(baseUri == null) {
                throw new DynamicError("err:FONS0005", "BaseUri is not set in the static context.");
            }
        }
        if(relative == null) {// If $relative is the zero-length string, returns the value of the base-uri property.
            return AnyURIValue.valueOf(baseUri);
        }
        final URI resolved = baseUri.resolve(relative);
        return AnyURIValue.valueOf(resolved);
    }
View Full Code Here

    }

    public static URI resolveURI(String relativeUri, StaticContext staticEnv)
            throws XQueryException {
        assert (relativeUri != null && staticEnv != null);
        URI baseUri = staticEnv.getBaseURI();
        if(baseUri == null) {
            throw new DynamicError("err:FONS0005", "BaseUri is not set in the static context.");
        }
        return resolveURI(relativeUri, baseUri);
    }
View Full Code Here

    public static URI resolveURI(String relativeUri, URI baseUri) throws XQueryException {
        assert (relativeUri != null && baseUri != null);
        if(relativeUri.length() == 0) {// If $relative is the zero-length string, returns the value of the base-uri property.
            return baseUri;
        }
        final URI resolved = baseUri.resolve(relativeUri);
        return resolved;
    }
View Full Code Here

        builder.worker(new TestAction());
        builder.applicationClasspath(Arrays.asList(new File("app.jar")));
        builder.sharedPackages("package1", "package2");

        final URI serverAddress = new URI("test:something");

        context.checking(new Expectations(){{
            one(messagingServer).accept(with(notNullValue(Action.class)));
            will(returnValue(serverAddress));
            one(idGenerator).generateId();
View Full Code Here

        });
        return this;
    }

    private void applyScript(Object script) {
        URI scriptUri = resolver.resolveUri(script);
        ScriptPlugin configurer = configurerFactory.create(new UriScriptSource("script", scriptUri));
        for (Object target : targets) {
            configurer.apply(target);
        }
    }
View Full Code Here

TOP

Related Classes of java.net.URI$Helper

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.