本文整理汇总了Java中net.sourceforge.stripes.action.ActionBeanContext.setRequest方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBeanContext.setRequest方法的具体用法?Java ActionBeanContext.setRequest怎么用?Java ActionBeanContext.setRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.stripes.action.ActionBeanContext
的用法示例。
在下文中一共展示了ActionBeanContext.setRequest方法的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();
}
示例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);
}
}