if (application.isRunning()) {
switch (requestType) {
case RENDER:
+ case ACTION:
+ // Both action requests and render requests are ok
+ // without a Root as they render the initial HTML
+ // and then do a second request
try {
root = application
.getRootForRequest(wrappedRequest);
String initialUIDL = getInitialUIDL(combinedRequest, root);
params.put("uidl", initialUIDL);
}
- response.getWriter().write(params.toString());
+
+ // NOTE! GateIn requires, for some weird reason, getOutputStream
+ // to be used instead of getWriter() (it seems to interpret
+ // application/json as a binary content type)
+ final OutputStream out = response.getOutputStream();
+ final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(out, "UTF-8")));
+
+ outWriter.write(params.toString());
+ // NOTE GateIn requires the buffers to be flushed to work
+ outWriter.flush();
+ out.flush();
} catch (RootRequiresMoreInformationException e) {
// Requiring more information at this point is not allowed
// TODO handle in a better way
import javax.portlet.PortletRequest;
import javax.portlet.ResourceRequest;
+import com.vaadin.Application;
import com.vaadin.terminal.CombinedRequest;
import com.vaadin.terminal.DeploymentConfiguration;
import com.vaadin.terminal.WrappedRequest;
}
public BrowserDetails getBrowserDetails() {
- // No browserDetails available for normal requests
- return null;
+ return new BrowserDetails() {
+ public String getUriFragment() {
+ return null;
+ }
+
+ public String getWindowName() {
+ return null;
+ }
+
+ public WebBrowser getWebBrowser() {
+ PortletApplicationContext2 context = (PortletApplicationContext2) Application
+ .getCurrentApplication().getContext();
+ return context.getBrowser();
+ }
+ };
}
public Locale getLocale() {
</tr>
<tr>
<td>mouseClickAndWait</td>
- <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div/div[5]/div/div/a</td>
+ <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td>
<td>10,10</td>
</tr>
<tr>
</tr>
<tr>
<td>mouseClickAndWait</td>
- <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div/div[5]/div/div/a</td>
+ <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td>
<td>15,8</td>
</tr>
<tr>