Package org.mortbay.util

Examples of org.mortbay.util.Resource


import org.mortbay.http.HttpContext;
import org.mortbay.util.Resource;

public class ClasspathResourceLocator implements ResourceLocator {
    public Resource getResource(HttpContext context, String pathInContext) throws IOException {
        Resource resource = new ClassPathResource(pathInContext);
        context.getResourceMetaData(resource);
        return resource;
    }
View Full Code Here


        });
        assertEquals(file, handler.getResource(file.toURI().toURL().toString()).getFile());
    }

    public void testShouldReturnMissingResourceIfNoResourceLocated() throws Exception {
        Resource resource = handler.getResource("not exists path");
        assertFalse(resource.exists());
    }
View Full Code Here

    {
        String sessionId = getSessionId(pathInContext);
        if (sessionId != null) {
            String extensionJs = FrameGroupCommandQueueSet
                .getQueueSet(sessionId).getExtensionJs();
            Resource resource = new SessionExtensionJsResource(extensionJs);
            getHttpContext().getResourceMetaData(resource);
            return resource;
        }
        return null;
    }
View Full Code Here

import org.mortbay.util.Resource;

public class ClasspathResourceLocator implements ResourceLocator {

    public Resource getResource(HttpContext context, String pathInContext) throws IOException {
        Resource resource = new ClassPathResource(pathInContext);
        context.getResourceMetaData(resource);
        return resource;
    }
View Full Code Here

        this.rootDir = directory;
    }

    public Resource getResource(HttpContext context, String pathInContext) throws IOException {
        File file = new File(rootDir, pathInContext);
        Resource resource = createFileResource(file, context);
        // Throw in a hack to make it easier to install user extensions
        if (!resource.exists() && file.getName().equals(USER_EXTENSIONS_JS_NAME)) {
            resource = userExtensionResource(context);
            if (resource.exists()) return resource;
        }
        // And another hack to make the -htmlSuite appear in the /tests directory
        if (!resource.exists() && pathInContext.startsWith(TEST_DIR)) {
            File testFile = new File(rootDir, pathInContext.substring(TEST_DIR.length()));
            resource = createFileResource(testFile, context);
            if (resource.exists()) return resource;
        }
        return resource;
    }
View Full Code Here

        File extensions = new File(rootDir, USER_EXTENSIONS_JS_NAME);
        return createFileResource(extensions, context);
    }

    private Resource createFileResource(File file, HttpContext context) throws IOException {
           Resource resource = new FutureFileResource(file.toURI().toURL());
          context.getResourceMetaData(resource);
            return resource;       
    }
View Full Code Here

TOP

Related Classes of org.mortbay.util.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.