📄 initialflowsetupaction.java
字号:
/* * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */package org.jasig.cas.web.flow;import java.util.List;import javax.servlet.http.HttpServletRequest;import org.jasig.cas.authentication.principal.Service;import org.jasig.cas.util.annotation.NotEmpty;import org.jasig.cas.util.annotation.NotNull;import org.jasig.cas.web.support.ArgumentExtractor;import org.jasig.cas.web.support.CookieRetrievingCookieGenerator;import org.jasig.cas.web.support.WebUtils;import org.springframework.webflow.action.AbstractAction;import org.springframework.webflow.execution.Event;import org.springframework.webflow.execution.RequestContext;/** * Class to automatically set the paths for the CookieGenerators. * <p> * Note: This is technically not threadsafe, but because its overriding with a * constant value it doesn't matter. * <p> * Note: As of CAS 3.1, this is a required class that retrieves and exposes the * values in the two cookies for subclasses to use. * * @author Scott Battaglia * @version $Revision: 42067 $ $Date: 2007-06-12 15:55:40 -0400 (Tue, 12 Jun 2007) $ * @since 3.1 */public final class InitialFlowSetupAction extends AbstractAction { /** CookieGenerator for the Warnings. */ @NotNull private CookieRetrievingCookieGenerator warnCookieGenerator; /** CookieGenerator for the TicketGrantingTickets. */ @NotNull private CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator; /** Extractors for finding the service. */ @NotEmpty private List<ArgumentExtractor> argumentExtractors; /** Boolean to note whether we've set the values on the generators or not. */ private boolean pathPopulated = false; protected Event doExecute(final RequestContext context) throws Exception { final HttpServletRequest request = WebUtils.getHttpServletRequest(context); if (!this.pathPopulated) { logger.info("Setting ContextPath for cookies to: " + context.getExternalContext().getContextPath()); this.warnCookieGenerator.setCookiePath(context.getExternalContext() .getContextPath()); this.ticketGrantingTicketCookieGenerator.setCookiePath(context .getExternalContext().getContextPath()); this.pathPopulated = true; } context.getFlowScope().put( "ticketGrantingTicketId", this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request)); context.getFlowScope().put( "warnCookieValue", Boolean.valueOf(this.warnCookieGenerator.retrieveCookieValue(request))); final Service service = WebUtils.getService(this.argumentExtractors, context); if (service != null && logger.isDebugEnabled()) { logger.debug("Placing service in FlowScope: " + service.getId()); } context.getFlowScope().put("service", service); return result("success"); } public void setTicketGrantingTicketCookieGenerator( final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) { this.ticketGrantingTicketCookieGenerator = ticketGrantingTicketCookieGenerator; } public void setWarnCookieGenerator(final CookieRetrievingCookieGenerator warnCookieGenerator) { this.warnCookieGenerator = warnCookieGenerator; } public void setArgumentExtractors( final List<ArgumentExtractor> argumentExtractors) { this.argumentExtractors = argumentExtractors; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -