本文整理汇总了Java中org.apache.tiles.Attribute类的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attribute类属于org.apache.tiles包,在下文中一共展示了Attribute类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.apache.tiles.Attribute; //导入依赖的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);
}
}
}
示例2: execute
import org.apache.tiles.Attribute; //导入依赖的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()));
}
示例3: execute
import org.apache.tiles.Attribute; //导入依赖的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"));
}
示例4: execute
import org.apache.tiles.Attribute; //导入依赖的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);
}
}
示例5: CmmntyTilesPage
import org.apache.tiles.Attribute; //导入依赖的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;
}
示例6: execute
import org.apache.tiles.Attribute; //导入依赖的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);
}