Examples of FileResourceManager

Caution:
The txId passed to many methods as an identifier for the transaction concerned will function as a key in a HashMap. Thus assure that equals and hashCode are both properly implemented and match each other. Caution: You will have to guarantee that no other process will access neither the store or the working dir concurrently to this FileResourceManager. Special Caution: Be very careful not to have two instances of FileResourceManager working in the same store and/or working dir. @version $Revision: 1.2 $
  • org.apache.slide.store.txfile.rm.impl.FileResourceManager
    .
  • As there are no active processes inside this RM and it shares its threads with the application, control over transactions is limited to points where the application calls the RM. In particular, this disables active terminmation of transactions upon timeout.
  • There is no notion of a connection to this file manager. This means you can not connect from hosts other than local and you will get problems when plugging this store into a J2EE store using connectors.
  • Methods should throw more specific exceptions Caution:
    The txId passed to many methods as an identifier for the transaction concerned will function as a key in a HashMap. Thus assure that equals and hashCode are both properly implemented and match each other. Caution: You will have to guarantee that no other process will access neither the store or the working dir concurrently to this FileResourceManager. Special Caution: Be very careful not to have two instances of FileResourceManager working in the same store and/or working dir. @author Oliver Zeigermann
  • org.olat.fileresource.FileResourceManager
    Initial Date: Apr 8, 2004 @author Mike Stock

  • Examples of io.undertow.server.handlers.resource.FileResourceManager

            try {
                DefaultServer.setRootHandler(new CanonicalPathHandler()
                        .setNext(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, rootPath.getAbsolutePath().concat("/innerSymlink")))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 404 code as rootPath + "/innerSymlink" in safePaths will not match with canonical "/innerSymlink"
                 */
     
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            try {
                DefaultServer.setRootHandler(new CanonicalPathHandler()
                        .setNext(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, ""))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 200, base is a symlink but it should not be checked in the symlinks filter
                 */
     
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            try {
                DefaultServer.setRootHandler(new CanonicalPathHandler()
                        .setNext(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, "innerDir"))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 200, innerSymlink is a symlink pointed to innerDir
                 */
     
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

        }

        @Test
        public void testSpecialCharacterInFileURL() throws IOException {
            String tmp = System.getProperty("java.io.tmpdir");
            FileResourceManager fileResourceManager = new FileResourceManager(new File(tmp), 1);
            File file = new File(tmp, "1#2.txt");
            FileOutputStream f = null;
            try {
                f = new FileOutputStream(file);
                f.write("Hi".getBytes());
            } finally {
                IoUtils.safeClose(f);
            }
            Resource res = fileResourceManager.getResource("1#2.txt");
            InputStream in = null;
            try {
                in = res.getUrl().openStream();
                Assert.assertEquals("Hi", FileUtils.readFile(in));
            } finally {
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            DeploymentInfo builder = new DeploymentInfo()
                .setClassLoader(JspMojo.class.getClassLoader())
                .setContextPath("/tck")
                .setClassIntrospecter(DefaultClassIntrospector.INSTANCE)
                .setDeploymentName("tck.war")
                .setResourceManager(new FileResourceManager(root, Integer.MAX_VALUE))
                .setTempDir(mojo.getTempDir())
                .setServletStackTraces(ServletStackTraces.NONE)
                .addServlet(servlet);
            JspServletBuilder.setupDeployment(builder, new HashMap<String, JspPropertyGroup>(), new HashMap<String, TagLibraryInfo>(), new HackInstanceManager());
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

    public class FileServer {

        public static void main(final String[] args) {
            Undertow server = Undertow.builder()
                    .addHttpListener(8080, "localhost")
                    .setHandler(resource(new FileResourceManager(new File(System.getProperty("user.home")), 100))
                            .setDirectoryListingEnabled(true))
                    .build();
            server.start();
        }
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            virtualHostHandler.addHost("default-host", pathHandler);
            virtualHostHandler.setDefaultHandler(pathHandler);

            pathHandler.addPrefixPath("/", new ResourceHandler()
                    .setResourceManager(new FileResourceManager(rootPath, 10485760))
                    .setDirectoryListingEnabled(true));

            DefaultServer.setRootHandler(root);

            DefaultServer.startSSLServer();
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
            try {
                DefaultServer.setRootHandler(new CanonicalPathHandler()
                        .setNext(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        .setResourceManager(new FileResourceManager(rootPath, 10485760))
                                        .setDirectoryListingEnabled(true))));

                HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path/page.html");
                HttpResponse result = client.execute(get);
                Assert.assertEquals(200, result.getStatusLine().getStatusCode());
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            try {
                DefaultServer.setRootHandler(new CanonicalPathHandler()
                        .setNext(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        // 1 byte = force transfer
                                        .setResourceManager(new FileResourceManager(rootPath, 1))
                                        .setDirectoryListingEnabled(true))));

                HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path/page.html");
                HttpResponse result = client.execute(get);
                Assert.assertEquals(200, result.getStatusLine().getStatusCode());
    View Full Code Here

    Examples of io.undertow.server.handlers.resource.FileResourceManager

            File rootPath = new File(FileHandlerTestCase.class.getResource("page.html").toURI()).getParentFile().getParentFile();
            HttpHandler root = (new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    // 1 byte = force transfer
                                    .setResourceManager(new FileResourceManager(rootPath, 1))
                                    .setDirectoryListingEnabled(true))));
            Undertow undertow = Undertow.builder()
                    .addHttpListener(8888, "localhost")
                    .setHandler(root)
                    .build();
    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.