本文整理汇总了Java中org.kuali.rice.krad.util.KRADUtils.getUserSessionFromRequest方法的典型用法代码示例。如果您正苦于以下问题:Java KRADUtils.getUserSessionFromRequest方法的具体用法?Java KRADUtils.getUserSessionFromRequest怎么用?Java KRADUtils.getUserSessionFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.util.KRADUtils
的用法示例。
在下文中一共展示了KRADUtils.getUserSessionFromRequest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: backdoorLogout
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* Method to logout the backdoor user and return to the view.
*
* @return the view to return to
*/
@RequestMapping(params = "methodToCall=backdoorLogout")
public ModelAndView backdoorLogout(@ModelAttribute("KualiForm") DummyLoginForm uifForm, BindingResult result,
HttpServletRequest request, HttpServletResponse response) {
String returnUrl = decode(uifForm.getReturnLocation());
if (StringUtils.isBlank(returnUrl)) {
returnUrl = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.APPLICATION_URL_KEY);
}
UserSession userSession = KRADUtils.getUserSessionFromRequest(request);
if (userSession.isBackdoorInUse()) {
userSession.clearBackdoorUser();
}
return performRedirect(uifForm, returnUrl, new Properties());
}
示例2: preHandle
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* Before the controller executes the user session is set on GlobalVariables
* and messages are cleared, in addition setup for the history manager and a check on missing session
* forms is performed.
*
* {@inheritDoc}
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception {
checkHandlerMethodAccess(request, handler);
final ParameterService parameterService = CoreFrameworkServiceLocator.getParameterService();
if (parameterService.getParameterValueAsBoolean(KRADConstants.KUALI_RICE_SYSTEM_NAMESPACE, ParameterConstants.ALL_COMPONENT, CsrfValidator.CSRF_PROTECTION_ENABLED_PARAM) && !CsrfValidator.validateCsrf(request, response)) {
return false;
}
final UserSession session = KRADUtils.getUserSessionFromRequest(request);
GlobalVariables.setUserSession(session);
GlobalVariables.clear();
createUifFormManagerIfNecessary(request);
// add the HistoryManager for storing HistoryFlows to the session
if (request.getSession().getAttribute(UifConstants.HistoryFlow.HISTORY_MANAGER) == null) {
request.getSession().setAttribute(UifConstants.HistoryFlow.HISTORY_MANAGER, new HistoryManager());
}
ProcessLogger.trace("pre-handle");
return true;
}
示例3: processPreprocess
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* This overridden method ...
*
* @see org.apache.struts.action.RequestProcessor#processPreprocess(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
protected boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response) {
final UserSession session = KRADUtils.getUserSessionFromRequest(request);
if (session == null) {
throw new IllegalStateException("the user session has not been established");
}
GlobalVariables.setUserSession(session);
GlobalVariables.clear();
return super.processPreprocess(request, response);
}
示例4: doFilter
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
final UserSession session = KRADUtils.getUserSessionFromRequest(request);
if (session == null) {
throw new IllegalStateException("A user session has not been established");
}
final String principalId = session.getPrincipalId();
if (session.retrieveObject(KewApiConstants.PREFERENCES) == null) {
final Preferences preferences = retrievePreferences(principalId);
session.addObject(KewApiConstants.PREFERENCES, preferences);
}
chain.doFilter(request, response);
}
示例5: service
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String documentId = null;
try {
UserSession userSession = KRADUtils.getUserSessionFromRequest(request);
if (userSession == null) {
throw new AuthenticationException("Failed to locate a user session for request.");
}
GlobalVariables.setUserSession(userSession);
RequestParser requestParser = new RequestParser(request);
String inputCommand = requestParser.getParameterValue("command");
if (StringUtils.equals(inputCommand, "initiate")){
requestParser.setParameterValue("userAction","initiate");
}
String edlName = requestParser.getParameterValue("edlName");
if (edlName == null) {
edlName = requestParser.getParameterValue("docTypeName");//this is for 'WorkflowQuicklinks'
}
EDLController edlController = null;
if (edlName == null) {
documentId = requestParser.getParameterValue("docId");
if (documentId == null) {
String docFormKey = requestParser.getParameterValue(KRADConstants.DOC_FORM_KEY);
if (docFormKey != null) {
Document document = (Document) GlobalVariables.getUserSession().retrieveObject(docFormKey);
Element documentState = EDLXmlUtils.getDocumentStateElement(document);
documentId = EDLXmlUtils.getChildElementTextValue(documentState, "docId");
requestParser.setAttribute(KRADConstants.DOC_FORM_KEY, docFormKey);
}
if (documentId == null) {
throw new WorkflowRuntimeException("No edl name or document id detected");
}
}
requestParser.setAttribute("docId", documentId);
edlController = EdlServiceLocator.getEDocLiteService().getEDLControllerUsingDocumentId(documentId);
} else {
edlController = EdlServiceLocator.getEDocLiteService().getEDLControllerUsingEdlName(edlName);
}
//TODO Fix this in a better way (reworking the command structure maybe?)
//fix for KULRICE-4057 to make sure we don't destory docContent on empty command params
if(inputCommand == null && requestParser.getParameterValue("docId") != null && !"POST".equals(request.getMethod())){
//make sure these are the only params on the request (paging passed undefined input command as well...
if(!(request.getParameterMap().size() > 2)){//ensures ONLY documentId was passed
requestParser.setParameterValue("command", "displayDocSearchView");
LOG.info("command parameter was not passed with the request, and only document ID was. Defaulted command to 'displayDocSearchView' to ensure docContent remains.");
}
}
EDLControllerChain controllerChain = new EDLControllerChain();
controllerChain.addEdlController(edlController);
//TODO Do we not want to set the content type for the response?
controllerChain.renderEDL(requestParser, response);
} catch (Exception e) {
LOG.error("Error processing EDL", e);
outputError(request, response, e, documentId);
} finally {
GlobalVariables.setUserSession(null);
}
}