Package org.restlet

Examples of org.restlet.Directory


       
        getConnectorService().getClientProtocols().add(Protocol.CLAP);
       
        getContext().getAttributes().put("serverProvider", serverConnectionProvider);
       
        final Directory jsDirectory = new Directory(getContext(),
                "clap://class/jminix/js");
       
        Router router = new Router(getContext());
             
        router.attach("/js", jsDirectory);
View Full Code Here


        router.attach("/engine",EngineResource.class)
            .setMatchingMode(Template.MODE_EQUALS);
        router.attach("/engine/",EngineResource.class)
            .setMatchingMode(Template.MODE_EQUALS);

        Directory alljobsdir = new Directory(
                getContext(),
                engine.getJobsDir().toURI().toString());
        alljobsdir.setListingAllowed(true);
        router.attach("/engine/jobsdir",alljobsdir);
       
       
        EnhDirectory anypath = new EnhDirectory(
                getContext(),
                engine.getJobsDir().toURI().toString() /*TODO: changeme*/) {
                    @Override
                    protected Reference determineRootRef(Request request) {
                        String ref = "file:/";
                        return new Reference(ref);
                    }};
        anypath.setListingAllowed(true);
        anypath.setModifiable(true);
        anypath.setEditFilter(JobResource.EDIT_FILTER);
       
        router.attach("/engine/anypath/",anypath);
       
        EnhDirectory jobdir = new EnhDirectory(
                getContext(),
                engine.getJobsDir().toURI().toString() /*TODO: changeme*/) {
                    @Override
                    protected Reference determineRootRef(Request request) {
                        try {
                            return new Reference(
                                EngineApplication.this.getEngine()
                                .getJob(TextUtils.urlUnescape(
                                    (String)request.getAttributes().get("job")))
                                .getJobDir().getCanonicalFile().toURI().toString());
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                    }};
        jobdir.setListingAllowed(true);
        jobdir.setModifiable(true);
        jobdir.setEditFilter(JobResource.EDIT_FILTER);
        router.attach("/engine/job/{job}/jobdir",jobdir);
        router.attach("/engine/job/{job}",JobResource.class);
        router.attach("/engine/job/{job}/report/{reportClass}",ReportGenResource.class);
        router.attach("/engine/job/{job}/beans",BeanBrowseResource.class);
        router.attach("/engine/job/{job}/beans/{beanPath}",BeanBrowseResource.class);
        router.attach("/engine/job/{job}/script",ScriptResource.class);

        // static files (won't serve directory, but will serve files in it)
        String resource = "clap://class/org/archive/crawler/restlet";
        Directory staticDir = new Directory(getContext(),resource);
        router.attach("/engine/static/",staticDir);

        return router;
    }
View Full Code Here

TOP

Related Classes of org.restlet.Directory

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.