Examples of ServerResource


Examples of org.restlet.resource.ServerResource

     * 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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

    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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

    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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

        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

Examples of org.restlet.resource.ServerResource

         path += "index.html";
      }
      if (getLogger().isLoggable(Level.FINE)) {
         getLogger().fine("path="+path);
      }
      ServerResource r = new ClassResource(classLoader,path);
      return r;
   }
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.