Package org.apache.tapestry5.urlrewriter

Examples of org.apache.tapestry5.urlrewriter.URLRewriterRule


    @SuppressWarnings("unchecked")
    @Test
    public void single_validator_via_specification() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void multiple_validators_via_specification() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator required = mockValidator();
        Validator minLength = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void validator_with_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
View Full Code Here

        configuration.add(SymbolConstants.GZIP_COMPRESSION_ENABLED, "false");
    }
   
    public static void contributeURLRewriterRequestFilter(OrderedConfiguration<URLRewriterRule> configuration) {
       
        URLRewriterRule rule1 = new URLRewriterRule() {

            public Request process(Request request)
            {
                final String path = request.getPath();
                if (path.equals("/struts"))
                {
                    request = new SimpleRequestWrapper(request, "/jsf");
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule2 = new URLRewriterRule() {

            public Request process(Request request)
            {
                final String path = request.getPath();
                if (path.equals("/jsf"))
                {
                    request = new SimpleRequestWrapper(request, "/tapestry");
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule3 = new URLRewriterRule() {

            public Request process(Request request)
            {
                String path = request.getPath();
                if (path.equals("/tapestry"))
View Full Code Here

    @Test
    public void test_rewriter_rule_chaining() throws IOException
    {

        URLRewriterRule rule1 = new URLRewriterRule()
        {
            public Request process(Request request)
            {
                final String serverName = request.getServerName().toUpperCase();
                final String path = request.getPath().toUpperCase();
View Full Code Here

    @Test
    public void rewriter_rule_returns_null() throws IOException
    {

        URLRewriterRule rule = new URLRewriterRule()
        {
            public Request process(Request request)
            {
                return null;
            }
View Full Code Here

    @Test
    public void test_rewriter_rule_chaining() throws IOException
    {

        URLRewriterRule rule1 = new URLRewriterRule()
        {
            public Request process(Request request,URLRewriteContext context)
            {
                final String serverName = request.getServerName().toUpperCase();
                final String path = request.getPath().toUpperCase();
View Full Code Here

    @Test
    public void rewriter_rule_returns_null() throws IOException
    {

        URLRewriterRule rule = new URLRewriterRule()
        {
            public Request process(Request request,URLRewriteContext context)
            {
                return null;
            }
View Full Code Here

{
    private static final String SUCCESS_PAGE_NAME = URLRewriteSuccess.class.getSimpleName().toLowerCase();

    public static void contributeURLRewriterService(OrderedConfiguration<URLRewriterRule> configuration) {
       
        URLRewriterRule rule1 = new URLRewriterRule() {

            public Request process(Request request)
            {
                final String path = request.getPath();
                if (path.equals("/struts"))
                {
                    request = new SimpleRequestWrapper(request, "/jsf");
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule2 = new URLRewriterRule() {

            public Request process(Request request)
            {
                final String path = request.getPath();
                if (path.equals("/jsf"))
                {
                    request = new SimpleRequestWrapper(request, "/tapestry");
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule3 = new URLRewriterRule() {

            public Request process(Request request)
            {
                String path = request.getPath();
                if (path.equals("/tapestry"))
                {
                    path = "/" + SUCCESS_PAGE_NAME;
                    request = new SimpleRequestWrapper(request, path);
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule4 = new URLRewriterRule() {

            public Request process(Request request)
            {
                String serverName = request.getServerName();
                String path = request.getPath();
                if (serverName.equals(IntegrationTests.SUBDOMAIN) && path.equals("/"))
                {
                    path = String.format("/%s/%s", SUCCESS_PAGE_NAME, IntegrationTests.LOGIN);
                    request = new SimpleRequestWrapper(request, path);
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule5 = new URLRewriterRule() {

            public Request process(Request request)
            {
                String serverName = request.getServerName();
                String path = request.getPath();
                final String pathToRewrite = "/" + SUCCESS_PAGE_NAME + "/login";
                if (serverName.equals("localhost") && path.equalsIgnoreCase(pathToRewrite))
                {
                    request = new SimpleRequestWrapper(request, IntegrationTests.SUBDOMAIN, "/");
                }
                return request;
               
            }
           
        };
       
        URLRewriterRule rule6 = new URLRewriterRule() {

            public Request process(Request request)
            {
                String serverName = request.getServerName();
                String path = request.getPath().toLowerCase();
View Full Code Here

    @Test
    public void test_rewriter_rule_chaining() throws IOException
    {

        URLRewriterRule rule1 = new URLRewriterRule()
        {
            public Request process(Request request)
            {
                final String serverName = request.getServerName().toUpperCase();
                final String path = request.getPath().toUpperCase();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.urlrewriter.URLRewriterRule

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.