• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LifecycleStage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sourceforge.stripes.controller.LifecycleStage的典型用法代码示例。如果您正苦于以下问题:Java LifecycleStage类的具体用法?Java LifecycleStage怎么用?Java LifecycleStage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LifecycleStage类属于net.sourceforge.stripes.controller包,在下文中一共展示了LifecycleStage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Splits a comma-separated list of class names and maps each {@link LifecycleStage} to the
 * interceptors in the list that intercept it. Also automatically finds Interceptors in
 * packages listed in {@link BootstrapPropertyResolver#PACKAGES} if searchExtensionPackages is true.
 * 
 * @return a Map of {@link LifecycleStage} to Collection of {@link Interceptor}
 */
@SuppressWarnings("unchecked")
protected Map<LifecycleStage, Collection<Interceptor>> initInterceptors(List classes) {

    Map<LifecycleStage, Collection<Interceptor>> map = new HashMap<LifecycleStage, Collection<Interceptor>>();

    for (Object type : classes) {
        try {
            Interceptor interceptor = getObjectFactory().newInstance(
                    (Class<? extends Interceptor>) type);
            addInterceptor(map, interceptor);
        }
        catch (Exception e) {
            throw new StripesRuntimeException("Could not instantiate configured Interceptor ["
                    + type.getClass().getName() + "].", e);
        }
    }

    return map;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:27,代码来源:RuntimeConfiguration.java


示例2: runStripesInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
protected void runStripesInterceptors(ContainerRequestContext requestContext, Object resource, boolean before) {
    if(resource instanceof ActionBean) {
        BridgeExecutionContext executionContext = new BridgeExecutionContext(before);
        ActionBean actionBean = (ActionBean) resource;
        executionContext.setActionBean(actionBean);
        executionContext.setActionBeanContext(actionBean.getContext());
        executionContext.setHandler(resourceInfo.getResourceMethod());
        executionContext.setLifecycleStage(LifecycleStage.EventHandling);
        try {
            Resolution resolution = beforeAfterMethodInterceptor.intercept(executionContext);
            if(resolution != null) {
                requestContext.abortWith(Response.ok(resolution).build());
            }
        } catch (Exception e) {
            logger.error("Exception applying before/after method interceptor", e);
            requestContext.abortWith(Response.serverError().entity(e).build());
        }
    }
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:20,代码来源:PortofinoFilter.java


示例3: intercept

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的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


示例4: list

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@Before(stages = LifecycleStage.EventHandling)
public void list(){
    if (this.getVanencompetition()!=null){
        this.poules = Stripersist.getEntityManager().createQuery("FROM Poule where vanencompetition = :v").setParameter("v",this.getVanencompetition()).getResultList();
        if (this.type!=null || (this.poule!=null && this.poule.getType()!=null)){
            CompetitionType ct =null;
            if (this.type!=null){
                ct= CompetitionType.valueOf(this.type);
            }else{
                ct = this.poule.getType();
            }
            this.participantsWithoutPoule = Stripersist.getEntityManager()
                    .createQuery("FROM Participant where poule is null and vanencompetition = :v and type = :t order by karateka.belt,karateka.birthdate")
                    .setParameter("v", this.getVanencompetition()).setParameter("t", ct).getResultList();
        }else{
            this.participantsWithoutPoule = Stripersist.getEntityManager()
                    .createQuery("FROM Participant where poule is null and vanencompetition = :v order by karateka.belt,karateka.birthdate")
                    .setParameter("v", this.getVanencompetition()).getResultList();
        }
    }
}
 
开发者ID:rbraam,项目名称:vanenapp,代码行数:22,代码来源:PouleActionBean.java


示例5: initCoreInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Looks for a list of class names separated by commas under the configuration key
 * {@link #CORE_INTERCEPTOR_LIST}.  White space surrounding the class names is trimmed,
 * the classes instantiated and then stored under the lifecycle stage(s) they should
 * intercept.
 * 
 * @return a Map of {@link LifecycleStage} to Collection of {@link Interceptor}
 */
@Override
protected Map<LifecycleStage, Collection<Interceptor>> initCoreInterceptors() {
    List<Class<?>> coreInterceptorClasses = getBootstrapPropertyResolver().getClassPropertyList(CORE_INTERCEPTOR_LIST);
    if (coreInterceptorClasses.size() == 0)
        return super.initCoreInterceptors();
    else
        return initInterceptors(coreInterceptorClasses);
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:17,代码来源:RuntimeConfiguration.java


示例6: getInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Returns a list of interceptors that should be executed around the lifecycle stage
 * indicated.  By default returns a single element list containing the 
 * {@link BeforeAfterMethodInterceptor}.
 */
public Collection<Interceptor> getInterceptors(LifecycleStage stage) {
    Collection<Interceptor> interceptors = this.interceptors.get(stage);
    if (interceptors == null) {
        interceptors = Collections.emptyList();
    }
    return interceptors;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:13,代码来源:DefaultConfiguration.java


示例7: mergeInterceptorMaps

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Merges the two {@link Map}s of {@link LifecycleStage} to {@link Collection} of
 * {@link Interceptor}. A simple {@link Map#putAll(Map)} does not work because it overwrites
 * the collections in the map instead of adding to them.
 */
protected void mergeInterceptorMaps(Map<LifecycleStage, Collection<Interceptor>> dst,
        Map<LifecycleStage, Collection<Interceptor>> src) {
    for (Map.Entry<LifecycleStage, Collection<Interceptor>> entry : src.entrySet()) {
        Collection<Interceptor> collection = dst.get(entry.getKey());
        if (collection == null) {
            collection = new LinkedList<Interceptor>();
            dst.put(entry.getKey(), collection);
        }
        collection.addAll(entry.getValue());
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:17,代码来源:DefaultConfiguration.java


示例8: addInterceptor

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Adds the interceptor to the map, associating it with the {@link LifecycleStage}s indicated
 * by the {@link Intercepts} annotation. If the interceptor implements
 * {@link ConfigurableComponent}, then its init() method will be called.
 */
protected void addInterceptor(Map<LifecycleStage, Collection<Interceptor>> map,
        Interceptor interceptor) {
    Class<? extends Interceptor> type = interceptor.getClass();
    Intercepts intercepts = type.getAnnotation(Intercepts.class);
    if (intercepts == null) {
        log.error("An interceptor of type ", type.getName(), " was configured ",
                "but was not marked with an @Intercepts annotation. As a ",
                "result it is not possible to determine at which ",
                "lifecycle stages the interceptor should be applied. This ",
                "interceptor will be ignored.");
        return;
    }
    else {
        log.debug("Configuring interceptor '", type.getSimpleName(),
                "', for lifecycle stages: ", intercepts.value());
    }

    // call init() if the interceptor implements ConfigurableComponent
    if (interceptor instanceof ConfigurableComponent) {
        try {
            ((ConfigurableComponent) interceptor).init(this);
        }
        catch (Exception e) {
            log.error("Error initializing interceptor of type " + type.getName(), e);
        }
    }

    for (LifecycleStage stage : intercepts.value()) {
        Collection<Interceptor> stack = map.get(stage);
        if (stack == null) {
            stack = new LinkedList<Interceptor>();
            map.put(stage, stack);
        }

        stack.add(interceptor);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:43,代码来源:DefaultConfiguration.java


示例9: initCoreInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/** Instantiates the core interceptors, allowing subclasses to override the default behavior */
protected Map<LifecycleStage, Collection<Interceptor>> initCoreInterceptors() {
    Map<LifecycleStage, Collection<Interceptor>> interceptors = new HashMap<LifecycleStage, Collection<Interceptor>>();
    addInterceptor(interceptors, new BeforeAfterMethodInterceptor());
    addInterceptor(interceptors, new HttpCacheInterceptor());
    return interceptors;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:8,代码来源:DefaultConfiguration.java


示例10: setupContext

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public void setupContext() throws Exception {
    context = new MockServletContext("waitpage");
    
    // Add the Stripes Filter
    Map<String,String> filterParams = new HashMap<String,String>();
    filterParams.put("CoreInterceptor.Classes",
            "org.stripesstuff.tests.waitpage.TestableWaitPageInterceptor," +
            "net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor," +
            "net.sourceforge.stripes.controller.HttpCacheInterceptor");
    filterParams.put("ActionResolver.Packages",
            "org.stripesstuff.tests.waitpage.action");
    filterParams.put("WaitPageInterceptor.ContextTimeout",
        "2000");
    context.addFilter(StripesFilter.class, "StripesFilter", filterParams);
    
    // Add the Stripes Dispatcher
    context.setServlet(DispatcherServlet.class, "StripesDispatcher", null);
    
    // Obtain WaitPageInterceptor instance.
    StripesFilter stripesFilter = (StripesFilter)context.getFilters().get(0);
    Iterator<Interceptor> interceptorsIter = stripesFilter.getInstanceConfiguration().getInterceptors(LifecycleStage.ActionBeanResolution).iterator();
    WaitPageInterceptor waitPageInterceptor = null;
    while (waitPageInterceptor == null && interceptorsIter.hasNext()) {
        Interceptor interceptor = interceptorsIter.next();
        if (interceptor instanceof WaitPageInterceptor) {
            waitPageInterceptor = (WaitPageInterceptor)interceptor;
        }
    }
    assertNotNull(waitPageInterceptor);
    Field field = WaitPageInterceptor.class.getDeclaredField("contexts");
    field.setAccessible(true);
    waitContexts = (Map<Integer, Context>)field.get(waitPageInterceptor);
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:36,代码来源:WaitPageExpiredTest.java


示例11: load

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@Before(stages = LifecycleStage.BindingAndValidation)
public void load() {
    user=(User) context.getRequest().getUserPrincipal();
    Organisation o = user.getOrganisation();
    Date now = new Date();
    if (getUser().checkRole(Role.SUPERADMIN.name())){
        setVanencompetitions((List<Vanencompetition>) Stripersist.getEntityManager().createQuery("From Vanencompetition where date >= :d ORDER BY date")
                .setParameter("d",now).getResultList());
    }else if (o!=null){
        setVanencompetitions((List<Vanencompetition>) Stripersist.getEntityManager().createQuery("From Vanencompetition where date >= :d and organisation = :o ORDER BY date")
                .setParameter("d",now).setParameter("o", o).getResultList());
    } 
}
 
开发者ID:rbraam,项目名称:vanenapp,代码行数:14,代码来源:VanencompetitionActionBean.java


示例12: initVanencompetition

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@After(stages = {LifecycleStage.BindingAndValidation})
public void initVanencompetition() {
    if (vanencompetitionId != null) {
        EntityManager em = Stripersist.getEntityManager();
        setVanencompetition(em.find(Vanencompetition.class, vanencompetitionId));
    }
}
 
开发者ID:rbraam,项目名称:vanenapp,代码行数:8,代码来源:OrganizeVanencompetitionActionBean.java


示例13: beforeHandlerResolution

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@Before(stages = { LifecycleStage.HandlerResolution })
public void beforeHandlerResolution() {
	fbAppId = WebContainerProperties.INSTANCE.getFbAppId();
	googleClientId = WebContainerProperties.INSTANCE.getGoogleClientId();
	if (fbAppId.isEmpty() && googleClientId.isEmpty()) {
		showCycLogin = true;
	}

	WinnerResult result = WinnerHistoryCalculation.INSTANCE.calc();
	threeDayWinner = result.getThreeDayWinner();
	threeDayWinnerTimeRange = result.getThreeDayWinnerTimeRange().toString();

	registerDisabled = WebContainerProperties.INSTANCE.getSystemDisabledDate().before(new Date());
	systemMessage = WebContainerProperties.INSTANCE.getSystemMessage();
}
 
开发者ID:oglimmer,项目名称:cyc,代码行数:16,代码来源:LandingActionBean.java


示例14: generateCaptcha

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@After(stages = { LifecycleStage.BindingAndValidation })
public void generateCaptcha() {
	if (WebContainerProperties.INSTANCE.isCaptchaEnabled()
			&& (captchaTokenCrypted == null || captchaTokenCrypted.isEmpty())) {
		captchaTokenCrypted = CaptchaServlet.getService().encrypt(CaptchaServlet.generateToken());
	}
}
 
开发者ID:oglimmer,项目名称:cyc,代码行数:8,代码来源:RegisterActionBean.java


示例15: encodeCaptchaTokenCrypted

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@Before(stages = { LifecycleStage.ResolutionExecution })
public void encodeCaptchaTokenCrypted() {
	try {
		if (WebContainerProperties.INSTANCE.isCaptchaEnabled()) {
			captchaTokenCryptedUrl = URLEncoder.encode(captchaTokenCrypted, "UTF-8");
		}
	} catch (UnsupportedEncodingException e) {
		log.error("Failed to encode captchaTokenCrypted", e);
	}
}
 
开发者ID:oglimmer,项目名称:cyc,代码行数:11,代码来源:RegisterActionBean.java


示例16: getNextRunFromGameEngine

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
@Before(stages = { LifecycleStage.EventHandling })
public void getNextRunFromGameEngine() {
	Date nextRunDate = GameScheduler.INSTANCE.getNextRun();
	DateFormat dateTimeDf = DateFormat.getDateTimeInstance();
	setNextRun(dateTimeDf.format(nextRunDate));

	WinnerResult result = WinnerHistoryCalculation.INSTANCE.calc();
	threeDayWinner = result.getThreeDayWinner();
	threeDayWinnerTimeRange = result.getThreeDayWinnerTimeRange().toString();
	lastWinner = result.getLastWinner();
}
 
开发者ID:oglimmer,项目名称:cyc,代码行数:12,代码来源:PortalActionBean.java


示例17: initInterceptors

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/** Allows subclasses to initialize a non-default Map of Interceptor instances. */
protected Map<LifecycleStage,Collection<Interceptor>> initInterceptors() { return null; }
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:3,代码来源:DefaultConfiguration.java


示例18: addHandlerResolutionAttribute

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Add an attribute that name matches stage.
 */
@Before(stages=LifecycleStage.HandlerResolution)
public void addHandlerResolutionAttribute() {
    context.getRequest().setAttribute("HandlerResolution", "HandlerResolutionAttribute");
    context.getRequest().getSession().setAttribute("HandlerResolution", "HandlerResolutionAttribute");
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:9,代码来源:RequestTestActionBean.java


示例19: addBindingAndValidationAttribute

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Add an attribute that name matches stage.
 */
@Before(stages=LifecycleStage.BindingAndValidation)
public void addBindingAndValidationAttribute() {
    context.getRequest().setAttribute("BindingAndValidation", "BindingAndValidationAttribute");
    context.getRequest().getSession().setAttribute("BindingAndValidation", "BindingAndValidationAttribute");
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:9,代码来源:RequestTestActionBean.java


示例20: addCustomValidationAttribute

import net.sourceforge.stripes.controller.LifecycleStage; //导入依赖的package包/类
/**
 * Add an attribute that name matches stage.
 */
@Before(stages=LifecycleStage.CustomValidation)
public void addCustomValidationAttribute() {
    context.getRequest().setAttribute("CustomValidation", "CustomValidationAttribute");
    context.getRequest().getSession().setAttribute("CustomValidation", "CustomValidationAttribute");
}
 
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:9,代码来源:RequestTestActionBean.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AjaxCallback类代码示例发布时间:2022-05-21
下一篇:
Java VideoTrack类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap