summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2009-09-08 11:29:43 +0000
committerMarc Englund <marc.englund@itmill.com>2009-09-08 11:29:43 +0000
commit4b5ddcdf29e3b35ba9483dbada1502a96c552a7c (patch)
tree91ed407ae12498a353ebc7b77c97f750b5cd1641 /src
parent282c573124d328e6a0261d41c799568d3fff438c (diff)
downloadvaadin-framework-4b5ddcdf29e3b35ba9483dbada1502a96c552a7c.tar.gz
vaadin-framework-4b5ddcdf29e3b35ba9483dbada1502a96c552a7c.zip
Upload examples did not serialize; for GAE support
svn changeset:8705/svn branch:6.1
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/demo/sampler/features/upload/UploadBasicExample.java24
-rw-r--r--src/com/vaadin/demo/sampler/features/upload/UploadWithProgressMonitoringExample.java42
-rw-r--r--src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java13
3 files changed, 44 insertions, 35 deletions
diff --git a/src/com/vaadin/demo/sampler/features/upload/UploadBasicExample.java b/src/com/vaadin/demo/sampler/features/upload/UploadBasicExample.java
index 1b1623ab1a..07a85627e4 100644
--- a/src/com/vaadin/demo/sampler/features/upload/UploadBasicExample.java
+++ b/src/com/vaadin/demo/sampler/features/upload/UploadBasicExample.java
@@ -37,24 +37,22 @@ public class UploadBasicExample extends VerticalLayout {
private int counter;
/**
- * OutputStream that simply counts lineends
+ * return an OutputStream that simply counts lineends
*/
- private OutputStream stream = new OutputStream() {
- private static final int searchedByte = '\n';
-
- @Override
- public void write(int b) throws IOException {
- if (b == searchedByte) {
- counter++;
- }
- }
- };
-
public OutputStream receiveUpload(String filename, String MIMEType) {
counter = 0;
fileName = filename;
mtype = MIMEType;
- return stream;
+ return new OutputStream() {
+ private static final int searchedByte = '\n';
+
+ @Override
+ public void write(int b) throws IOException {
+ if (b == searchedByte) {
+ counter++;
+ }
+ }
+ };
}
public String getFileName() {
diff --git a/src/com/vaadin/demo/sampler/features/upload/UploadWithProgressMonitoringExample.java b/src/com/vaadin/demo/sampler/features/upload/UploadWithProgressMonitoringExample.java
index d3954cf320..2c74b7fec7 100644
--- a/src/com/vaadin/demo/sampler/features/upload/UploadWithProgressMonitoringExample.java
+++ b/src/com/vaadin/demo/sampler/features/upload/UploadWithProgressMonitoringExample.java
@@ -151,34 +151,32 @@ public class UploadWithProgressMonitoringExample extends VerticalLayout {
private boolean sleep;
/**
- * OutputStream that simply counts lineends
+ * return an OutputStream that simply counts lineends
*/
- private OutputStream stream = new OutputStream() {
- private static final int searchedByte = '\n';
-
- @Override
- public void write(int b) throws IOException {
- total++;
- if (b == searchedByte) {
- counter++;
- }
- if (sleep && total % 1000 == 0) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- };
-
public OutputStream receiveUpload(String filename, String MIMEType) {
counter = 0;
total = 0;
fileName = filename;
mtype = MIMEType;
- return stream;
+ return new OutputStream() {
+ private static final int searchedByte = '\n';
+
+ @Override
+ public void write(int b) throws IOException {
+ total++;
+ if (b == searchedByte) {
+ counter++;
+ }
+ if (sleep && total % 1000 == 0) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ };
}
public String getFileName() {
diff --git a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
index e24f405ac1..147fb63f57 100644
--- a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
@@ -3,6 +3,7 @@ package com.vaadin.terminal.gwt.server;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Date;
@@ -148,6 +149,18 @@ public class GAEApplicationServlet extends ApplicationServlet {
"Deadline Exceeded",
"I'm sorry, but the operation took too long to complete. We'll try reloading to see where we're at, please take note of any unsaved data...",
"", null);
+ } catch (NotSerializableException e) {
+ // TODO i18n?
+ // TODO this notification is not shown - solve this in some other
+ // way...
+ criticalNotification(
+ request,
+ response,
+ "NotSerializableException",
+ "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...",
+ "", getApplicationUrl(request).toString()
+ + "?restartApplication");
+ e.printStackTrace(System.err);
} finally {
// "Next, please!"
if (locked) {