Package org.springframework.web.servlet.mvc

Examples of org.springframework.web.servlet.mvc.BaseCommandController


        HttpServletResponse response = new MockHttpServletResponse();
        Object command = new Object();
        Map model = new HashMap();
       
        final String commandName = "commandKey";
        BaseCommandController controller = new BaseCommandController() {
            protected ModelAndView handleRequestInternal(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
                throw new UnsupportedOperationException("Not supported yet.");
            }
        };
       
        controller.setCommandName(commandName);
        model.put(commandName, command);
       
        assertEquals(command, this.accessor.getCommandObject(request, response, controller, model));
    }
View Full Code Here


    private static final Log logger = LogFactory.getLog(ValangRulesExportInterceptor.class);

    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
            ModelAndView modelAndView) throws Exception {

        BaseCommandController controller = retrieveBaseCommandControllerIfPossible(handler);
        if (controller == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Controller is of type " + controller.getClass() + " so ignoring");
            }
            return;
        }

        Map model = modelAndView.getModel();
        String commandName = controller.getCommandName();
        if (model == null || !model.containsKey(commandName)) {
            if (logger.isWarnEnabled()) {
                logger.debug("Handler '" + handler + "' did not export command object '" + controller.getCommandName()
                        + "'; no rules added to model");
            }
            return;
        }

        Validator[] validators = controller.getValidators();
        for (int i = 0; i < validators.length; i++) {
            if (!ValangValidator.class.isInstance(validators[i])) {
                continue;
            }
View Full Code Here

     *            the handler to convert to a <code>BaseCommandController</code>.
     * @return a <code>BaseCommandController</code> or <code>null</code> if <code>handler</code> cannot be converted.
     * @throws Exception
     */
    private BaseCommandController retrieveBaseCommandControllerIfPossible(Object handler) throws Exception {
        BaseCommandController baseCommandController = null;

        if (BaseCommandController.class.isAssignableFrom(handler.getClass())) {
            if (logger.isDebugEnabled()) {
                logger.debug("handler is type compatible, simply cast");
            }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.mvc.BaseCommandController

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.