Package net.sourceforge.stripes.action

Examples of net.sourceforge.stripes.action.Resolution


     * @param context the current execution context
     * @return the Resolution produced by calling context.proceed()
     * @throws Exception if the Tuscany injection process produced unrecoverable errors
     */
    public Resolution intercept(ExecutionContext context) throws Exception {
        Resolution resolution = context.proceed();
        log.debug("Running Tuscany dependency injection for instance of ",
                  context.getActionBean().getClass().getSimpleName());
        TuscanyHelper.injectBeans(context.getActionBean(), context.getActionBeanContext());
        return resolution;
    }
View Full Code Here


     */
  public Resolution intercept(ExecutionContext context) throws Exception {
    LifecycleStage stage = context.getLifecycleStage();
        ActionBeanContext abc = context.getActionBeanContext();
        String event = abc == null ? null : abc.getEventName();
        Resolution resolution = null;

    // Run @Before methods, as long as there's a bean to run them on
    if (context.getActionBean() != null) {
            ActionBean bean = context.getActionBean();
            FilterMethods filterMethods = getFilterMethods(bean.getClass());
      List<Method> beforeMethods = filterMethods.getBeforeMethods(stage);

            for (Method method : beforeMethods) {
                String[] on = method.getAnnotation(Before.class).on();
                if (event == null || CollectionUtil.applies(on, event)) {
                    resolution = invoke(bean, method, stage, Before.class);
                    if (resolution != null) {
                        return resolution;
                    }
                }
            }
        }

        // Continue on and execute other filters and the lifecycle code
        resolution = context.proceed();

        // Run After filter methods (if any)
        if (context.getActionBean() != null) {
            ActionBean bean = context.getActionBean();
            FilterMethods filterMethods = getFilterMethods(bean.getClass());
            List<Method> afterMethods = filterMethods.getAfterMethods(stage);

            // Re-get the event name in case we're executing after handler resolution
            // in which case the name will have been null before, and non-null now
            event = abc == null ? null : abc.getEventName();

            Resolution overrideResolution = null;
            for (Method method : afterMethods) {
                String[] on = method.getAnnotation(After.class).on();
                if (event == null || CollectionUtil.applies(on, event)) {
                    overrideResolution = invoke(bean, method, stage, After.class);
                    if (overrideResolution != null) {
View Full Code Here

     * @return an ActionBean that will render a view for the user, or null
     * @since Stripes 1.3
     */
    protected ActionBean handleActionBeanNotFound(ActionBeanContext context, String urlBinding) {
        ActionBean bean = null;
        Resolution view = findView(urlBinding);

        if (view != null) {
            log.debug("Could not find an ActionBean bound to '", urlBinding, "', but found a view ",
                      "at '", view, "'. Forwarding the user there instead.");
            bean = new DefaultViewActionBean(view);
View Full Code Here

        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 =
View Full Code Here

        boolean doValidate = annotation == null || !annotation.ignoreBindingErrors();

        // If we have errors, add the action path to them
        fillInValidationErrors(ctx);

        Resolution resolution = null;
        if (doValidate) {
            ActionBean bean = ctx.getActionBean();
            ActionBeanContext context = ctx.getActionBeanContext();
            ValidationErrors errors = context.getValidationErrors();
View Full Code Here

        ctx.setLifecycleStage(LifecycleStage.ResolutionExecution);
        ctx.setInterceptors(config.getInterceptors(LifecycleStage.ResolutionExecution));
        ctx.setResolution(resolution);

        Resolution retval = ctx.wrap( new Interceptor() {
            public Resolution intercept(ExecutionContext context) throws Exception {
                ActionBeanContext abc = context.getActionBeanContext();
                Resolution resolution = context.getResolution();

                if (resolution != null) {
                    resolution.execute(abc.getRequest(), abc.getResponse());
                }

                return null;
            }
        });
View Full Code Here

            if (proxy != null) {
                proxy.handle(actual, request, response);
            }
            else if (throwable instanceof FileUploadLimitExceededException) {
                Resolution resolution = handle((FileUploadLimitExceededException) throwable,
                        request, response);
                if (resolution != null)
                    resolution.execute(request, response);
            }
            else {
                // If there's no sensible proxy, rethrow the original throwable,
                // NOT the unwrapped one since they may add extra information
                log.warn(throwable, "Unhandled exception caught by the Stripes default exception handler.");
View Full Code Here

            }

            // Resolve the ActionBean, and if an interceptor returns a resolution, bail now
            saveActionBean(request);
           
            Resolution resolution = requestInit(ctx);
           
            if (resolution == null) {
                resolution = resolveActionBean(ctx);

                if (resolution == null) {
View Full Code Here

     */
    private void requestComplete(ExecutionContext ctx) {
        ctx.setLifecycleStage(LifecycleStage.RequestComplete);
        ctx.setInterceptors(StripesFilter.getConfiguration().getInterceptors(LifecycleStage.RequestComplete));
        try {
            Resolution resolution = ctx.wrap(new Interceptor() {public Resolution intercept(ExecutionContext context) throws Exception {return null;}});
            if (resolution != null)
                log.warn("Resolutions returned from interceptors for ", ctx.getLifecycleStage(),
                        " are ignored because it is too late to execute them.");
        }
        catch (Exception e) {
View Full Code Here

@Intercepts(LifecycleStage.ActionBeanResolution)
public class SecurityInterceptor implements Interceptor {

    public Resolution intercept(ExecutionContext execContext) throws Exception {
        Resolution resolution = execContext.proceed();
        ActionBean actionBean = execContext.getActionBean();
        String path = UrlBindingFactory.getInstance().getBindingPrototype(
                actionBean.getClass()).getPath();
        if (path.contains("validareConturi") || path.contains("stergereConturiGeologi") || path.contains("Admin.action?datePersonale")) {
            HttpSession session = execContext.getActionBeanContext().getRequest().getSession(false);
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.action.Resolution

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.