当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionContext.proceed方法代码示例

本文整理汇总了Java中net.sourceforge.stripes.controller.ExecutionContext.proceed方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionContext.proceed方法的具体用法?Java ExecutionContext.proceed怎么用?Java ExecutionContext.proceed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sourceforge.stripes.controller.ExecutionContext的用法示例。


在下文中一共展示了ExecutionContext.proceed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    HttpServletRequest request = context.getActionBeanContext().getRequest();
    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();
        if (bean != null && !bean.getClass().isAnnotationPresent(Public.class)) {
            log.warn("Thwarted attempted to access ", bean.getClass().getSimpleName());
            return new RedirectResolution(LoginActionBean.class).addParameter("targetUrl", url);
        }
    }

    log.debug("Allowing public access to ", context.getActionBean().getClass().getSimpleName());
    return resolution;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:23,代码来源:SecurityInterceptor.java

示例2: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
@Override
public Resolution intercept(ExecutionContext context) throws Exception {
    String eventName = context.getActionBeanContext().getEventName();

    Resolution r = context.proceed();

    // If we have validation errors, Stripes will automatically try to
    // forward to the previous action. This unfortunately
    // ends up in a StripesRuntimeException "Multiple event parameters [...]
    // are present in this request ..." because
    // the previous event was not cleared and now stripes has 2 possible
    // events. The problem with this is that Stripes
    // does not know which one to choose. Here we attempt to overcome this
    // by offering Stripes an event that it may
    // ignore. See
    // com.geecommerce.core.web.AnnotatedClassActionResolver:548.
    if (eventName != null && context.getActionBeanContext().getValidationErrors().size() > 0
        && context.getActionBeanContext().getRequest().getAttribute(Constant.STRIPES_IGNORE_EVENT) == null) {
        context.getActionBeanContext().getRequest().setAttribute(Constant.STRIPES_IGNORE_EVENT, eventName);
    }

    return r;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:24,代码来源:StripesInterceptor.java

示例3: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    logger.debug("Retrieving Stripes objects");
    ActionBeanContext actionContext = context.getActionBeanContext();
    ActionBean actionBean = context.getActionBean();
    Method handler = context.getHandler();

    logger.debug("Retrieving Servlet API objects");
    HttpServletRequest request = actionContext.getRequest();

    Dispatch dispatch = DispatcherUtil.getDispatch(request);

    if(SecurityLogic.isAllowed(request, dispatch, actionBean, handler)) {
        logger.debug("Security check passed.");
        return context.proceed();
    } else {
        return new ForbiddenAccessResolution();
    }
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:19,代码来源:SecurityInterceptor.java

示例4: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    logger.debug("Retrieving Stripes objects");
    ActionBeanContext actionContext = context.getActionBeanContext();

    logger.debug("Retrieving Servlet API objects");
    HttpServletRequest request = actionContext.getRequest();

    if (request.getDispatcherType() == DispatcherType.REQUEST) {
        logger.debug("Starting page response timer");
        StopWatch stopWatch = new StopWatch();
        // There is no need to stop this timer.
        stopWatch.start();
        request.setAttribute(RequestAttributes.STOP_WATCH, stopWatch);
    }

    Resolution resolution = dispatch(actionContext);
    return resolution != null ? resolution : context.proceed();
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:19,代码来源:ApplicationInterceptor.java

示例5: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    ActionBean actionBean = context.getActionBean();
    Method handler = context.getHandler();

    logger.debug("Checking guards on {}", handler);
    if(ButtonsLogic.doGuardsPass(actionBean, handler)) {
        return context.proceed();
    } else {
        logger.warn("Operation not permitted. Method: " + context.getHandler());
        if(actionBean instanceof Guarded) {
            return ((Guarded) actionBean).guardsFailed(handler);
        } else {
            return new ErrorResolution(CONFLICT);
        }
    }
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:17,代码来源:GuardsInterceptor.java

示例6: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    if(context.getHandler() != null && context.getHandler().isAnnotationPresent(ControlsCache.class)) {
        return context.proceed();
    }
    HttpServletResponse response = context.getActionBeanContext().getResponse();
    // Avoid caching of dynamic pages
    //HTTP 1.0
    response.setHeader(ServletConstants.HTTP_PRAGMA, ServletConstants.HTTP_PRAGMA_NO_CACHE);
    response.setDateHeader(ServletConstants.HTTP_EXPIRES, 0);

    //HTTP 1.1
    response.addHeader(ServletConstants.HTTP_CACHE_CONTROL, ServletConstants.HTTP_CACHE_CONTROL_NO_CACHE);
    response.addHeader(ServletConstants.HTTP_CACHE_CONTROL, ServletConstants.HTTP_CACHE_CONTROL_NO_STORE);
    //response.addHeader(ServletConstants.HTTP_CACHE_CONTROL, ServletConstants.HTTP_CACHE_CONTROL_MUST_REVALIDATE);
    //response.addHeader(ServletConstants.HTTP_CACHE_CONTROL, ServletConstants.HTTP_CACHE_CONTROL_MAX_AGE + 0);

    return context.proceed();
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:19,代码来源:NoCacheInterceptor.java

示例7: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
@Override
public Resolution intercept(ExecutionContext context) throws Exception {
    HttpServletRequest request = context.getActionBeanContext().getRequest();
    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 = ((MobileActionBeanContext) context.getActionBeanContext()).getCustomer() != null;
    if (!authed && resolution == null) {
        ActionBean bean = context.getActionBean();
        if (bean != null && !bean.getClass().isAnnotationPresent(Public.class)) {
            log.warn("Thwarted attempted to access ", bean.getClass().getSimpleName());
            return new RedirectResolution(CustomerAuthorizationActionBean.class).addParameter("targetUrl", url);
        }
    }

    log.debug("Allowing public access to ", context.getActionBean().getClass().getSimpleName());
    return resolution;
}
 
开发者ID:nordpos-mobi,项目名称:online-retail,代码行数:25,代码来源:SecurityInterceptor.java

示例8: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
@Override
public Resolution intercept(ExecutionContext context) throws Exception {
    HttpServletRequest request = context.getActionBeanContext().getRequest();
    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 = ((MobileActionBeanContext) context.getActionBeanContext()).getUser() != null;
    if (!authed && resolution == null) {
        ActionBean bean = context.getActionBean();
        if (bean != null && !bean.getClass().isAnnotationPresent(Public.class)) {
            log.warn("Thwarted attempted to access ", bean.getClass().getSimpleName());
            return new RedirectResolution(UserAuthorizationActionBean.class).addParameter("targetUrl", url);
        }
    }

    log.debug("Allowing public access to ", context.getActionBean().getClass().getSimpleName());
    return resolution;
}
 
开发者ID:nordpos-mobi,项目名称:restaurant-service,代码行数:25,代码来源:SecurityInterceptor.java

示例9: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc} Sanitize all the request parameters before allowing the ActionBean resolution to proceed.
 */
public Resolution intercept(ExecutionContext context) throws Exception {
    StripesRequestWrapper stripesWrapper = null;
    HttpServletRequest originalRequest = null;

    try {
        currentContext.set(context);
        stripesWrapper = StripesRequestWrapper.findStripesWrapper(context.getActionBeanContext().getRequest());
        originalRequest = (HttpServletRequest) stripesWrapper.getRequest();
        stripesWrapper.setRequest(new XssRequestWrapper(originalRequest));
        return context.proceed();
    } finally {
        currentContext.remove();
        if (stripesWrapper != null && originalRequest != null) {
            stripesWrapper.setRequest(originalRequest);
        }
    }
}
 
开发者ID:StripesFramework,项目名称:stripes-xss,代码行数:21,代码来源:XssInterceptor.java

示例10: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
/**
 * Invoked when intercepting the flow of execution.
 *
 * @param context the ExecutionContext of the request currently being processed
 * @return the result of calling context.proceed(), or if the interceptor wishes to change
 *         the flow of execution, a Resolution
 * @throws Exception if any non-recoverable errors occur
 */
public Resolution intercept(ExecutionContext context)
		throws Exception
{
	HttpServletRequest request = context.getActionBeanContext().getRequest();

	if (resourceBundleFactory != null)
	{
		ResourceBundle bundle = resourceBundleFactory.getDefaultBundle(request.getLocale());
		setMessageResourceBundle(request, bundle);
	}

	setOtherResourceBundles(request);

	return context.proceed();
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:24,代码来源:AbstractBundleInterceptor.java

示例11: interceptBindingAndValidation

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
/**
 * Intercept execution for binding and/or (custom) validations. Checks that the security doesn't deny access before
 * any error messages are shown.
 *
 * @param executionContext the context of the execution being intercepted
 * @return the resulting {@link net.sourceforge.stripes.action.Resolution}; returns {@link ExecutionContext#proceed()} if all is well
 * @throws Exception on error
 */
protected Resolution interceptBindingAndValidation(ExecutionContext executionContext)
		throws Exception
{
	Resolution resolution = executionContext.proceed();

	// We're handling binding and/or validation. If there are errors and a resolution to display them, check if
	// access is allowed. If explicitly denied, access is denied (as showing errors would both be pointless and an
	// information leak).

	if (resolution != null && !executionContext.getActionBeanContext().getValidationErrors().isEmpty() &&
	    Boolean.FALSE.equals(getAccessAllowed(executionContext)))
	{
		// If the security manager denies access, deny access.

		LOG.debug("Binding and/or validation failed, and the security manager has denied access.");
		resolution = handleAccessDenied(executionContext.getActionBean(), executionContext.getHandler());
	}

	// Return the result.

	return resolution;
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:31,代码来源:SecurityInterceptor.java

示例12: interceptEventHandling

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
/**
 * Intercept execution for event handling. Checks if the security manager allows access before allowing the event.
 *
 * @param executionContext the context of the execution being intercepted
 * @return the resulting {@link net.sourceforge.stripes.action.Resolution}; returns {@link ExecutionContext#proceed()} if all is well
 * @throws Exception on error
 */
protected Resolution interceptEventHandling(ExecutionContext executionContext)
		throws Exception
{
	// Before handling the event, check if access is allowed.
	// If not explicitly allowed, access is denied.

	Resolution resolution;

	if (Boolean.TRUE.equals(getAccessAllowed(executionContext)))
	{
		resolution = executionContext.proceed();
	}
	else
	{
		LOG.debug("The security manager has denied access.");
		resolution = handleAccessDenied(executionContext.getActionBean(), executionContext.getHandler());
	}

	return resolution;
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:28,代码来源:SecurityInterceptor.java

示例13: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    // Continue on and execute other filters and the lifecycle code.
    Resolution resolution = context.proceed();
    
    // Get all fields with session.
    Collection<Field> fields = getSessionFields(context.getActionBean().getClass());
    
    // Restores values from session.
    if (LifecycleStage.ActionBeanResolution.equals(context.getLifecycleStage())) {
        this.restoreFields(fields, context.getActionBean(), context.getActionBeanContext());
    }
    // Store values in session.
    if (LifecycleStage.EventHandling.equals(context.getLifecycleStage())) {
        // Dont't update values in session if a validation error occured.
        if (context.getActionBeanContext().getValidationErrors().isEmpty()) {
        	if (fields.size() > 0)
        		this.saveFields(fields, context.getActionBean(), context.getActionBeanContext().getRequest().getSession());
        }
    }
    
    return resolution;
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:23,代码来源:SessionStoreInterceptor.java

示例14: intercept

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
public Resolution intercept(ExecutionContext executionContext)
        throws Exception {
    Resolution resolution;

    switch (executionContext.getLifecycleStage()) {
        case CustomValidation:
            resolution = interceptCustomValidation(executionContext);
            break;
        default:
            resolution = executionContext.proceed();
            break;
    }
    return resolution;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:15,代码来源:LoginInterceptor.java

示例15: interceptCustomValidation

import net.sourceforge.stripes.controller.ExecutionContext; //导入方法依赖的package包/类
protected Resolution interceptCustomValidation(
        ExecutionContext executionContext) throws Exception {

    if (executionContext.getActionBean().getClass()
            .isAnnotationPresent(SkipAuthentication.class)) {
        return executionContext.proceed();
    }
    String target = ((BeyondJActionBeanContext) executionContext
            .getActionBean().getContext()).getTarget();

    String userId = (String) executionContext.getActionBean()
            .getContext().getRequest().getSession()
            .getAttribute(Constants.LOGGED_IN_USER_ID);

    if (userId == null) {
        if (StringUtils.isBlank(target)) {
            return new RedirectResolution(WEB_USER_HOME);
        } else {
            executionContext.getActionBean().getContext()
                    .getValidationErrors().clear();
            return new RedirectResolution(WEB_USER_HOME_VIEW_TARGET
                    + target);
        }
    }

    return executionContext.proceed();
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:28,代码来源:LoginInterceptor.java


注:本文中的net.sourceforge.stripes.controller.ExecutionContext.proceed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。