* Remove Google App Engine support and tests Fixes #8033tags/8.0.0.beta2
<scope>provided</scope> | <scope>provided</scope> | ||||
<optional>true</optional> | <optional>true</optional> | ||||
</dependency> | </dependency> | ||||
<!-- Google App Engine --> | |||||
<dependency> | |||||
<groupId>com.google.appengine</groupId> | |||||
<artifactId>appengine-api-1.0-sdk</artifactId> | |||||
<scope>provided</scope> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> |
* <li/>The application remains locked while uploading - no progressbar is | * <li/>The application remains locked while uploading - no progressbar is | ||||
* possible. | * possible. | ||||
* </ul> | * </ul> | ||||
* | |||||
* @deprecated No longer supported with Vaadin 8.0 | |||||
*/ | */ | ||||
@Deprecated | |||||
public class GAEVaadinServlet extends VaadinServlet { | public class GAEVaadinServlet extends VaadinServlet { | ||||
// memcache mutex is MUTEX_BASE + sessio id | // memcache mutex is MUTEX_BASE + sessio id | ||||
String id = AC_BASE + session.getId(); | String id = AC_BASE + session.getId(); | ||||
Date expire = new Date( | Date expire = new Date( | ||||
started + (getMaxInactiveIntervalSeconds(session) * 1000)); | |||||
started + getMaxInactiveIntervalSeconds(session) * 1000); | |||||
Expiration expires = Expiration.onDate(expire); | Expiration expires = Expiration.onDate(expire); | ||||
memcache.put(id, bytes, expires); | memcache.put(id, bytes, expires); |
import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
import com.vaadin.shared.util.SharedUtil; | import com.vaadin.shared.util.SharedUtil; | ||||
import com.vaadin.util.SerializerHelper; | |||||
import com.vaadin.v7.data.Property; | import com.vaadin.v7.data.Property; | ||||
import com.vaadin.v7.util.SerializerHelper; | |||||
/** | /** | ||||
* <p> | * <p> |
import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
import com.vaadin.util.ReflectTools; | import com.vaadin.util.ReflectTools; | ||||
import com.vaadin.util.SerializerHelper; | |||||
import com.vaadin.v7.data.Property; | import com.vaadin.v7.data.Property; | ||||
import com.vaadin.v7.util.SerializerHelper; | |||||
/** | /** | ||||
* Property descriptor that is able to create simple {@link MethodProperty} | * Property descriptor that is able to create simple {@link MethodProperty} |
* License for the specific language governing permissions and limitations under | * License for the specific language governing permissions and limitations under | ||||
* the License. | * the License. | ||||
*/ | */ | ||||
package com.vaadin.util; | |||||
package com.vaadin.v7.util; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | import java.io.ObjectInputStream; | ||||
* should not be used by application developers. Subject to change at any time. | * should not be used by application developers. Subject to change at any time. | ||||
* | * | ||||
* @since 6.0 | * @since 6.0 | ||||
* @deprecated Only used for compatibility-server | |||||
*/ | */ | ||||
@Deprecated | |||||
public class SerializerHelper { | public class SerializerHelper { | ||||
/** | /** | ||||
* List of primitive classes. Google App Engine has problems | * List of primitive classes. Google App Engine has problems | ||||
* serializing/deserializing these (#3064). | * serializing/deserializing these (#3064). | ||||
*/ | */ | ||||
private static final Class<?>[] primitiveClasses = new Class<?>[] { byte.class, | |||||
short.class, int.class, long.class, float.class, double.class, | |||||
boolean.class, char.class }; | |||||
private static final Class<?>[] primitiveClasses = new Class<?>[] { | |||||
byte.class, short.class, int.class, long.class, float.class, | |||||
double.class, boolean.class, char.class }; | |||||
/** | /** | ||||
* Resolves the class given by {@code className}. | * Resolves the class given by {@code className}. |
<scope>provided</scope> | <scope>provided</scope> | ||||
</dependency> | </dependency> | ||||
<!-- Google App Engine --> | |||||
<dependency> | |||||
<groupId>com.google.appengine</groupId> | |||||
<artifactId>appengine-api-1.0-sdk</artifactId> | |||||
<scope>provided</scope> | |||||
</dependency> | |||||
<!-- Bean Validation API --> | <!-- Bean Validation API --> | ||||
<dependency> | <dependency> | ||||
<groupId>javax.validation</groupId> | <groupId>javax.validation</groupId> |
* Gets the currently used Vaadin servlet. The current servlet is | * Gets the currently used Vaadin servlet. The current servlet is | ||||
* automatically defined when initializing the servlet and when processing | * automatically defined when initializing the servlet and when processing | ||||
* requests to the server (see {@link ThreadLocal}) and in | * requests to the server (see {@link ThreadLocal}) and in | ||||
* {@link VaadinSession#access(Runnable)} and {@link UI#access(Runnable)}. In | |||||
* other cases, (e.g. from background threads), the current servlet is not | |||||
* automatically defined. | |||||
* {@link VaadinSession#access(Runnable)} and {@link UI#access(Runnable)}. | |||||
* In other cases, (e.g. from background threads), the current servlet is | |||||
* not automatically defined. | |||||
* <p> | * <p> | ||||
* The current servlet is derived from the current service using | * The current servlet is derived from the current service using | ||||
* {@link VaadinService#getCurrent()} | * {@link VaadinService#getCurrent()} | ||||
* if the writing failed due to input/output error. | * if the writing failed due to input/output error. | ||||
* | * | ||||
* @deprecated As of 7.0. This method is retained only for backwards | * @deprecated As of 7.0. This method is retained only for backwards | ||||
* compatibility and for {@link GAEVaadinServlet}. | |||||
* compatibility and for GAEVaadinServlet. | |||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
protected void criticalNotification(VaadinServletRequest request, | protected void criticalNotification(VaadinServletRequest request, | ||||
} | } | ||||
response.setHeader("Cache-Control", cacheControl); | response.setHeader("Cache-Control", cacheControl); | ||||
response.setDateHeader("Expires", | response.setDateHeader("Expires", | ||||
System.currentTimeMillis() + (resourceCacheTime * 1000)); | |||||
System.currentTimeMillis() + resourceCacheTime * 1000); | |||||
// Find the modification timestamp | // Find the modification timestamp | ||||
long lastModifiedTime = 0; | long lastModifiedTime = 0; | ||||
throws MalformedURLException { | throws MalformedURLException { | ||||
final URL reqURL = new URL((request.isSecure() ? "https://" : "http://") | final URL reqURL = new URL((request.isSecure() ? "https://" : "http://") | ||||
+ request.getServerName() | + request.getServerName() | ||||
+ ((request.isSecure() && request.getServerPort() == 443) | |||||
|| (!request.isSecure() | |||||
&& request.getServerPort() == 80) ? "" | |||||
: ":" + request.getServerPort()) | |||||
+ (request.isSecure() && request.getServerPort() == 443 | |||||
|| !request.isSecure() && request.getServerPort() == 80 | |||||
? "" : ":" + request.getServerPort()) | |||||
+ request.getRequestURI()); | + request.getRequestURI()); | ||||
String servletPath = ""; | String servletPath = ""; | ||||
if (request | if (request |
rev="1.0.0.GA" conf="build -> default,sources" /> | rev="1.0.0.GA" conf="build -> default,sources" /> | ||||
<dependency org="org.hibernate" name="hibernate-validator" | <dependency org="org.hibernate" name="hibernate-validator" | ||||
rev="4.2.0.Final" conf="build -> default" /> | rev="4.2.0.Final" conf="build -> default" /> | ||||
<!-- Google App Engine --> | |||||
<dependency org="com.google.appengine" name="appengine-api-1.0-sdk" | |||||
rev="1.7.7" conf="build-provided -> default" /> | |||||
<!-- LIBRARY DEPENDENCIES (compile time) --> | <!-- LIBRARY DEPENDENCIES (compile time) --> | ||||
<!-- Project modules --> | <!-- Project modules --> |
<groupId>org.hibernate</groupId> | <groupId>org.hibernate</groupId> | ||||
<artifactId>hibernate-validator</artifactId> | <artifactId>hibernate-validator</artifactId> | ||||
</dependency> | </dependency> | ||||
<!-- Google App Engine --> | |||||
<dependency> | |||||
<groupId>com.google.appengine</groupId> | |||||
<artifactId>appengine-api-1.0-sdk</artifactId> | |||||
<scope>provided</scope> | |||||
</dependency> | |||||
<!-- jetty-servlets needed by ProxyTest, but not by jetty-runner --> | <!-- jetty-servlets needed by ProxyTest, but not by jetty-runner --> | ||||
<!-- Jetty before vaadin-* on the classpath to make Eclipse use the | <!-- Jetty before vaadin-* on the classpath to make Eclipse use the |
package com.vaadin.tests.appengine; | |||||
import com.google.apphosting.api.DeadlineExceededException; | |||||
import com.vaadin.server.ClassResource; | |||||
import com.vaadin.server.DownloadStream; | |||||
import com.vaadin.server.LegacyApplication; | |||||
import com.vaadin.ui.Button; | |||||
import com.vaadin.ui.Button.ClickEvent; | |||||
import com.vaadin.ui.Embedded; | |||||
import com.vaadin.ui.GridLayout; | |||||
import com.vaadin.ui.Label; | |||||
import com.vaadin.ui.LegacyWindow; | |||||
import com.vaadin.ui.Notification; | |||||
import com.vaadin.v7.data.Property; | |||||
import com.vaadin.v7.data.Property.ValueChangeEvent; | |||||
import com.vaadin.v7.ui.TextField; | |||||
public class GAESyncTest extends LegacyApplication { | |||||
/** | |||||
* | |||||
*/ | |||||
private static final long serialVersionUID = -3724319151122707926l; | |||||
@Override | |||||
public void init() { | |||||
setMainWindow(new IntrWindow(this)); | |||||
} | |||||
@Override | |||||
public void error(com.vaadin.server.ErrorEvent event) { | |||||
Throwable t = event.getThrowable(); | |||||
// Was this caused by a GAE timeout? | |||||
while (t != null) { | |||||
if (t instanceof DeadlineExceededException) { | |||||
getMainWindow().showNotification("Bugger!", "Deadline Exceeded", | |||||
Notification.TYPE_ERROR_MESSAGE); | |||||
return; | |||||
} | |||||
t = t.getCause(); | |||||
} | |||||
super.error(event); | |||||
} | |||||
private class IntrWindow extends LegacyWindow { | |||||
private int n = 0; | |||||
private static final long serialVersionUID = -6521351715072191625l; | |||||
TextField tf; | |||||
Label l; | |||||
LegacyApplication app; | |||||
GridLayout gl; | |||||
private IntrWindow(LegacyApplication app) { | |||||
this.app = app; | |||||
tf = new TextField("Echo thingie"); | |||||
tf.setImmediate(true); | |||||
tf.addListener(new Property.ValueChangeListener() { | |||||
@Override | |||||
public void valueChange(ValueChangeEvent event) { | |||||
IntrWindow.this.showNotification( | |||||
(String) event.getProperty().getValue()); | |||||
} | |||||
}); | |||||
addComponent(tf); | |||||
l = new Label("" + n); | |||||
addComponent(l); | |||||
{ | |||||
Button b = new Button("Slow", new Button.ClickListener() { | |||||
@Override | |||||
public void buttonClick(ClickEvent event) { | |||||
try { | |||||
Thread.sleep(15000); | |||||
} catch (InterruptedException e) { | |||||
// TODO Auto-generated catch block | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
}); | |||||
addComponent(b); | |||||
} | |||||
{ | |||||
Button b = new Button("Add", new Button.ClickListener() { | |||||
@Override | |||||
public void buttonClick(ClickEvent event) { | |||||
if (getUI() == getMainWindow()) { | |||||
getUI().getPage() | |||||
.showNotification(new Notification("main")); | |||||
try { | |||||
Thread.sleep((5000)); | |||||
} catch (InterruptedException e) { | |||||
// TODO Auto-generated catch block | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
addImage(); | |||||
} | |||||
}); | |||||
addComponent(b); | |||||
} | |||||
gl = new GridLayout(30, 50); | |||||
addComponent(gl); | |||||
} | |||||
private void addImage() { | |||||
ClassResource res = new ClassResource("img1.png") { | |||||
private static final long serialVersionUID = 1L; | |||||
@Override | |||||
public DownloadStream getStream() { | |||||
try { | |||||
Thread.sleep((long) (Math.random() * 5000)); | |||||
} catch (InterruptedException e) { | |||||
// TODO Auto-generated catch block | |||||
e.printStackTrace(); | |||||
} | |||||
return super.getStream(); | |||||
} | |||||
}; | |||||
res.setCacheTime(0); | |||||
Embedded emb = new Embedded("" + n, res); | |||||
emb.setWidth("30px"); | |||||
emb.setHeight("5px"); | |||||
gl.addComponent(emb); | |||||
l.setValue("" + n++); | |||||
} | |||||
} | |||||
@Override | |||||
public LegacyWindow getWindow(String name) { | |||||
LegacyWindow w = super.getWindow(name); | |||||
if (w == null) { | |||||
w = new IntrWindow(this); | |||||
addWindow(w); | |||||
} | |||||
return w; | |||||
} | |||||
} |