Hello Matti,
I think I finally found the real problem. I am getting a “Custom Layout not Found” error. I am using a customLayout and so the servlet must get a theme resource (a html file). The problem here is that the BroadcasterVaadinSocket implements the Callback interface like this:
protected Callback callBack = new Callback() {
public void criticalNotification(Request request, Response response,
String cap, String msg, String details, String outOfSyncURL)
throws IOException {
// TODO Auto-generated method stub
}
public String getRequestPathInfo(Request request) {
// TODO Auto-generated method stub
return null;
}
public InputStream getThemeResourceAsStream(String themeName,
String resource) throws IOException {
// TODO Auto-generated method stub
return null;
}
};
and when I use the AbstractCommunicationManager it calls the callback like this:
int resourceIndex = 0;
for (final Iterator<Object> i = paintTarget.getUsedResources()
.iterator(); i.hasNext();) {
final String resource = (String) i.next();
InputStream is = null;
try {
is = callback.getThemeResourceAsStream(getTheme(window),
resource);
} catch (final Exception e) {
// FIXME: Handle exception
logger.log(Level.FINER, "Failed to get theme resource stream.",
e);
}
if (is != null) {
...
} else {
// FIXME: Handle exception
logger.severe("CustomLayout not found: " + resource);
}
which will get a return value of null.
the proper implementation for the Callback interface is on the CommunicationManager:
private static class AbstractApplicationServletWrapper implements Callback {
private final AbstractApplicationServlet servlet;
public AbstractApplicationServletWrapper(
AbstractApplicationServlet servlet) {
this.servlet = servlet;
}
public void criticalNotification(Request request, Response response,
String cap, String msg, String details, String outOfSyncURL)
throws IOException {
servlet.criticalNotification(
(HttpServletRequest) request.getWrappedRequest(),
(HttpServletResponse) response.getWrappedResponse(), cap,
msg, details, outOfSyncURL);
}
public String getRequestPathInfo(Request request) {
return servlet.getRequestPathInfo((HttpServletRequest) request
.getWrappedRequest());
}
public InputStream getThemeResourceAsStream(String themeName,
String resource) throws IOException {
return servlet.getServletContext().getResourceAsStream(
"/" + AbstractApplicationServlet.THEME_DIRECTORY_PATH
+ themeName + "/" + resource);
}
}
which needs access to the AbstractApplicationServlet. Is there any way to access it inside the BroadcasterVaadinSocket? That way I could use the Callback implementation inside CommunicationManager.
Regards
Bruno