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


Java KRADUtils.getUserSessionFromRequest方法代码示例

本文整理汇总了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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:DummyLoginController.java

示例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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:UifControllerHandlerInterceptor.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:KSBStrutsRequestProcessor.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:UserPreferencesFilter.java

示例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);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:64,代码来源:EDLServlet.java


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