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

            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

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

        public void simpleFileStressTest() throws IOException, ExecutionException, InterruptedException, URISyntaxException {
            ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS);
            try {
                File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
                final ResourceHandler handler = new ResourceHandler()
                        .setResourceManager(new FileResourceManager(rootPath, 10485760));

                final CacheHandler cacheHandler = new CacheHandler(new DirectBufferCache(1024, 10, 10480), handler);
                final PathHandler path = new PathHandler();
                path.addPrefixPath("/path", cacheHandler);
                final CanonicalPathHandler root = new CanonicalPathHandler();
    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)
                                        .addWelcomeFiles("page.html"))));

                HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path");
                HttpResponse result = client.execute(get);
    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

        }

        @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

    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

                .addInitParameter("resteasy.resources", "org.infinispan.rest.Server")
                .addInitParameter("resteasy.use.builtin.providers", "true")
                .addListener(new ListenerInfo(ResteasyBootstrap.class))
                .addMimeMappings(new MimeMapping("html", "text/html"), new MimeMapping("jpg", "image/jpeg"))
                .addWelcomePage("index.html")
                .setResourceManager(new FileResourceManager(new File(pathManagerInjector.getValue().resolveRelativePathEntry("rest", HOME_DIR)), 1024 * 1024));
             callbackHandle = pathManagerInjector.getValue().registerCallback(HOME_DIR, PathManager.ReloadServerCallback.create(), PathManager.Event.UPDATED, PathManager.Event.REMOVED);

             // Add the default servlet for managing static content
             deployment.addServlet(new ServletInfo("default", DefaultServlet.class).addMapping("/"));

    View Full Code Here

    Examples of org.apache.commons.transaction.file.FileResourceManager

            if (urlEncodePathString != null) {
                urlEncodePath = "true".equals(urlEncodePathString);
            }

            rm =
                new FileResourceManager(
                    storeDir,
                    workDir,
                    urlEncodePath,
                    new TxLogger(getLogger(), FileResourceManager.class.getName()),
                    debug);
    View Full Code Here

    Examples of org.apache.commons.transaction.file.FileResourceManager

         */
        @Override
        protected FileResourceManager createInstance()
            throws Exception
        {
            FileResourceManager fileResourceManager =
                new FileResourceManager( storeDir.getAbsolutePath(), workDir.getAbsolutePath(),
                                         this.resourceIdToPathMapper, this.transactionIdToPathMapper, loggerFacade,
                                         loggerFacade.isFineEnabled() );

            return fileResourceManager;
        }
    View Full Code Here

    Examples of org.apache.slide.store.txfile.rm.impl.FileResourceManager

            if (urlEncodePathString != null) {
                urlEncodePath = "true".equals(urlEncodePathString);
            }
           
            rm =
                new FileResourceManager(
                    storeDir,
                    workDir,
                    urlEncodePath,
                    new StoreLogger(getLogger(), FileResourceManager.class.getName()));
    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.