Package org.impalaframework.web.servlet.wrapper

Examples of org.impalaframework.web.servlet.wrapper.RequestModuleMapping


    public void testGetModuleForRequest() {
        expect(request.getRequestURI()).andReturn("/app/mymodule/resource.htm");
        mapper.init(new IntegrationServletConfig(initParameters, servletContext, "filterServlet"));
       
        replay(request);
        assertEquals(new RequestModuleMapping("/mymodule", "mymodule", null, null), mapper.getModuleForRequest(request));
        verify(request);
    }
View Full Code Here


       
        expect(request.getRequestURI()).andReturn("/app/mymodule/resource.htm");
        mapper.init(new IntegrationServletConfig(initParameters, servletContext, "filterServlet"));
       
        replay(request);
        assertEquals(new RequestModuleMapping("/mymodule", "someprefixmymodule", null, null), mapper.getModuleForRequest(request));
        verify(request);
    }
View Full Code Here

       
        expect(request.getRequestURI()).andReturn("/app/mymodule/resource.htm");
        mapper.init(new IntegrationServletConfig(initParameters, servletContext, "filterServlet"));
       
        replay(request);
        assertEquals(new RequestModuleMapping("/mymodule", "anotherprefixmymodule", null, null), mapper.getModuleForRequest(request));
        verify(request);
    }
View Full Code Here

    void doService(HttpServletRequest request, HttpServletResponse response,
            ServletContext context)
            throws ServletException, IOException {
       
        RequestModuleMapping moduleMapping = getModuleMapping(request);
       
        if (moduleMapping != null) {
           
            processMapping(context, request, response, moduleMapping);
           
View Full Code Here

   
    public RequestModuleMapping getModuleForRequest(HttpServletRequest request) {
        Assert.notNull(requestModuleMappers, "requestModuleMappers cannot be null");
        Assert.notEmpty(requestModuleMappers, "requestModuleMappers cannot be empty");
        for (RequestModuleMapper requestModuleMapper : requestModuleMappers) {
            final RequestModuleMapping module = requestModuleMapper.getModuleForRequest(request);
            if (module != null) return module;
        }
        return null;
    }
View Full Code Here

        if (modulePrefixNode == null) {
            return null;
        }
       
        ModuleNameWithPath value = modulePrefixNode.getValue();
        return new RequestModuleMapping(modulePrefixNode.getKey(), value.getModuleName(), value.getServletPath());
    }
View Full Code Here

    void doFilter(HttpServletRequest request, HttpServletResponse response,
            ServletContext context, FilterChain chain)
            throws ServletException, IOException {

        RequestModuleMapping moduleMapping = getModuleMapping(request);
       
        if (moduleMapping != null) {
            processMapping(context, request, response, chain, moduleMapping);
        } else {
           
View Full Code Here

    protected void doFilter(HttpServletRequest request, HttpServletResponse response,
            ServletContext context, FilterChain chain)
            throws ServletException, IOException {

        RequestModuleMapping moduleMapping = getModuleMapping(request);
        String applicationId = getApplicationId(request, context);
       
        if (moduleMapping != null) {
            processMapping(context, request, response, chain, moduleMapping, applicationId);
        } else {
View Full Code Here

        if (prefix != null) {
            fullModuleName = prefix + moduleName;
        } else {
            fullModuleName = moduleName;
        }
        return new RequestModuleMapping("/" + moduleName, fullModuleName, null);
    }
View Full Code Here

        String requestURI = request.getRequestURI();
        String contextPath = request.getContextPath();
       
        if (request instanceof ModuleHttpServletRequest) {
            //deal with forwards or includes
            final RequestModuleMapping requestModuleMapping = (RequestModuleMapping) request.getAttribute(EXISTING_REQUEST_MODULE_MAPPING);
            if (requestModuleMapping != null) {
                if (!useExternalForwardingOrIncludes(request)) {
                    ModuleHttpServletRequest moduleRequest = (ModuleHttpServletRequest) request;
                    moduleRequest.setReuse();
                    return requestModuleMapping;
                }
            }  
        }
       
        final String subpath;
        if (contextPath != null) {
            subpath = requestURI.substring(contextPath.length());
        } else {
            subpath = requestURI;
        }
       
        TreeNode<ModuleNameWithPath> modulePrefixNode = getModuleForURI(subpath);
       
        if (logger.isDebugEnabled()) {
            logger.debug("Module for URI " + requestURI + ": " + modulePrefixNode);
        }
       
        if (modulePrefixNode == null) {
            return null;
        }
       
        ModuleNameWithPath value = modulePrefixNode.getValue();
        final RequestModuleMapping newMapping = new RequestModuleMapping(modulePrefixNode.getKey(), value.getModuleName(), value.getContextPath(), value.getServletPath());
       
        request.setAttribute(EXISTING_REQUEST_MODULE_MAPPING, newMapping);
        return newMapping;
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.web.servlet.wrapper.RequestModuleMapping

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.