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


Java ActionBeanContext.setResponse方法代码示例

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


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

示例1: completeRequest

import net.sourceforge.stripes.action.ActionBeanContext; //导入方法依赖的package包/类
/**
 * <p>Used by the StripesFilter to notify the flash scope that the request for which
 * it is used has been completed. The FlashScope uses this notification to start a
 * timer, and also to null out it's reference to the request so that it can be
 * garbage collected.</p>
 *
 * <p>The timer is used to determine if a flash scope has been orphaned (i.e. the subsequent
 * request was not made) after a period of time, so that it can be removed from session.</p>
 */
public void completeRequest() {
    // Clean up any old-age flash scopes
    Map<Integer, FlashScope> scopes = getContainer(request, false);
    if (scopes != null && !scopes.isEmpty()) {
        Iterator<FlashScope> iterator = scopes.values().iterator();
        while (iterator.hasNext()) {
            if (iterator.next().isExpired()) {
                iterator.remove();
            }
        }
    }

    // Replace the request and response objects for the request cycle that is ending
    // with objects that are safe to use on the ensuing request.
    HttpServletRequest flashRequest = FlashRequest.replaceRequest(request);
    HttpServletResponse flashResponse = (HttpServletResponse) Proxy.newProxyInstance(
            getClass().getClassLoader(),
            new Class<?>[] { HttpServletResponse.class },
            new FlashResponseInvocationHandler());
    for (Object o : this.values()) {
        if (o instanceof ActionBean) {
            ActionBeanContext context = ((ActionBean) o).getContext();
            if (context != null) {
                context.setRequest(flashRequest);
                context.setResponse(flashResponse);
            }
        }
    }

    // start timer, clear request
    this.startTime = System.currentTimeMillis();
    this.request = null;
    this.semaphore.release();
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:44,代码来源:FlashScope.java

示例2: getContextInstance

import net.sourceforge.stripes.action.ActionBeanContext; //导入方法依赖的package包/类
/**
 * Returns a new instance of the configured class, or ActionBeanContext if a class is
 * not specified.
 */
public ActionBeanContext getContextInstance(HttpServletRequest request,
                                            HttpServletResponse response) throws ServletException {
    try {
        ActionBeanContext context = getConfiguration().getObjectFactory().newInstance(
                this.contextClass);
        context.setRequest(request);
        context.setResponse(response);
        return context;
    }
    catch (Exception e) {
        throw new StripesServletException("Could not instantiate configured " +
        "ActionBeanContext class: " + this.contextClass, e);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:19,代码来源:DefaultActionBeanContextFactory.java


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