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

        @Override
        public HttpHandler createHandler(final OperationContext context, ModelNode model) throws OperationFailedException {
            String path = PATH.resolveModelAttribute(context, model).asString();
            boolean directoryListing = DIRECTORY_LISTING.resolveModelAttribute(context, model).asBoolean();
            UndertowLogger.ROOT_LOGGER.creatingFileHandler(path);
            FileResourceManager resourceManager = new FileResourceManager(new File(path), 1024 * 1024);
            ResourceHandler handler = new ResourceHandler();
            handler.setResourceManager(resourceManager);
            handler.setDirectoryListingEnabled(directoryListing);
            return handler;
        }
    View Full Code Here

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

            DeploymentInfo d = new DeploymentInfo();
            d.setDeploymentName(webDeploymentBuilder.getContextRoot());
            d.setContextPath(webDeploymentBuilder.getContextRoot());
            d.setClassLoader(webDeploymentBuilder.getClassLoader());
            d.setResourceManager(new FileResourceManager(new File(webDeploymentBuilder.getDocumentRoot().getAbsolutePath()), 1024 * 1024));
            d.setIgnoreFlush(false);
            for (ServletBuilder servlet : webDeploymentBuilder.getServlets()) {
                ServletInfo s;
                if (servlet.getServlet() == null) {
                    s = new ServletInfo(servlet.getServletName(), (Class<? extends Servlet>) servlet.getServletClass());
    View Full Code Here

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

        private final Collection<VirtualFile> overlays;
        private final boolean explodedDeployment;

        public ServletResourceManager(final VirtualFile resourcesRoot, final Collection<VirtualFile> overlays, boolean explodedDeployment) throws IOException {
            this.explodedDeployment = explodedDeployment;
            deploymentResourceManager = new FileResourceManager(resourcesRoot.getPhysicalFile(), 1024 * 1024);
            this.overlays = overlays;
        }
    View Full Code Here

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

            Undertow server = Undertow.builder()
                    .setServerOption(UndertowOptions.ENABLE_HTTP2, true)
                    .setServerOption(UndertowOptions.ENABLE_SPDY, true)
                    .addHttpListener(8080, bindAddress)
                    .addHttpsListener(8443, bindAddress, createSSLContext(loadKeyStore("server.keystore"), loadKeyStore("server.truststore")))
                    .setHandler(Handlers.header(predicate(secure(), resource(new FileResourceManager(new File(System.getProperty("example.directory", System.getProperty("user.home"))), 100))
                            .setDirectoryListingEnabled(true), new HttpHandler() {
                        @Override
                        public void handleRequest(HttpServerExchange exchange) throws Exception {
                            exchange.getResponseHeaders().add(Headers.LOCATION, "https://" + exchange.getHostName() + ":" + (exchange.getHostPort() + 363) + exchange.getRelativePath());
                            exchange.setResponseCode(StatusCodes.TEMPORARY_REDIRECT);
    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

            DeploymentInfo builder = new DeploymentInfo()
                    .setClassIntrospecter(TestClassIntrospector.INSTANCE)
                    .setClassLoader(ServletPathMappingTestCase.class.getClassLoader())
                    .setContextPath("/servletContext")
                    .setDeploymentName("servletContext.war")
                    .setResourceManager(new CachingResourceManager(100, 10000, new DirectBufferCache(1000, 10, 1000 * 10 * 1000, BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR, METADATA_MAX_AGE), new FileResourceManager(tmpDir, 10485760), METADATA_MAX_AGE));

            builder.addServlet(new ServletInfo("DefaultTestServlet", PathTestServlet.class)
                    .addMapping("/path/default"))
                    .addFilter(Servlets.filter("message", MessageFilter.class).addInitParam(MessageFilter.MESSAGE, "FILTER_TEXT "))
                    .addFilterUrlMapping("message", "*.txt", DispatcherType.REQUEST);
    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(StatusCodes.OK, 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(StatusCodes.OK, 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

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

            tmpDir = new File(System.getProperty("java.io.tmpdir") + DIR_NAME);
            tmpDir.mkdirs();
            tmpDir.deleteOnExit();

            final FileResourceManager resourceManager = new FileResourceManager(tmpDir, 10485760);
            DefaultServer.setRootHandler(new ResourceHandler().setResourceManager(resourceManager)
                    .setContentEncodedResourceManager(
                            new ContentEncodedResourceManager(tmpDir, new CachingResourceManager(100, 10000, null, resourceManager, -1), new ContentEncodingRepository()
                                    .addEncodingHandler("deflate", new DeflateEncodingProvider(), 50, null), 0, 100000, null)));
        }
    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.