Package net.sourceforge.stripes.controller

Examples of net.sourceforge.stripes.controller.ActionResolver


    public String getAction() { return this.actionWithoutContext; }

    /** Get the URL binding for the form's {@link ActionBean} from the {@link ActionResolver}. */
    protected String getActionBeanUrlBinding() {
        ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
        if (actionBeanClass == null) {
            String binding = resolver.getUrlBindingFromPath(actionWithoutContext);
            if (binding == null)
                binding = actionWithoutContext;
            return binding;
        }
        else {
            return resolver.getUrlBinding(actionBeanClass);
        }
    }
View Full Code Here


    }

    /** Lazily looks up and returns the type of action bean the form will submit to. */
    protected Class<? extends ActionBean> getActionBeanClass() {
        if (this.actionBeanClass == null) {
            ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
            this.actionBeanClass = resolver.getActionBeanType(getActionBeanUrlBinding());
        }

        return this.actionBeanClass;
    }
View Full Code Here

        ActionBean actionBean = (ActionBean) getPageContext().findAttribute(binding);
        boolean beanNotPresent = actionBean == null;

        try {
            final Configuration config = StripesFilter.getConfiguration();
            final ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
            final HttpServletRequest request = (HttpServletRequest) getPageContext().getRequest();
            final HttpServletResponse response = (HttpServletResponse) getPageContext().getResponse();
            Resolution resolution = null;
            ExecutionContext ctx = new ExecutionContext();

            // Lookup the ActionBean if we don't already have it
            if (beanNotPresent) {
                ActionBeanContext tempContext =
                        config.getActionBeanContextFactory().getContextInstance(request, response);
                tempContext.setServletContext(getPageContext().getServletContext());
                ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution);
                ctx.setActionBeanContext(tempContext);

                // Run action bean resolution
                ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution));
                resolution = ctx.wrap( new Interceptor() {
                    public Resolution intercept(ExecutionContext ec) throws Exception {
                        ActionBean bean = resolver.getActionBean(ec.getActionBeanContext(), binding);
                        ec.setActionBean(bean);
                        return null;
                    }
                });
            }
            else {
                ctx.setActionBean(actionBean);
                ctx.setActionBeanContext(actionBean.getContext());
            }

            // Then, if and only if an event was specified, run handler resolution
            if (resolution == null && event != null && (beanNotPresent || this.alwaysExecuteEvent)) {
                ctx.setLifecycleStage(LifecycleStage.HandlerResolution);
                ctx.setInterceptors(config.getInterceptors(LifecycleStage.HandlerResolution));
                resolution = ctx.wrap( new Interceptor() {
                    public Resolution intercept(ExecutionContext ec) throws Exception {
                        ec.setHandler(resolver.getHandler(ec.getActionBean().getClass(), event));
                        ec.getActionBeanContext().setEventName(event);
                        return null;
                    }
                });
            }
View Full Code Here

     * @return the base URL, without a query string
     * @see #UrlBuilder(Locale, Class, boolean)
     * @see #UrlBuilder(Locale, String, boolean)
     */
    protected String getBaseURL(String baseUrl, Collection<Parameter> parameters) {
        ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
        if (!(resolver instanceof AnnotatedClassActionResolver))
            return baseUrl;

        UrlBinding binding = null;
        try {
View Full Code Here

    public String getAction() { return this.actionWithoutContext; }

    /** Get the URL binding for the form's {@link ActionBean} from the {@link ActionResolver}. */
    protected String getActionBeanUrlBinding() {
        ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
        if (actionBeanClass == null) {
            String binding = resolver.getUrlBindingFromPath(actionWithoutContext);
            if (binding == null)
                binding = actionWithoutContext;
            return binding;
        }
        else {
            return resolver.getUrlBinding(actionBeanClass);
        }
    }
View Full Code Here

    }

    /** Lazily looks up and returns the type of action bean the form will submit to. */
    protected Class<? extends ActionBean> getActionBeanClass() {
        if (this.actionBeanClass == null) {
            ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
            this.actionBeanClass = resolver.getActionBeanType(getActionBeanUrlBinding());
        }

        return this.actionBeanClass;
    }
View Full Code Here

     * @return the base URL, without a query string
     * @see #UrlBuilder(Locale, Class, boolean)
     * @see #UrlBuilder(Locale, String, boolean)
     */
    protected String getBaseURL(String baseUrl, Collection<Parameter> parameters) {
        ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
        if (!(resolver instanceof AnnotatedClassActionResolver))
            return baseUrl;

        UrlBinding binding = null;
        try {
View Full Code Here

    protected boolean isEventName(Class<? extends ActionBean> beanType, String name) {
        if (beanType == null || name == null)
            return false;

        try {
            ActionResolver actionResolver = StripesFilter.getConfiguration().getActionResolver();
            return actionResolver.getHandler(beanType, name) != null;
        }
        catch (StripesServletException e) {
            // Ignore the exception and assume the name is not an event
            return false;
        }
View Full Code Here

    public String getAction() { return this.actionWithoutContext; }

    /** Get the URL binding for the form's {@link ActionBean} from the {@link ActionResolver}. */
    protected String getActionBeanUrlBinding() {
        ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
        if (actionBeanClass == null) {
            String path = StringUtil.trimFragment(this.actionWithoutContext);
            String binding = resolver.getUrlBindingFromPath(path);
            if (binding == null)
                binding = path;
            return binding;
        }
        else {
            return resolver.getUrlBinding(actionBeanClass);
        }
    }
View Full Code Here

    }

    /** Lazily looks up and returns the type of action bean the form will submit to. */
    protected Class<? extends ActionBean> getActionBeanClass() {
        if (this.actionBeanClass == null) {
            ActionResolver resolver = StripesFilter.getConfiguration().getActionResolver();
            this.actionBeanClass = resolver.getActionBeanType(getActionBeanUrlBinding());
        }

        return this.actionBeanClass;
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.controller.ActionResolver

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.