Package org.eclipse.jetty.util.resource

Examples of org.eclipse.jetty.util.resource.Resource


  public static void main(String[] args) throws MalformedURLException, IOException, URISyntaxException {

    VirtualResource vr = new VirtualResource(
        Resource.newResource("C:/test2/"),
        "/mytest", "C:/test/");
    Resource r = vr.addPath("/mytest/test.txt");
    System.out.println(r.exists());

  }
View Full Code Here


        StringBuilder classpath = new StringBuilder();
        for (int i = 0; i < urls.length; i++)
        {
            try
            {
                Resource resource = newResource(urls[i]);
                File file = resource.getFile();
                if (file != null && file.exists())
                {
                    if (classpath.length() > 0)
                        classpath.append(File.pathSeparatorChar);
                    classpath.append(file.getAbsolutePath());
View Full Code Here

            return null;

        try
        {
            path = URIUtil.canonicalPath(path);
            Resource resource = _baseResource.addPath(path);
           
            if (checkAlias(path,resource))
                return resource;
            return null;
        }
View Full Code Here

    public Set<String> getResourcePaths(String path)
    {
        try
        {
            path = URIUtil.canonicalPath(path);
            Resource resource = getResource(path);

            if (resource != null && resource.exists())
            {
                if (!path.endsWith(URIUtil.SLASH))
                    path = path + URIUtil.SLASH;

                String[] l = resource.list();
                if (l != null)
                {
                    HashSet<String> set = new HashSet<String>();
                    for (int i = 0; i < l.length; i++)
                        set.add(path + l[i]);
View Full Code Here

            else if (path.charAt(0) != '/')
                path = URIUtil.SLASH + path;

            try
            {
                Resource resource = ContextHandler.this.getResource(path);
                if (resource != null)
                {
                    File file = resource.getFile();
                    if (file != null)
                        return file.getCanonicalPath();
                }
            }
            catch (Exception e)
View Full Code Here

        /* ------------------------------------------------------------ */
        @Override
        public URL getResource(String path) throws MalformedURLException
        {
            Resource resource = ContextHandler.this.getResource(path);
            if (resource != null && resource.exists())
                return resource.getURL();
            return null;
        }
View Full Code Here

            try
            {
                URL url = getResource(path);
                if (url == null)
                    return null;
                Resource r = Resource.newResource(url);
                return r.getInputStream();
            }
            catch (Exception e)
            {
                LOG.ignore(e);
                return null;
View Full Code Here

        if (startNewHandler) {
            wHandler.start();
        }

        Resource jettyEnv = null;
        Resource webInf = wac.getWebInf();
        if (webInf != null && webInf.exists()) {
            jettyEnv = webInf.addPath("jetty-env.xml");
        }
        if (jettyEnv == null || !(jettyEnv.exists())) {
            JettyLogger.LOG.missingJettyEnvXml();
        }
    }
View Full Code Here

        StringTokenizer tokenizer = new StringTokenizer(classPath, ",;");
        while (tokenizer.hasMoreTokens())
        {
            String path = tokenizer.nextToken();
            Resource resource = getContext().newResource(path);

            // Resolve file path if possible
            File file = resource.getFile();
            if (file != null && isAcceptableLibrary(file, JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED))
            {
                super.addClassPath(path);
            }
            else
View Full Code Here


    @Test
    public void testResourceCache() throws Exception
    {
        final Resource directory;
        File[] files=new File[10];
        String[] names=new String[files.length];
        ResourceCache cache;

        for (int i=0;i<files.length;i++)
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.resource.Resource

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.