本文整理汇总了Java中org.apache.wicket.core.request.ClientInfo类的典型用法代码示例。如果您正苦于以下问题:Java ClientInfo类的具体用法?Java ClientInfo怎么用?Java ClientInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientInfo类属于org.apache.wicket.core.request包,在下文中一共展示了ClientInfo类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMail
import org.apache.wicket.core.request.ClientInfo; //导入依赖的package包/类
protected void sendMail(final String subject, final Throwable exception, final List<File> attachments) {
final ClientInfo clientInfo = AWebSession.get().getClientInfo();
final ABaseWebApplication application = ABaseWebApplication.get();
new Thread() {
@Override
public void run() {
super.run();
String body = "date=" + new FDate() + "\n";
body += "productionEnvironment=" + application.usesDeploymentConfig() + "\n";
if (clientInfo instanceof WebClientInfo) {
final WebClientInfo webClientInfo = (WebClientInfo) clientInfo;
body += "userAgent=" + webClientInfo.getUserAgent();
body += webClientInfo.getProperties().toString();
} else {
body += "no client info!";
}
body += "\n\n";
body += Request.this.toStringMultiline();
if (exception != null) {
body += "\n\n";
body += Throwables.getFullStackTrace(exception);
}
MailSender.sendFeedbackReportMail(subject, body, attachments);
}
}.start();
}
示例2: MySession
import org.apache.wicket.core.request.ClientInfo; //导入依赖的package包/类
public MySession(final Request request)
{
super(request);
setLocale(request);
final ClientInfo info = getClientInfo();
if (info instanceof WebClientInfo) {
clientProperties = ((WebClientInfo) clientInfo).getProperties();
clientProperties.setTimeZone(PFUserContext.getTimeZone());
userAgent = ((WebClientInfo) info).getUserAgent();
userAgentDevice = UserAgentDevice.getUserAgentDevice(userAgent);
userAgentOS = UserAgentOS.getUserAgentOS(userAgent);
mobileUserAgent = userAgentDevice.isMobile();
final UserAgentDetection userAgentDetection = UserAgentDetection.browserDetect(userAgent);
userAgentBrowser = userAgentDetection.getUserAgentBrowser();
userAgentBrowserVersionString = userAgentDetection.getUserAgentBrowserVersion();
} else {
log.error("Oups, ClientInfo is not from type WebClientInfo: " + info);
}
setUser(PFUserContext.getUser());
this.csrfToken = NumberHelper.getSecureRandomUrlSaveString(20);
}
示例3: setUser
import org.apache.wicket.core.request.ClientInfo; //导入依赖的package包/类
private void setUser(User u, Set<Right> rights) {
Long _recordingId = recordingId;
Long _roomId = roomId;
Invitation _i = i;
SOAPLogin _soap = soap;
ClientInfo _info = clientInfo;
ExtendedClientProperties _extProps = extProps;
replaceSession(); // required to prevent session fixation
if (_recordingId != null) {
recordingId = _recordingId;
}
if (_roomId != null) {
roomId = _roomId;
}
if (_i != null) {
i = _i;
}
if (_soap != null) {
soap = _soap;
}
if (_info != null) {
clientInfo = _info;
}
if (_extProps != null) {
extProps = _extProps;
}
userId = u.getId();
if (rights == null || rights.isEmpty()) {
Set<Right> r = new HashSet<>(u.getRights());
if (u.getGroupUsers() != null && !AuthLevelUtil.hasAdminLevel(r)) {
for (GroupUser gu : u.getGroupUsers()) {
if (gu.isModerator()) {
r.add(Right.GroupAdmin);
break;
}
}
}
this.rights = Collections.unmodifiableSet(r);
} else {
this.rights = Collections.unmodifiableSet(rights);
}
languageId = u.getLanguageId();
externalType = u.getExternalType();
tz = getTimeZone(u);
ISO8601FORMAT = FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
setLocale(LocaleHelper.getLocale(u));
sdf = FormatHelper.getDateTimeFormat(u);
}