Package org.restlet.resource

Examples of org.restlet.resource.Finder


    private ClientResource clientResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource5.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here


    private MyResource12 myResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyServerResource12.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
        this.myResource = clientResource.wrap(MyResource12.class);
    }
View Full Code Here

     *            The target Resource class to attach.
     * @return The new finder instance.
     */
    @Override
    public Finder createFinder(Class<? extends ServerResource> targetClass) {
        Finder result = super.createFinder(targetClass);
        result.setContext(getContext().createChildContext());
        return result;
    }
View Full Code Here

    private ClientResource clientResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource4.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

     *
     * @param nextClass
     *            The next resource class to attach.
     */
    public void setNext(Class<? extends ServerResource> nextClass) {
        setNext(new Finder(getContext(), nextClass));
    }
View Full Code Here

    private MyResource1 myResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyServerResource1.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
        this.myResource = clientResource.wrap(MyResource1.class);
    }
View Full Code Here

    private ClientResource clientResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource7.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

    public void detach(Class<?> targetClass) {
        for (int i = getRoutes().size() - 1; i >= 0; i--) {
            Restlet target = getRoutes().get(i).getNext();
            if (target != null
                    && Finder.class.isAssignableFrom(target.getClass())) {
                Finder finder = (Finder) target;
                if (finder.getTargetClass().equals(targetClass)) {
                    getRoutes().remove(i);
                }
            }
        }

        if (getDefaultRoute() != null) {
            Restlet target = getDefaultRoute().getNext();
            if (target != null
                    && Finder.class.isAssignableFrom(target.getClass())) {
                Finder finder = (Finder) target;
                if (finder.getTargetClass().equals(targetClass)) {
                    setDefaultRoute(null);
                }
            }
        }
    }
View Full Code Here

        return super.attachDefault(defaultTarget);
    }

    @Override
    public Finder createFinder(Class<? extends ServerResource> targetClass) {
        Finder result = super.createFinder(targetClass);
        result.setContext(getContext().createChildContext());
        return result;
    }
View Full Code Here

    private ClientResource clientResource;

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource3.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

TOP

Related Classes of org.restlet.resource.Finder

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.