@Override
public int doEndTag() throws JspException {
String serverURL = Configuration.get(ConfigurationKeys.SERVER_URL);
serverURL = serverURL == null ? null : serverURL.trim();
try {
if (userId != null && userId.length() > 0) {
String code = null;
HashMap<String, String> cache = getPortraitCache();
code = cache.get(userId);
if (code == null) {
Integer userIdInt = Integer.decode(userId);
User user = (User) getUserManagementService().findById(User.class, userIdInt);
boolean isHover = (hover != null ? Boolean.valueOf(hover) : false);
if ( isHover ) {
code = buildHoverUrl(user);
} else {
code = buildDivUrl(user);
}
cache.put(userId, code);
}
JspWriter writer = pageContext.getOut();
writer.print(code);
}
} catch (NumberFormatException nfe) {
PortraitTag.log.error("PortraitId unable to write out portrait details as userId is invalid. " + userId,
nfe);
} catch (IOException ioe) {
PortraitTag.log.error(
"PortraitId unable to write out portrait details due to IOException. UserId is " + userId, ioe);
} catch (Exception e) {
PortraitTag.log.error(
"PortraitId unable to write out portrait details due to an exception. UserId is " + userId, e);
}
return Tag.SKIP_BODY;
}
PortraitTag.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:lams
作者:
评论列表
文章目录