From: Marc Englund Date: Thu, 10 Apr 2008 13:25:30 +0000 (+0000) Subject: Added initial html-fragment support (for portlets). X-Git-Tag: 6.7.0.beta1~4909 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3e016ebfff728a55e91ddd26c34ad19621afb950;p=vaadin-framework.git Added initial html-fragment support (for portlets). svn changeset:4156/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java index ad206cf326..b87c12ef7a 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java @@ -101,7 +101,7 @@ public class ApplicationServlet extends HttpServlet { private static final String RESOURCE_URI = "/RES/"; - private static final String AJAX_UIDL_URI = "/UIDL/"; + private static final String AJAX_UIDL_URI = "/UIDL"; static final String THEME_DIRECTORY_PATH = "ITMILL/themes/"; @@ -112,7 +112,7 @@ public class ApplicationServlet extends HttpServlet { // Name of the default widget set, used if not specified in web.xml private static final String DEFAULT_WIDGETSET = "com.itmill.toolkit.terminal.gwt.DefaultWidgetSet"; - // Widget set narameter name + // Widget set parameter name private static final String PARAMETER_WIDGETSET = "widgetset"; // Private fields @@ -365,7 +365,8 @@ public class ApplicationServlet extends HttpServlet { compare = "/" + applicationRunnerClassname + AJAX_UIDL_URI; } - if (request.getPathInfo().startsWith(compare)) { + if (request.getPathInfo().startsWith(compare + "/") + || request.getPathInfo().endsWith(compare)) { UIDLrequest = true; application = getExistingApplication(request, response); if (application == null) { @@ -694,6 +695,11 @@ public class ApplicationServlet extends HttpServlet { HttpServletResponse response, Window window, String themeName, Application application) throws IOException, MalformedURLException { + // Portlets only want a html fragment + // TODO own (itmill) attribute for this e.g + // ApplicationServlet.class.getName()+".writeFragment" + boolean fragment = (request.getAttribute("javax.portlet.request") != null); + // Window renders are not cacheable response.setHeader("Cache-Control", "no-cache"); response.setHeader("Pragma", "no-cache"); @@ -706,30 +712,15 @@ public class ApplicationServlet extends HttpServlet { .getPathInfo(); String title = ((window == null || window.getCaption() == null) ? "IT Mill Toolkit 5" : window.getCaption()); - page - .write("\n"); - - page - .write("\n\n" - + "" - + title - + "\n" - + "\n"); + if (themeName != null) { + // Custom theme's stylesheet + page.write("\n"); + } + // TODO styles & win-name from attribute + page.write("
"); + + page + .write("\n"); + page.write("};\n\n"); - boolean testingWindow = testingToolsActive - && request.getParameter("TT") != null; + } else { + page + .write("\n"); + + page + .write("\n\n" + + "" + + title + + "\n" + + "\n"); - page.write("\n"); + boolean testingWindow = testingToolsActive + && request.getParameter("TT") != null; - if (themeName != null) { - // Custom theme's stylesheet - page.write("\n"); - } + if (testingWindow) { + writeTestingToolsScripts(page, request); + } - page - .write("\n\n" - + " \n" - + "
" - + " \n" + "\n"); + page.write("\n"); + if (themeName != null) { + // Custom theme's stylesheet + page.write("\n"); + } + + page + .write("\n\n" + + " \n" + + "
" + + " \n" + "\n"); + } page.close(); }