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

        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

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

                HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path");
                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()
                                        .setResourceManager(new FileResourceManager(newSymlink, 10485760))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 404 error, as path contains a symbolic link and by default followLinks is false
                 */
     
    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 404 error, followLinks is true, but empty "" safePaths forbids all symbolics paths inside base path
                 */
     
    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 code as not symbolic links on path
                 */
     
    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 code as "/" can be used to grant all symbolic links paths
                 */
     
    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, rootPath.getAbsolutePath().concat("/newDir")))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 200 code as rootPath + "/newDir" is used in the safePaths
                 */
     
    View Full Code Here

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

            File newSymlink = new File(rootPath, "newSymlink");

            try {
                DefaultServer.setRootHandler(new PathHandler()
                                .addPrefixPath("/path", new ResourceHandler()
                                        .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, rootPath.getAbsolutePath().concat("/newDir")))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html")));
                /**
                 * This request should return a 200 code as rootPath + "/newDir" is used in the safePaths
                 */
     
    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, rootPath.getAbsolutePath().concat("/otherDir")))
                                        .setDirectoryListingEnabled(false)
                                        .addWelcomeFiles("page.html"))));
                /**
                 * This request should return a 404 code as rootPath + "/otherDir" doesnt match in rootPath + "/path/innerSymlink/page.html"
                 */
     
    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.