Package java.net

Examples of java.net.MalformedURLException


     */
    @Override
    public URL getResource(String path) throws MalformedURLException {

        if (!path.startsWith("/"))
            throw new MalformedURLException("Path '" + path +
                                            "' does not start with '/'");
        URL url = new URL(myResourceBaseURL, path.substring(1));
        InputStream is = null;
        try {
            is = url.openStream();
View Full Code Here


    public URL getResource(String path)
        throws MalformedURLException {

        if (path == null ||
                !path.startsWith("/") && GET_RESOURCE_REQUIRE_SLASH)
            throw new MalformedURLException(sm.getString(
                    "applicationContext.requestDispatcher.iae", path));

        WebResourceRoot resources = context.getResources();
        if (resources != null) {
            return resources.getResource(path).getURL();
View Full Code Here

        } catch (URISyntaxException e) {
            // May be caused by a | being used instead of a : in an absolute
            // file URI on Windows.
            if (blockExternal) {
                // Absolute paths aren't allowed so block it
                throw new MalformedURLException(e.getMessage());
            } else {
                // See if the URLHandler can resolve it
                return new InputSource(systemId);
            }
        }
View Full Code Here

    @Override
    public URLConnection openConnection(URL url) throws IOException {
        String protocol = url.getProtocol();
        if (!PROTOCOL.equals(protocol))
            throw new MalformedURLException("Unsupported protocol");

        IPath path = new Path(url.getPath());

        IWorkspace workspace = (IWorkspace) workspaceTracker.getService();
        if (workspace == null)
View Full Code Here

        {
            protocol = "amqp";
        }
        else if(!protocol.equals("amqp") && !protocol.equals("amqps"))
        {
            throw new MalformedURLException("Protocol '"+protocol+"' unknown. Must be one of 'amqp' or 'amqps'.");
        }
        String host = url.getHost();
        int port = url.getPort();

        boolean ssl = false;
View Full Code Here

        if (resolver != null) {
            try {
                final Resource resource = resolver.getResource(cleanPath(path, true));
                return (resource != null) ? resource.adaptTo(URL.class) : null;
            } catch (final SlingException se) {
                throw (MalformedURLException) new MalformedURLException(
                    "Cannot get URL for " + path).initCause(se);
            }
        }
        return null;
    }
View Full Code Here

      throw new IOException("No URL provided!");
    }
   
    if (!checkUrl(serviceURL)){
      logger.error("Malformed URL: " + serviceURL);
      throw new MalformedURLException();
    }
    if (requestMethod.equals("POST")){
      return sendPostRequest(serviceURL, requestString, contentType);
    } else if (requestMethod.equals("GET")){
      String url = "";
View Full Code Here

      embeddedParams.removeAll(duplicates);
      queryParams.addAll(embeddedParams);
      requestString = StringUtils.join(queryParams, "&");
    } else if (count > 1){
      //something's really wrong here, or the path has parameters embedded in the path
      throw new MalformedURLException("This path is problematic: ['" + path + "']");
    }


    String combined = path + "?" + requestString;
    logger.info("Combined URL: " + combined);
View Full Code Here

    @Override
    public URLConnection openConnection(URL url) throws IOException {
        String protocol = url.getProtocol();
        if (!PROTOCOL.equals(protocol))
            throw new MalformedURLException("Unsupported protocol");

        IPath path = new Path(url.getPath());

        IWorkspace workspace = workspaceTracker.getService();
        if (workspace == null)
View Full Code Here

    public URL getURL(String path) throws MalformedURLException {
        try {
            final Resource resource = getResourceInternal(path);
            return resource != null ? resource.adaptTo(URL.class) : null;
        } catch (SlingException se) {
            throw (MalformedURLException) new MalformedURLException(
                "Cannot get URL for " + path).initCause(se);
        }
    }
View Full Code Here

TOP

Related Classes of java.net.MalformedURLException

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.