Package org.restlet.resource

Examples of org.restlet.resource.ServerResource



    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable
    {
        ServerResource resource = (ServerResource) invocation.getThis();
        securityCheck.check(resource.getRequest(), resource.getResponse());
        return invocation.proceed();
    }
View Full Code Here


     * lookup method in Spring.
     *
     * @return The created resource or null.
     */
    public ServerResource create() {
        ServerResource result = null;

        if (getTargetClass() != null) {
            try {
                // Invoke the default constructor
                result = (ServerResource) getTargetClass().newInstance();
View Full Code Here

        registerApplicationContextBean(BEAN_NAME, SomeResource.class);
        registerBeanFactoryBean(BEAN_NAME, AnotherResource.class);

        this.finder.setApplicationContext(applicationContext);

        ServerResource actual = this.finder.create();

        assertNotNull("Resource not found", actual);
        assertTrue("Resource not from application context: "
                + actual.getClass().getName(), actual instanceof SomeResource);
    }
View Full Code Here

    public void testReturnsResourceBeanWhenExists() throws Exception {
        registerBeanFactoryBean(BEAN_NAME, SomeResource.class);

        this.finder.setBeanFactory(beanFactory);

        final ServerResource actual = this.finder.create();

        assertNotNull("Resource not found", actual);
        assertTrue("Resource not the correct type",
                actual instanceof SomeResource);
    }
View Full Code Here

        registerBeanFactoryBean(BEAN_NAME, SomeServerResource.class,
                createServerResourcePropertyValues());

        this.finder.setBeanFactory(beanFactory);

        final ServerResource actual = this.finder.create(
                SomeServerResource.class, null, null);

        assertNotNull("Resource not found", actual);
        assertTrue("Resource not the correct type",
                actual instanceof SomeServerResource);
View Full Code Here

        registerBeanFactoryBean(BEAN_NAME, SomeServerResource.class,
                createServerResourcePropertyValues());

        this.finder.setBeanFactory(beanFactory);

        final ServerResource actual = this.finder.create();

        assertNotNull("Resource not found", actual);
        assertTrue("Resource not the correct type",
                actual instanceof SomeServerResource);
    }
View Full Code Here

    public void testUsesApplicationContextIfPresent() throws Exception {
        registerApplicationContextBean(BEAN_NAME, SomeResource.class);

        this.finder.setApplicationContext(applicationContext);

        ServerResource actual = this.finder.create();

        assertNotNull("Resource not found", actual);
        assertTrue("Resource not the correct type",
                actual instanceof SomeResource);
    }
View Full Code Here

        log.info("Looking for a wadl resource");
        for (Restlet next = getNext(); next != null;) {
            if (next instanceof Finder) {
                Finder f = (Finder) next;
                ServerResource sr = f.find(request, response);
                if (sr instanceof WadlServerResource) {
                    wadl = (WadlServerResource) sr;
                }
                break;
                // next = ((Filter)next).getNext();
View Full Code Here

        log.info("Looking for a scoped resource");
        for (Restlet next = getNext(); next != null;) {
            if (next instanceof Finder) {
                Finder f = (Finder) next;
                ServerResource sr = f.find(request, response);
                if (sr instanceof DiscoverableResource) {
                    scoped = (DiscoverableResource) sr;
                    List<AnnotationInfo> ai = AnnotationUtils.getAnnotations(sr
                            .getClass());
                    for (AnnotationInfo i : ai) {
                        methods.add(i.getRestletMethod());
                    }
                    Set<Method> am = sr.getAllowedMethods();
                    log.info("AllowedMethods size = " + am);
                }
                break;
                // next = ((Filter)next).getNext();
            } else if (next instanceof Filter) {
View Full Code Here

        if (finder instanceof Directory) {
            resource = finder;
        } else {
            // The handler instance targeted by this finder.
            ServerResource sr = finder.find(request, response);

            if (sr != null) {
                sr.init(getContext(), request, response);
                sr.updateAllowedMethods();
                resource = sr;
            }
        }

        if (resource != null) {
View Full Code Here

TOP

Related Classes of org.restlet.resource.ServerResource

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.