當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestAttributes.getAttribute方法代碼示例

本文整理匯總了Java中org.springframework.web.context.request.RequestAttributes.getAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestAttributes.getAttribute方法的具體用法?Java RequestAttributes.getAttribute怎麽用?Java RequestAttributes.getAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.context.request.RequestAttributes的用法示例。


在下文中一共展示了RequestAttributes.getAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setDirectUrlToModel

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
private void setDirectUrlToModel(BoardVO boardVO, ModelMap model) {
	
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

	String trgetId = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
	String contextUrl = (String) requestAttributes.getAttribute("contextUrl", RequestAttributes.SCOPE_REQUEST);
	String directUrl = "";
	if( trgetId != null 
			&& trgetId != "" 
			&& trgetId.indexOf("CMMNTY_") != -1) {
		String cmmntyId = WebUtil.getPathId(trgetId);
		directUrl = contextUrl + "/content/apps/"+cmmntyId+"/board/"+boardVO.getPathId()+"/article/"+boardVO.getNttId();
	} else {
		directUrl = contextUrl + "/content/board/"+boardVO.getPathId()+"/article/"+ boardVO.getNttId();
	}
	model.addAttribute("directUrl", directUrl);
}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:18,代碼來源:BBSBoardController.java

示例2: setDirectUrlToModelAnonymous

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
private void setDirectUrlToModelAnonymous(BoardVO boardVO, ModelMap model) {
	
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

	String trgetId = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
	String contextUrl = (String) requestAttributes.getAttribute("contextUrl", RequestAttributes.SCOPE_REQUEST);
	String directUrl = "";
	if( trgetId != null 
			&& trgetId != "" 
			&& trgetId.indexOf("CMMNTY_") != -1) {
		String cmmntyId = WebUtil.getPathId(trgetId);
		directUrl = contextUrl + "/content/apps/"+cmmntyId+"/board/"+boardVO.getPathId()+"/article/"+boardVO.getNttId();
	} else {
		directUrl = contextUrl + "/content/board/anonymous/"+boardVO.getPathId()+ "/article/"+ boardVO.getNttId();
	}
	model.addAttribute("directUrl", directUrl);
}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:18,代碼來源:BBSBoardController.java

示例3: adjustViewName

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
public static String adjustViewName(String viewName) {
		
		RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

		String jspPrefix = (String) requestAttributes.getAttribute("jspPrefix", RequestAttributes.SCOPE_REQUEST);
		if (jspPrefix == null || "".equals(jspPrefix)) jspPrefix = comDefaultPath;
		
		String jspPage = jspPrefix + viewName;	
		
//		LOG.debug("jspPage = " + jspPage);

		// if tiles exist, forward tiles layout
		String aTrgetId   = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
		String aCurMenuNo = (String) requestAttributes.getAttribute("curMenuNo", RequestAttributes.SCOPE_REQUEST);
		if( aTrgetId != null
				&& aTrgetId.startsWith("CMMNTY_") 
				&& aCurMenuNo != null
				&& !"".equals(aCurMenuNo) )  {
			
			requestAttributes.setAttribute("jspPage", jspPage, RequestAttributes.SCOPE_REQUEST);
			
			return "forward:/cop/cmy/CmmntyTilesPage.do";
		}
		
		return jspPage;
	}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:27,代碼來源:WebUtil.java

示例4: getErrorAttributes

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
@Override
public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes,
		boolean includeStackTrace) {
	Map<String, Object> errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
	errorAttributes.remove("exception");
	Object message = requestAttributes.getAttribute("javax.servlet.error.message", RequestAttributes.SCOPE_REQUEST);
	if (message != null) {
		errorAttributes.put("message", message);
	}
	return errorAttributes;
}
 
開發者ID:ePages-de,項目名稱:restdocs-raml,代碼行數:12,代碼來源:ExceptionSupressingErrorAttributes.java

示例5: getWxRequestFromRequest

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
public static WxRequest getWxRequestFromRequest() {
    RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
    if (requestAttributes != null) {
        return (WxRequest) requestAttributes.getAttribute(WX_REQUEST_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
    }
    return null;
}
 
開發者ID:FastBootWeixin,項目名稱:FastBootWeixin,代碼行數:8,代碼來源:WxWebUtils.java

示例6: getWxWebUserFromSession

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
public static WxWebUser getWxWebUserFromSession() {
    RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
    if (requestAttributes != null) {
        return (WxWebUser) requestAttributes.getAttribute(WX_SESSION_USER, RequestAttributes.SCOPE_SESSION);
    }
    return null;
}
 
開發者ID:FastBootWeixin,項目名稱:FastBootWeixin,代碼行數:8,代碼來源:WxWebUtils.java

示例7: assertAttributeExists

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
private void assertAttributeExists() {
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	assertNotNull("request attributes should exist", requestAttributes);
	Object setUpOutsideOfStel = requestAttributes.getAttribute(SET_UP_OUTSIDE_OF_STEL,
		RequestAttributes.SCOPE_REQUEST);
	assertNotNull(SET_UP_OUTSIDE_OF_STEL + " should exist as a request attribute", setUpOutsideOfStel);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:8,代碼來源:ServletTestExecutionListenerTests.java

示例8: assertAttributeDoesNotExist

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
private void assertAttributeDoesNotExist() {
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	assertNotNull("request attributes should exist", requestAttributes);
	Object setUpOutsideOfStel = requestAttributes.getAttribute(SET_UP_OUTSIDE_OF_STEL,
		RequestAttributes.SCOPE_REQUEST);
	assertNull(SET_UP_OUTSIDE_OF_STEL + " should NOT exist as a request attribute", setUpOutsideOfStel);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:8,代碼來源:ServletTestExecutionListenerTests.java

示例9: execute

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
	RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
	if (requestAttributes != null) {
		Long executeTime = (Long) requestAttributes.getAttribute(ExecuteTimeInterceptor.EXECUTE_TIME_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
		if (executeTime != null) {
			setLocalVariable(VARIABLE_NAME, executeTime, env, body);
		}
	}
}
 
開發者ID:justinbaby,項目名稱:my-paper,代碼行數:11,代碼來源:ExecuteTimeDirective.java

示例10: execute

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
	RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
	if (requestAttributes != null) {
		Message message = (Message) requestAttributes.getAttribute(FLASH_MESSAGE_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
		if (body != null) {
			setLocalVariable(VARIABLE_NAME, message, env, body);
		} else {
			if (message != null) {
				Writer out = env.getOut();
				out.write("$.message(\"" + message.getType() + "\", \"" + message.getContent() + "\");");
			}
		}
	}
}
 
開發者ID:justinbaby,項目名稱:my-paper,代碼行數:16,代碼來源:FlashMessageDirective.java

示例11: checkCommunityUser

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
/**
 * 커뮤니티  및 동호회 사용자 권한을 확인한다.
 * 
 */
public String checkCommunityUser(String defaultYN) {

	LoginVO loginVO = (LoginVO) UserDetailsHelper.getAuthenticatedUser();
	if (loginVO == null) {
		return "N";
	}

	if( UserDetailsHelper.getAuthorities().contains("ROLE_ADMIN") ) {
		return "Y";
	}
	
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	String trgetId = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
	
	if (trgetId.startsWith("CMMNTY_")) {
		CommunityUserVO communityUserVO = new CommunityUserVO();

		communityUserVO.setCmmntyId(trgetId);
		communityUserVO.setEmplyrId(loginVO.getUniqId());

		if (cmmntyService.checkCommunityUserInf(communityUserVO).equals("EXIST")) {
			return "Y";
		} else {
			return "N";
		}
	}
	return defaultYN;
}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:33,代碼來源:UserInfService.java

示例12: checkCommunityManager

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
/**
 * 커뮤니티 관리자 및 동호회 운영자 권한을 확인한다.
 * 
 */
public String checkCommunityManager() {

	LoginVO loginVO = (LoginVO) UserDetailsHelper.getAuthenticatedUser();
	if (loginVO == null) {
		return "N";
	}

	if( UserDetailsHelper.getAuthorities().contains("ROLE_ADMIN") ) {
		return "Y";
	}
	
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	String trgetId = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
	
	if (trgetId.startsWith("CMMNTY_")) {
		CommunityUserVO communityUserVO = new CommunityUserVO();

		communityUserVO.setCmmntyId(trgetId);
		communityUserVO.setEmplyrId(loginVO.getUniqId());

		if (cmmntyService.isManager(communityUserVO)) {
			return "Y";
		}
	} 			

	return "N";
}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:32,代碼來源:UserInfService.java

示例13: getAttribute

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
@Override
public Object getAttribute(RequestAttributes request, String name) {
    return request.getAttribute(name, RequestAttributes.SCOPE_SESSION);
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:5,代碼來源:HttpSessionSessionStrategy.java

示例14: getAttribute

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private static <T> T getAttribute(final RequestAttributes requestAttributes, final String name)
{
	return (T)requestAttributes.getAttribute(name, RequestAttributes.SCOPE_REQUEST);
}
 
開發者ID:metasfresh,項目名稱:metasfresh-webui-api,代碼行數:6,代碼來源:WebuiExceptionHandler.java

示例15: mappingColumn

import org.springframework.web.context.request.RequestAttributes; //導入方法依賴的package包/類
/**
	 * 동문 엑셀파일 맵핑
	 */
	@Override
	public Object mappingColumn(Row row) {
		Cell cell0 = row.getCell((int) 0);		// MENU_NO(매뉴번호)
		Cell cell1 = row.getCell((int) 1);		// MENU_NM(메뉴명)
		Cell cell2 = row.getCell((int) 2);		// PROGRM_FILE_NM(프로그램명)
		Cell cell3 = row.getCell((int) 3);		// MENU_DC(메뉴설명)
		Cell cell4 = row.getCell((int) 4);		// USE_AT(사용여부)
		Cell cell5 = row.getCell((int) 5);		// MGR_AT(관리자메뉴여부)
		Cell cell6 = row.getCell((int) 6);		// DIRECT_URL(바로가기url)
		Cell cell7 = row.getCell((int) 7);		// TOPMENU_AT(톱메뉴여부)
		Cell cell8 = row.getCell((int) 8);		// MENU_ALIAS(메뉴별명)
		String value = "";
		
		RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
		String trgetId = (String) requestAttributes.getAttribute("curTrgetId", RequestAttributes.SCOPE_REQUEST);
		CommunityMenuVO vo = new CommunityMenuVO();
		vo.setTrgetId(trgetId);

//		log.debug("name = " + cell1.getRichStringCellValue().toString().trim());
		if( cell0.getCellType() == Cell.CELL_TYPE_NUMERIC  ) {				// 매뉴번호
			vo.setMenuNo((int)cell0.getNumericCellValue());	
		} else {
			vo.setMenuNo(Integer.parseInt(cell0.getRichStringCellValue().toString().trim()));
		}

		if (cell1 != null) {	// 메뉴명
			value = cell1.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setMenuNm(value);
			}	
		}
		if (cell2 != null) {	// 프로그램명
			value = cell2.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setProgrmFileNm(value);
			}	
		}
		if (cell3 != null) {	// 메뉴설명
			value = cell3.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setMenuDc(value);
			}	
		}
		if (cell4 != null) {	// 사용여부
			value = cell4.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setUseAt(value);
			}	
		}
		if (cell5 != null) {	// 관리자메뉴여부
			value = cell5.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setMgrAt(value);
			}	
		}
		if (cell6 != null) {	// 바로가기url
			value = cell6.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setDirectUrl(value);
			}	
		}
		if (cell7 != null) {	// 톱메뉴여부
			value = cell7.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setTopMenuAt(value);
			}	
		}
		if (cell8 != null) {	// 메뉴별명
			value = cell8.getRichStringCellValue().toString().trim();
			if( value.length() != 0 ) {
				vo.setMenuAlias(value);
			}	
		}

		return vo;
	}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:80,代碼來源:ExcelCmyMenuMapping.java


注:本文中的org.springframework.web.context.request.RequestAttributes.getAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。