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


Java AuthenticatedUserThreadLocal.getUser方法代码示例

本文整理汇总了Java中com.atlassian.confluence.user.AuthenticatedUserThreadLocal.getUser方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticatedUserThreadLocal.getUser方法的具体用法?Java AuthenticatedUserThreadLocal.getUser怎么用?Java AuthenticatedUserThreadLocal.getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.atlassian.confluence.user.AuthenticatedUserThreadLocal的用法示例。


在下文中一共展示了AuthenticatedUserThreadLocal.getUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRemoteUser

import com.atlassian.confluence.user.AuthenticatedUserThreadLocal; //导入方法依赖的package包/类
public User getRemoteUser()
  {
      HttpServletRequest request = ServletActionContext.getRequest();

if (request != null)
      {
          String remoteUserName = request.getRemoteUser();
	
	if (remoteUserName != null)
	{
		return getUserAccessor().getUser(remoteUserName);
	}
}

return AuthenticatedUserThreadLocal.getUser();
  }
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:17,代码来源:ConfluenceGreenPepper.java

示例2: newFriendlyDateFormatter

import com.atlassian.confluence.user.AuthenticatedUserThreadLocal; //导入方法依赖的package包/类
protected FriendlyDateFormatter newFriendlyDateFormatter() {
	// Get current user's timezone, or default one
	User authUser = AuthenticatedUserThreadLocal.getUser();
	TimeZone timeZone;
	if (authUser == null) {
		// anonymous
		timeZone = TimeZone.getDefault();
	} else {
		ConfluenceUserPreferences prefs = userAccessor
				.getConfluenceUserPreferences(authUser);
		timeZone = prefs.getTimeZone();
	}
	// Build date formatter
	DateFormatter dateFormatter = new DateFormatter(timeZone,
			formatSettingsManager, localeManager);

	// Build "friendly" date formatter
	FriendlyDateFormatter friendlyDateFormatter = new FriendlyDateFormatter(
			new Date(), dateFormatter);
	return friendlyDateFormatter;
}
 
开发者ID:baloise,项目名称:dashboard-plus,代码行数:22,代码来源:StatusLightBasedMacro.java

示例3: newNumberFormatter

import com.atlassian.confluence.user.AuthenticatedUserThreadLocal; //导入方法依赖的package包/类
protected NumberFormat newNumberFormatter() {
	// Get current user's timezone, or default one
	User authUser = AuthenticatedUserThreadLocal.getUser();
	NumberFormat result = null;
	if (authUser != null) {
		ConfluenceUserPreferences prefs = userAccessor
				.getConfluenceUserPreferences(authUser);
		if (prefs != null && prefs.getLocale() != null) {
			result = NumberFormat.getNumberInstance(prefs.getLocale());
		}
	}
	if (result == null) {
		// anonymous
		result = NumberFormat.getNumberInstance();
	}
	return result;
}
 
开发者ID:baloise,项目名称:dashboard-plus,代码行数:18,代码来源:StatusLightBasedMacro.java

示例4: getRemoteUser

import com.atlassian.confluence.user.AuthenticatedUserThreadLocal; //导入方法依赖的package包/类
/**
 * <p>getRemoteUser.</p>
 *
 * @return a {@link com.atlassian.user.User} object.
 */
public User getRemoteUser() {
    HttpServletRequest request = ServletActionContext.getRequest();

    if (request != null) {
        String remoteUserName = request.getRemoteUser();

        if (remoteUserName != null) {
            return getUserAccessor().getUserIfAvailable(remoteUserName);
        }
    }

    return AuthenticatedUserThreadLocal.getUser();
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:19,代码来源:ConfluenceGreenPepper.java


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