Package com.alibaba.citrus.service.uribroker

Examples of com.alibaba.citrus.service.uribroker.URIBrokerService


    @Test
    public void config() {
        ApplicationContext factory = new XmlApplicationContext(new FileSystemResource(new File(srcdir,
                                                                                               "services-uris.xml")));

        URIBrokerService uris = (URIBrokerService) factory.getBean("uris");

        TurbineContentURIBroker link1 = (TurbineContentURIBroker) uris.getURIBroker("tclink4");
        assertEquals("http://taobao.com/mycontext/mycomponent/myprefix/mycontent.jpg?a=1&b=2", link1.toString());

        TurbineContentURIBroker link2 = (TurbineContentURIBroker) uris.getURIBroker("tclink5");
        assertEquals("http://taobao.com/?a=1&b=2", link2.toString());
    }
View Full Code Here


    @Test
    public void config_withMappings() {
        ApplicationContext factory = new XmlApplicationContext(new FileSystemResource(new File(srcdir,
                                                                                               "services-uris.xml")));

        URIBrokerService uris = (URIBrokerService) factory.getBean("uris");

        URIBroker link1 = uris.getURIBroker("link1");
        assertEquals("http://taobao.com/hello", link1.toString());

        TurbineURIBroker link2 = (TurbineURIBroker) uris.getURIBroker("link2");
        assertSame(factory.getBean("mappingRuleService"), link2.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/my_target.htm?action=myAction",
                     link2.toString());

        TurbineURIBroker link3 = (TurbineURIBroker) uris.getURIBroker("link3");
        assertSame(factory.getBean("mapping2"), link3.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/myTarget.vhtml?myaction=myAction",
                     link3.toString());
    }
View Full Code Here

    @Test
    public void config_withoutMappings() {
        ApplicationContext factory = new XmlApplicationContext(new FileSystemResource(new File(srcdir,
                                                                                               "services-uris-no-mappings.xml")));

        URIBrokerService uris = (URIBrokerService) factory.getBean("uris");

        URIBroker link1 = uris.getURIBroker("link1");
        assertEquals("http://taobao.com/hello", link1.toString());

        TurbineURIBroker link2 = (TurbineURIBroker) uris.getURIBroker("link2");
        assertNull(link2.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/my_target.vm?action=myAction", link2.toString());

        TurbineURIBroker link3 = (TurbineURIBroker) uris.getURIBroker("link3");
        assertNull(link3.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/myTarget.vm?myaction=myAction",
                     link3.toString());
    }
View Full Code Here

    }

    public RedirectParameters redirectTo(String uriName) {
        uriName = assertNotNull(trimToNull(uriName), "no uriName");

        URIBrokerService uris = (URIBrokerService) getCurrentComponent().getApplicationContext().getBean(
                "uriBrokerService", URIBrokerService.class);

        URIBroker uri = assertNotNull(uris.getURIBroker(uriName), "could not find uri broker named \"%s\"", uriName);

        setRedirectLocation(uri);

        return new RedirectParametersImpl(uriName, uri);
    }
View Full Code Here

    }

    public RedirectParameters redirectTo(String uriName) {
        uriName = assertNotNull(trimToNull(uriName), "no uriName");

        URIBrokerService uris = (URIBrokerService) getCurrentComponent().getApplicationContext().getBean(
                "uriBrokerService", URIBrokerService.class);

        URIBroker uri = assertNotNull(uris.getURIBroker(uriName), "could not find uri broker named \"%s\"", uriName);

        setRedirectLocation(uri);

        return new RedirectParametersImpl(uriName, uri);
    }
View Full Code Here

    }

    public RedirectParameters redirectTo(String uriName) {
        uriName = assertNotNull(trimToNull(uriName), "no uriName");

        URIBrokerService uris = (URIBrokerService) getCurrentComponent().getApplicationContext().getBean(
                "uriBrokerService", URIBrokerService.class);

        URIBroker uri = assertNotNull(uris.getURIBroker(uriName), "could not find uri broker named \"%s\"", uriName);

        setRedirectLocation(uri);

        return new RedirectParametersImpl(uriName, uri);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.uribroker.URIBrokerService

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.