Package com.astamuse.asta4d.web.dispatch.mapping

Examples of com.astamuse.asta4d.web.dispatch.mapping.UrlMappingResult


            context.setAccessURI(uri);
        }

        String queryString = request.getQueryString();

        UrlMappingResult result = conf.getRuleExtractor().findMappedRule(ruleList, method, uri, queryString);

        // if not found result, we do not need return 404, instead of user
        // defining all match rule

        if (result == null) {
            logger.warn("There is no matched rule found, we will simply return a 404. You should define your own matching all rule for this case.");
            response.setStatus(404);
            return;
        }

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setCurrentRule(rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        restoreFlashScopeData(context, request);

        List<ContentProvider> requestResult = handleRequest(rule);
View Full Code Here


            context.setAccessURI(uri);
        }

        String queryString = request.getQueryString();

        UrlMappingResult result = conf.getRuleExtractor().findMappedRule(ruleList, method, uri, queryString);

        // if not found result, we do not need return 404, instead of user
        // defining all match rule

        if (result == null) {
            logger.warn("There is no matched rule found, we will simply return a 404. You should define your own matching all rule for this case.");
            response.setStatus(404);
            return;
        }

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setData(KEY_CURRENT_RULE, rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        retrieveFlashScopeData(request);

        List<ContentProvider<?>> requestResult = handleRequest(rule);
View Full Code Here

            context.setAccessURI(uri);
        }

        String queryString = request.getQueryString();

        UrlMappingResult result = conf.getRuleExtractor().findMappedRule(ruleList, method, uri, queryString);

        // if not found result, we do not need return 404, instead of user
        // defining all match rule

        if (result == null) {
            logger.warn("There is no matched rule found, we will simply return a 404. You should define your own matching all rule for this case.");
            response.setStatus(404);
            return;
        }

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setData(KEY_CURRENT_RULE, rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        restoreFlashScopeData(context, request);

        List<ContentProvider> requestResult = handleRequest(rule);
View Full Code Here

    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void dispatchAndProcess(HttpServletRequest request, HttpServletResponse response) throws Exception {
        logger.info("access for:" + request.getRequestURI());
        UrlMappingResult result = ruleExtractor.findMappedRule(request, ruleList);

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        // if not found result, we do not need return 404, instead of user
        // defining all match rule
        WebApplicationContext context = (WebApplicationContext) Context.getCurrentThreadContext();
        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setData(KEY_CURRENT_RULE, rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        retrieveFlashScopeData(request);

        List<ContentProvider<?>> requestResult = handleRequest(rule);
View Full Code Here

public class AntPathRuleExtractor implements DispatcherRuleExtractor {
    private SpringAntPathMatcher pathMatcher = new SpringAntPathMatcher();

    @Override
    public UrlMappingResult findMappedRule(List<UrlMappingRule> ruleList, HttpMethod method, String uri, String queryString) {
        UrlMappingResult mappingResult = null;
        String srcPath;
        HttpMethod ruleMethod;
        for (UrlMappingRule rule : ruleList) {
            ruleMethod = rule.getMethod();
            if (ruleMethod != null) {
                if (ruleMethod != method) {
                    continue;
                }
            }
            srcPath = rule.getSourcePath();
            if (pathMatcher.match(srcPath, uri)) {
                mappingResult = new UrlMappingResult();
                Map<String, Object> pathVarMap = new HashMap<>();
                pathVarMap.putAll(pathMatcher.extractUriTemplateVariables(srcPath, uri));
                mappingResult.setPathVarMap(pathVarMap);
                mappingResult.setRule(rule);
                break;
            }
        }

        return mappingResult;
View Full Code Here

            context.setAccessURI(uri);
        }

        String queryString = request.getQueryString();

        UrlMappingResult result = conf.getRuleExtractor().findMappedRule(ruleList, method, uri, queryString);

        // if not found result, we do not need return 404, instead of user
        // defining all match rule

        if (result == null) {
            logger.warn("There is no matched rule found, we will simply return a 404. You should define your own matching all rule for this case.");
            response.setStatus(404);
            return;
        }

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setData(KEY_CURRENT_RULE, rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        retrieveFlashScopeData(request);

        List<ContentProvider<?>> requestResult = handleRequest(rule);
View Full Code Here

            String contextPath = request.getContextPath();
            uri = uri.substring(contextPath.length());

            String method = request.getMethod().toUpperCase();

            UrlMappingResult mappingResult = null;
            String srcPath;
            HttpMethod ruleMethod;
            for (UrlMappingRule rule : ruleList) {
                ruleMethod = rule.getMethod();
                if (ruleMethod != null) {
                    if (!ruleMethod.toString().equals(method)) {
                        continue;
                    }
                }
                srcPath = rule.getSourcePath();
                if (pathMatcher.match(srcPath, uri)) {
                    mappingResult = new UrlMappingResult();
                    Map<String, Object> pathVarMap = new HashMap<>();
                    pathVarMap.putAll(pathMatcher.extractUriTemplateVariables(srcPath, uri));
                    mappingResult.setPathVarMap(pathVarMap);
                    mappingResult.setRule(rule);
                    break;
                }
            }

            return mappingResult;
View Full Code Here

    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void dispatchAndProcess(HttpServletRequest request, HttpServletResponse response) throws Exception {
        logger.info("access for:" + request.getRequestURI());
        UrlMappingResult result = ruleExtractor.findMappedRule(request, ruleList);

        // if not found result, we do not need return 404, instead of user
        // defining all match rule

        if (result == null) {
            logger.warn("There is no matched rule found, we will simply return a 404. You should define your own matching all rule for this case.");
            response.setStatus(404);
            return;
        }

        if (logger.isDebugEnabled()) {
            logger.debug("apply rule at :" + result.getRule());
        }

        WebApplicationContext context = (WebApplicationContext) Context.getCurrentThreadContext();
        writePathVarToContext(context, result.getPathVarMap());

        UrlMappingRule rule = result.getRule();
        context.setData(KEY_CURRENT_RULE, rule);
        writePathVarToContext(context, rule.getExtraVarMap());
        retrieveFlashScopeData(request);

        List<ContentProvider<?>> requestResult = handleRequest(rule);
View Full Code Here

TOP

Related Classes of com.astamuse.asta4d.web.dispatch.mapping.UrlMappingResult

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.