Package net.sourceforge.stripes.action

Examples of net.sourceforge.stripes.action.Resolution


        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 (throwable instanceof SourcePageNotFoundException) {
                Resolution resolution = handle((SourcePageNotFoundException) 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

     */
  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

        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

    public Resolution view() {
        final InputStream stream = getContext().getRequest().getSession()
                                  .getServletContext().getResourceAsStream(this.resource);
        final BufferedReader reader = new BufferedReader( new InputStreamReader(stream) );

        return new Resolution() {
            public void execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
                PrintWriter writer = response.getWriter();
                writer.write("<html><head><title>");
                writer.write(resource);
                writer.write("</title></head><body><pre>");
View Full Code Here

        String url = HttpUtil.getRequestedPath(request);
        if (request.getQueryString() != null)
            url = url + '?' + request.getQueryString();
        log.debug("Intercepting request: ", url);

        Resolution resolution = context.proceed();

        // A null resolution here indicates a normal flow to the next stage
        boolean authed = ((BugzookyActionBeanContext) context.getActionBeanContext()).getUser() != null;
        if (!authed && resolution == null) {
            ActionBean bean = context.getActionBean();
View Full Code Here

   * (non-Javadoc)
   *
   * @see net.sourceforge.stripes.controller.Interceptor#intercept(net.sourceforge.stripes.controller.ExecutionContext)
   */
  public Resolution intercept(ExecutionContext execContext) throws Exception {
    Resolution resolution = execContext.proceed();
    ActionBean actionBean = execContext.getActionBean();
    EsimsBaseActionBeanContext esimsBaseActionBeanContext = (EsimsBaseActionBeanContext) actionBean
        .getContext();
    if (isPermitted(esimsBaseActionBeanContext)) {
      return resolution;
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.