@@ -32,6 +32,8 @@ public class ApplicationConfiguration { | |||
private Class<? extends Paintable>[] classes = new Class[1024]; | |||
private String windowId; | |||
private static ArrayList<ApplicationConnection> unstartedApplications = new ArrayList<ApplicationConnection>(); | |||
private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>(); | |||
@@ -239,7 +241,7 @@ public class ApplicationConfiguration { | |||
public void addComponentMappings(ValueMap valueMap, WidgetSet widgetSet) { | |||
JsArrayString keyArray = valueMap.getKeyArray(); | |||
for (int i = 0; i < keyArray.length(); i++) { | |||
String key = keyArray.get(i); | |||
String key = keyArray.get(i).intern(); | |||
int value = valueMap.getInt(key); | |||
classes[value] = widgetSet.getImplementationByClassName(key); | |||
if (classes[value] == VUnknownComponent.class) { | |||
@@ -247,10 +249,20 @@ public class ApplicationConfiguration { | |||
unknownComponents = new HashMap<String, String>(); | |||
} | |||
unknownComponents.put("" + value, key); | |||
} else if (key == "com.vaadin.ui.Window") { | |||
windowId = "" + value; | |||
} | |||
} | |||
} | |||
/** | |||
* @return the integer value that is used to code top level windows | |||
* "com.vaadin.ui.Window" | |||
*/ | |||
String getEncodedWindowTag() { | |||
return windowId; | |||
} | |||
String getUnknownServerClassNameByEncodedTagName(String tag) { | |||
if (unknownComponents != null) { | |||
return unknownComponents.get(tag); |
@@ -789,7 +789,8 @@ public class ApplicationConnection { | |||
updatedWidgets.add(idToPaintableDetail.get(uidl.getId()) | |||
.getComponent()); | |||
} else { | |||
if (!uidl.getTag().equals("0")) { | |||
if (!uidl.getTag().equals( | |||
configuration.getEncodedWindowTag())) { | |||
ClientExceptionHandler | |||
.displayError("Received update for " | |||
+ uidl.getTag() |
@@ -1841,18 +1841,16 @@ public abstract class AbstractCommunicationManager implements | |||
} | |||
} | |||
private static HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>(); | |||
private static int nextTypeKey = 0; | |||
static String getTagForType(Class<? extends Paintable> class1) { | |||
synchronized (typeToKey) { | |||
Integer object = typeToKey.get(class1); | |||
if (object == null) { | |||
object = nextTypeKey++; | |||
typeToKey.put(class1, object); | |||
} | |||
return object.toString(); | |||
private HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>(); | |||
private int nextTypeKey = 0; | |||
String getTagForType(Class<? extends Paintable> class1) { | |||
Integer object = typeToKey.get(class1); | |||
if (object == null) { | |||
object = nextTypeKey++; | |||
typeToKey.put(class1, object); | |||
} | |||
return object.toString(); | |||
} | |||
/** |
@@ -25,11 +25,11 @@ import com.vaadin.ui.Window; | |||
/** | |||
* Application manager processes changes and paints for single application | |||
* instance. | |||
* | |||
* | |||
* This class handles applications running as servlets. | |||
* | |||
* @see AbstractCommunicationManager | |||
* | |||
* | |||
* @author IT Mill Ltd. | |||
* @version | |||
* @VERSION@ | |||
@@ -40,7 +40,7 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Concrete wrapper class for {@link HttpServletRequest}. | |||
* | |||
* | |||
* @see Request | |||
*/ | |||
private static class HttpServletRequestWrapper implements Request { | |||
@@ -90,7 +90,7 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Concrete wrapper class for {@link HttpServletResponse}. | |||
* | |||
* | |||
* @see Response | |||
*/ | |||
private static class HttpServletResponseWrapper implements Response { | |||
@@ -117,7 +117,7 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Concrete wrapper class for {@link HttpSession}. | |||
* | |||
* | |||
* @see Session | |||
*/ | |||
private static class HttpSessionWrapper implements Session { | |||
@@ -194,7 +194,7 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* TODO New constructor - document me! | |||
* | |||
* | |||
* @param application | |||
*/ | |||
public CommunicationManager(Application application) { | |||
@@ -216,9 +216,9 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Handles file upload request submitted via Upload component. | |||
* | |||
* | |||
* TODO document | |||
* | |||
* | |||
* @param request | |||
* @param response | |||
* @throws IOException | |||
@@ -233,9 +233,9 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Handles UIDL request | |||
* | |||
* | |||
* TODO document | |||
* | |||
* | |||
* @param request | |||
* @param response | |||
* @throws IOException | |||
@@ -253,7 +253,7 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Gets the existing application or creates a new one. Get a window within | |||
* an application based on the requested URI. | |||
* | |||
* | |||
* @param request | |||
* the HTTP Request. | |||
* @param application | |||
@@ -278,15 +278,15 @@ public class CommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Calls the Window URI handler for a request and returns the | |||
* {@link DownloadStream} returned by the handler. | |||
* | |||
* | |||
* If the window is the main window of an application, the deprecated | |||
* {@link Application#handleURI(java.net.URL, String)} is called first to | |||
* handle {@link ApplicationResource}s and the window handler is only called | |||
* if it returns null. | |||
* | |||
* | |||
* @see AbstractCommunicationManager#handleURI(Window, Request, Response, | |||
* Callback) | |||
* | |||
* | |||
* @param window | |||
* @param request | |||
* @param response |
@@ -1041,7 +1041,7 @@ public class JsonPaintTarget implements PaintTarget { | |||
} | |||
usedPaintableTypes.add(class1); | |||
return AbstractCommunicationManager.getTagForType(class1); | |||
return manager.getTagForType(class1); | |||
} | |||
@@ -13,10 +13,10 @@ import com.vaadin.Application; | |||
/** | |||
* Web application context for Vaadin applications. | |||
* | |||
* | |||
* This is automatically added as a {@link HttpSessionBindingListener} when | |||
* added to a {@link HttpSession}. | |||
* | |||
* | |||
* @author IT Mill Ltd. | |||
* @version | |||
* @VERSION@ | |||
@@ -29,7 +29,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext { | |||
/** | |||
* Creates a new Web Application Context. | |||
* | |||
* | |||
*/ | |||
WebApplicationContext() { | |||
@@ -37,7 +37,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext { | |||
/** | |||
* Gets the application context base directory. | |||
* | |||
* | |||
* @see com.vaadin.service.ApplicationContext#getBaseDirectory() | |||
*/ | |||
public File getBaseDirectory() { | |||
@@ -51,7 +51,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext { | |||
/** | |||
* Gets the http-session application is running in. | |||
* | |||
* | |||
* @return HttpSession this application context resides in. | |||
*/ | |||
public HttpSession getHttpSession() { | |||
@@ -60,7 +60,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext { | |||
/** | |||
* Gets the application context for an HttpSession. | |||
* | |||
* | |||
* @param session | |||
* the HTTP session. | |||
* @return the application context for HttpSession. | |||
@@ -85,10 +85,10 @@ public class WebApplicationContext extends AbstractWebApplicationContext { | |||
/** | |||
* Gets communication manager for an application. | |||
* | |||
* | |||
* If this application has not been running before, a new manager is | |||
* created. | |||
* | |||
* | |||
* @param application | |||
* @return CommunicationManager | |||
*/ |