List of usage examples for org.apache.wicket Session getClientInfo
public abstract ClientInfo getClientInfo();
From source file:com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor.java
License:Open Source License
public static boolean isStyleSheetLimitForIE(Session session) { if (session != null) { return ((WebClientInfo) session.getClientInfo()).getProperties().isBrowserInternetExplorer() && ((WebClientInfo) session.getClientInfo()).getProperties().getBrowserVersionMajor() < 10; }//from w w w .j av a 2 s .c o m return false; }
From source file:com.servoy.j2db.server.headlessclient.WebClient.java
License:Open Source License
@SuppressWarnings("nls") @Override/*from w w w . j a v a 2 s.co m*/ public URL getServerURL() { if (Session.exists()) { Session webClientSession = Session.get(); if (webClientSession != null) { WebClientInfo clientInfo = (WebClientInfo) webClientSession.getClientInfo(); if (clientInfo != null && clientInfo.getProperties() != null && clientInfo.getProperties().getHostname() != null) { String hostname = clientInfo.getProperties().getHostname(); try { if (hostname.startsWith("http")) { // first try to find the wicket servlet int index = hostname.indexOf("/servoy-webclient", 8); //8 is to skip http:// or https:// // if that fails then just try to find the first / if (index == -1) index = hostname.indexOf('/', 8); //8 is to skip http:// or https:// if (index == -1) { return new URL(hostname); } else { return new URL(hostname.substring(0, index)); } } else { return new URL("http", hostname, ""); } } catch (MalformedURLException e) { Debug.error(e); } } } } return super.getServerURL(); }
From source file:com.servoy.j2db.server.headlessclient.WebClient.java
License:Open Source License
@Override @SuppressWarnings("nls") public String getClientOSName() { if (Session.exists()) { Session webClientSession = Session.get(); if (webClientSession != null) { WebClientInfo clientInfo = (WebClientInfo) webClientSession.getClientInfo(); if (clientInfo != null && clientInfo.getProperties() != null) { String userAgent = clientInfo.getUserAgent(); if (userAgent != null) { if (userAgent.indexOf("NT 6.1") != -1) return "Windows 7"; if (userAgent.indexOf("NT 6.0") != -1) return "Windows Vista"; if (userAgent.indexOf("NT 5.1") != -1 || userAgent.indexOf("Windows XP") != -1) return "Windows XP"; if (userAgent.indexOf("Linux") != -1) return "Linux"; if (userAgent.indexOf("Mac") != -1) return "Mac OS"; }//from w w w . j ava2 s. co m return clientInfo.getProperties().getNavigatorPlatform(); } } } return System.getProperty("os.name"); }
From source file:com.servoy.j2db.server.headlessclient.WebClient.java
License:Open Source License
@Override public int getClientPlatform() { if (Session.exists()) { Session webClientSession = Session.get(); if (webClientSession != null) { try { WebClientInfo clientInfo = (WebClientInfo) webClientSession.getClientInfo(); if (clientInfo != null) { ClientProperties properties = clientInfo.getProperties(); if (properties != null) { return Utils.getPlatform(properties.getNavigatorPlatform()); }// www.j a va2 s. c om } } catch (Exception e) { Debug.trace( "trying to get the client platform of a session, when destroying the client in a none request thread", e); } } } return super.getClientPlatform(); }
From source file:com.userweave.presentation.utils.WebClientHelper.java
License:Open Source License
public String getRemoteAddress() { Session session = Session.get(); if (session.getClientInfo() instanceof WebClientInfo) { return ((WebClientInfo) session.getClientInfo()).getProperties().getRemoteAddress(); } else {/*w w w .j a va 2s. c o m*/ return null; //return ((WebRequest) this.getPage().getRequest()).getHttpServletRequest().getRemoteAddr(); } }