/** * Get the singleton {@link ServerGwtBridge} instance, creating it if * necessary. The instance will be registered via * {@link GWT#setBridge(GWTBridge)} and will have the default instantiators * registered on it. * * @return the singleton {@link ServerGwtBridge} instance */ public static ServerGwtBridge getInstance() { synchronized (instanceLock) { if (instance == null) { instance = new ServerGwtBridge(); GWT.setBridge(instance); } return instance; } }
/** * Sets all GWT properties from the request. * <p> * If this method is overridden, this version should be called first and then * any modifications to property values should be done. * * @param req */ protected void setGwtProperties(HttpServletRequest req) { ServerGwtBridge.getInstance().setThreadProperty("locale", getGwtLocale(req)); // TODO(jat): other properties, such as user.agent? } }
@Override public <T> T create(Class<?> clazz, Properties properties) { String pkgName = clazz.getPackage().getName(); Class<?> enclosingClass = clazz.getEnclosingClass(); String className = clazz.getSimpleName(); GwtLocale locale = ServerGwtBridge.getLocale(properties); for (GwtLocale search : locale.getCompleteSearchList()) { String suffix = "_" + search.getAsString(); T obj = this.<T>tryCreate(pkgName + "." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + ".impl." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + "." + className + "Impl" + suffix); if (obj != null) { return obj; } if (enclosingClass != null) { obj = this.<T>tryCreate(enclosingClass.getCanonicalName() + "$" + className + suffix); if (obj != null) { return obj; } } } return null; } }
/** * Sets all GWT properties from the request. * <p> * If this method is overridden, this version should be called first and then * any modifications to property values should be done. * * @param req */ protected void setGwtProperties(HttpServletRequest req) { ServerGwtBridge.getInstance().setThreadProperty("locale", getGwtLocale(req)); // TODO(jat): other properties, such as user.agent? } }
/** * Get the singleton {@link ServerGwtBridge} instance, creating it if * necessary. The instance will be registered via * {@link GWT#setBridge(GWTBridge)} and will have the default instantiators * registered on it. * * @return the singleton {@link ServerGwtBridge} instance */ public static ServerGwtBridge getInstance() { synchronized (instanceLock) { if (instance == null) { instance = new ServerGwtBridge(); GWT.setBridge(instance); } return instance; } }
@Override public <T> T create(Class<?> clazz, Properties properties) { String pkgName = clazz.getPackage().getName(); Class<?> enclosingClass = clazz.getEnclosingClass(); String className = clazz.getSimpleName(); GwtLocale locale = ServerGwtBridge.getLocale(properties); for (GwtLocale search : locale.getCompleteSearchList()) { String suffix = "_" + search.getAsString(); T obj = this.<T>tryCreate(pkgName + "." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + ".impl." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + "." + className + "Impl" + suffix); if (obj != null) { return obj; } if (enclosingClass != null) { obj = this.<T>tryCreate(enclosingClass.getCanonicalName() + "$" + className + suffix); if (obj != null) { return obj; } } } return null; } }
/** * Sets all GWT properties from the request. * <p> * If this method is overridden, this version should be called first and then * any modifications to property values should be done. * * @param req */ protected void setGwtProperties(HttpServletRequest req) { ServerGwtBridge.getInstance().setThreadProperty("locale", getGwtLocale(req)); // TODO(jat): other properties, such as user.agent? } }
/** * Get the singleton {@link ServerGwtBridge} instance, creating it if * necessary. The instance will be registered via * {@link GWT#setBridge(GWTBridge)} and will have the default instantiators * registered on it. * * @return the singleton {@link ServerGwtBridge} instance */ public static ServerGwtBridge getInstance() { synchronized (instanceLock) { if (instance == null) { instance = new ServerGwtBridge(); GWT.setBridge(instance); } return instance; } }
@Override public <T> T create(Class<?> clazz, Properties properties) { String pkgName = clazz.getPackage().getName(); Class<?> enclosingClass = clazz.getEnclosingClass(); String className = clazz.getSimpleName(); GwtLocale locale = ServerGwtBridge.getLocale(properties); for (GwtLocale search : locale.getCompleteSearchList()) { String suffix = "_" + search.getAsString(); T obj = this.<T>tryCreate(pkgName + "." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + ".impl." + className + suffix); if (obj != null) { return obj; } obj = this.<T>tryCreate(pkgName + "." + className + "Impl" + suffix); if (obj != null) { return obj; } if (enclosingClass != null) { obj = this.<T>tryCreate(enclosingClass.getCanonicalName() + "$" + className + suffix); if (obj != null) { return obj; } } } return null; } }