本文整理汇总了Java中org.apache.tiles.AttributeContext类的典型用法代码示例。如果您正苦于以下问题:Java AttributeContext类的具体用法?Java AttributeContext怎么用?Java AttributeContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeContext类属于org.apache.tiles包,在下文中一共展示了AttributeContext类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
@Override
public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) {
List<Pair<String, String>> menuMap = new LinkedList<>();
Set<EntityType<?>> entityTypes = entityManager.getMetamodel().getEntities();
for (EntityType entityType : entityTypes) {
Class entityClass = entityType.getJavaType();
String entityClassName = entityClass.getSimpleName();
if (JpaEntity.class.isAssignableFrom(entityClass) && repositories.hasRepositoryFor(entityClass)) {
menuMap.add(new ImmutablePair<>(entityClassName, "/domain/" + entityClassName));
}
int i = 0;
}
attributeContext.putAttribute("menuMap", new ListAttribute(menuMap), true);
}
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:20,代码来源:MenuPreparer.java
示例2: render
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
/**
*
* @param actionUrl url should be start with "/"
* @param request HttpServletRequest
* @param response HttpServletResponse
* @throws Exception Exception
*/
public static void render(String actionUrl, HttpServletRequest request,
HttpServletResponse response) throws Exception {
TilesContainer container = TilesAccess.getContainer(
request.getSession().getServletContext());
if(log.isDebugEnabled()){
log.debug("Rendering tiles main.layout with page : "+actionUrl+"("+request.getSession().getId()+")");
}
AttributeContext attributeContext = container.startContext(request, response);
Attribute attr = new Attribute(actionUrl);
attributeContext.putAttribute("body", attr);
try {
container.render("main.layout", request, response);
container.endContext(request, response);
} catch (Exception e) {
if (log.isDebugEnabled()) { // Intentionally logged at debug level
log.debug("Error occurred while rendering." +
" We generally see this 'harmless' exception on WebLogic. Hiding it.", e);
}
}
}
开发者ID:apache,项目名称:stratos,代码行数:28,代码来源:ActionHelper.java
示例3: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
@Override
public void execute(Request tilesContext, AttributeContext attributeContext) {
DiscordUserDetails details = SecurityUtils.getCurrentUser();
if (details != null) {
attributeContext.putAttribute("userDetails", new Attribute(details));
}
attributeContext.putAttribute("discordConnected", new Attribute(discordService.isConnected()));
}
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:9,代码来源:UserInfoPreparer.java
示例4: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
/**
* 功能:.
*
* @param tilesContext
* the tiles context
* @param attributeContext
* the attribute context
*/
public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) {
String platformIdString = null;
if (platformIdString == null) {
platformIdString = "";
}
attributeContext.setTemplateAttribute(new Attribute("/WEB-INF/jsp/common/" + platformIdString + "header.jsp"));
}
开发者ID:8090boy,项目名称:gomall.la,代码行数:17,代码来源:PlatFormViewPreparer.java
示例5: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
@Override
public void execute(Request arg0, AttributeContext arg1) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (!(auth instanceof AnonymousAuthenticationToken)) {
final UserDetails userDetails = (UserDetails) auth.getPrincipal();
arg1.putAttribute("user", new Attribute("signed in as " + userDetails.getUsername()), true);
} else {
arg1.putAttribute("user", new Attribute("not signed in"), true);
}
}
开发者ID:mmeany,项目名称:spring-boot-web-app-base,代码行数:11,代码来源:ConfigurationForTiles.java
示例6: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
@Override
public void execute(Request tilesContext, AttributeContext attributeContext) {
try {
// Get authorized log access configs for current user
Authentication authorizedUser = SecurityContextHolder.getContext().getAuthentication();
Set<LogAccessConfig> allLogAccessConfigs = configService.getLogAccessConfigs();
Set<LogAccessConfig> authorizedLogAccessConfigs = authorizationService.getAuthorizedLogAccessConfigs(allLogAccessConfigs, authorizedUser);
// Create map <displayGroup> -> <logAccessConfig>
Map<String, Set<LogAccessConfig>> logAccessConfigsMap = new TreeMap<String, Set<LogAccessConfig>>();
for (LogAccessConfig logAccessConfig : authorizedLogAccessConfigs) {
String displayGroup = logAccessConfig.getDisplayGroup() != null ? logAccessConfig.getDisplayGroup() : "";
Set<LogAccessConfig> logAccessConfigIds = logAccessConfigsMap.get(displayGroup);
if (logAccessConfigIds == null) {
logAccessConfigIds = new TreeSet<LogAccessConfig>();
logAccessConfigsMap.put(displayGroup, logAccessConfigIds);
}
logAccessConfigIds.add(logAccessConfig);
}
// Inject logAccessConfigIds map into request scope
tilesContext.getContext(Request.REQUEST_SCOPE).put(LOG_ACCESS_CONFIG_IDS_BY_DISPLAY_GROUP_KEY, logAccessConfigsMap);
}
catch (ConfigException e) {
LOGGER.error("Error while loading configuration", e);
}
}
开发者ID:fbaligand,项目名称:lognavigator,代码行数:29,代码来源:TilesTemplateViewPreparer.java
示例7: CmmntyTilesPage
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
/**
* 커뮤니티 타일 페이지로 이동한다.
*
*/
@RequestMapping("/cop/cmy/CmmntyTilesPage.do")
public String CmmntyTilesPage(
HttpServletRequest request,
HttpServletResponse response,
ModelMap model)
throws Exception {
String jspPage = (String) request.getAttribute("jspPage");
String cmmntyId = (String) request.getAttribute("curTrgetId");
String menuId = (String) request.getAttribute("curMenuNo");
if (!cmmntyId.startsWith("CMMNTY_") || "".equals(menuId)) {
return jspPage;
}
CommunityVO communityVO = cmmntyService.getCommunityInfo(cmmntyId, menuId);
model.addAttribute("targetVO", communityVO);
// --------------------------------
// 커뮤니티 사용자 정보
// --------------------------------
model.addAttribute("targetUserVO", cmmntyService.getCommunityUserInfo(cmmntyId));
// --------------------------------
// 메뉴 정보
// --------------------------------
String menuAlias = getMenuInfo(communityVO, menuId, "menuAlias");
if( "".equals(menuAlias) ) {
menuAlias = communityVO.getTopMenuList().get(0).get("menuAlias").toString();
}
model.addAttribute("menuAlias", menuAlias);
// --------------------------------
// 커뮤니티 템플릿 정보
// --------------------------------
String tmplatCours = cmmntyService.selectCmmntyTemplat(communityVO);
if ("".equals(tmplatCours) || tmplatCours == null) {
tmplatCours = "/WEB-INF/layouts/apps/appsDefault";
}
TilesContainer container = ServletUtil.getCurrentContainer(request, request.getSession().getServletContext());
AttributeContext attributeContext = container.startContext(request, response);
if (tmplatCours.indexOf("/WEB-INF/layouts") != -1) {
attributeContext.setTemplateAttribute(new Attribute(tmplatCours+".jsp"));
} else {
attributeContext.setTemplateAttribute(new Attribute("/WEB-INF/jsp/"+tmplatCours+".jsp"));
}
return jspPage;
}
开发者ID:aramsoft,项目名称:aramcomp,代码行数:56,代码来源:CmyMenuHomeController.java
示例8: execute
import org.apache.tiles.AttributeContext; //导入依赖的package包/类
@Override
public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) {
Map<String, Object> requestAttributes = tilesContext.getRequestScope();
String entityListTitle = (String) requestAttributes.get("entityListTitle");
List<JpaEntity> entities = (List<JpaEntity>) requestAttributes.get("entities");
Map<String, Attribute> aditionalAttributes = new HashMap<>();
String entityClassName = (String) requestAttributes.get("entityClassName");
String columnNames = (String) requestAttributes.get("columnNames");
if (entityListTitle == null && entities != null) {
Iterator iterator = entities.iterator();
if (entityClassName != null) {
entityListTitle = entityClassName;
} else if (iterator.hasNext()) {
JpaEntity entity = (JpaEntity) iterator.next();
entityListTitle = entity.getClassDescription();
} else {
entityListTitle = "Entity";
}
entityListTitle += " list";
// aditionalAttributes.put("entityListTitle", new Attribute(entityListTitle));
attributeContext.putAttribute("entityListTitle", new Attribute(entityListTitle), true);
}
if (columnNames == null || !(columnNames instanceof String) || columnNames.isEmpty()) {
attributeContext.putAttribute("columnNames", new Attribute(DEFAULT_COLUMN_NAMES), true);
}
// attributeContext.addMissing(aditionalAttributes);
// List<Pair<String, String>> menuMap = new LinkedList<>();
// Set<EntityType<?>> entityTypes = entityManager.getMetamodel().getEntities();
//
// for (EntityType entityType : entityTypes) {
// String entityClassName = entityType.getJavaType().getSimpleName();
// menuMap.add(new ImmutablePair<>(entityClassName, "/domain/" + entityClassName));
// }
//
//
// attributeContext.putAttribute("menuMap", new ListAttribute(menuMap), true);
}
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:46,代码来源:EntityListPreparer.java
注:本文中的org.apache.tiles.AttributeContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论