summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2008-06-27 13:34:20 +0000
committerMarc Englund <marc.englund@itmill.com>2008-06-27 13:34:20 +0000
commit4174a3f43ea744612ce9ca0ade53bd173266a14b (patch)
tree9419de14ad10af00160130abfc4e0cc0f4e359f7
parent185d1d6078fd82f72f9efe1b63e9bbedd9aa37ce (diff)
downloadvaadin-framework-4174a3f43ea744612ce9ca0ade53bd173266a14b.tar.gz
vaadin-framework-4174a3f43ea744612ce9ca0ade53bd173266a14b.zip
Basic JBossPortal support: WAR deploys on JBossPortal, portlets show up; Fixes #1851
svn changeset:4963/svn branch:trunk
-rw-r--r--WebContent/WEB-INF/itmill-object.xml138
-rw-r--r--WebContent/WEB-INF/portlet-instances.xml72
-rw-r--r--build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java78
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java2
4 files changed, 288 insertions, 2 deletions
diff --git a/WebContent/WEB-INF/itmill-object.xml b/WebContent/WEB-INF/itmill-object.xml
new file mode 100644
index 0000000000..2c70ae2582
--- /dev/null
+++ b/WebContent/WEB-INF/itmill-object.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+<deployments>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>PortletDemoPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>PortletDemoPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>SimpleReserverPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>SimpleReserverPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>SelectDemoPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>SelectDemoPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>TableDemoPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>TableDemoPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>FilterSelectPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>FilterSelectPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>FeatureBrowserPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>FeatureBrowserPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>ModalWindowPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>ModalWindowPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>CalcPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>CalcPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>NotificationDemoPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>NotificationDemoPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>ChatServletPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>ChatServletPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+ <deployment>
+ <parent-ref>default.default</parent-ref>
+ <if-exists>overwrite</if-exists> <window>
+ <window-name>BrowserDemoPortletWindow</window-name>
+ <content>
+ <content-type>portlet</content-type>
+ <content-uri>BrowserDemoPortletInstance</content-uri>
+ </content>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </deployment>
+</deployments> \ No newline at end of file
diff --git a/WebContent/WEB-INF/portlet-instances.xml b/WebContent/WEB-INF/portlet-instances.xml
new file mode 100644
index 0000000000..ba4da73c5b
--- /dev/null
+++ b/WebContent/WEB-INF/portlet-instances.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+<deployments>
+ <deployment>
+ <instance>
+ <instance-id>PortletDemoPortletInstance</instance-id>
+ <portlet-ref>PortletDemoPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>SimpleReserverPortletInstance</instance-id>
+ <portlet-ref>SimpleReserverPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>SelectDemoPortletInstance</instance-id>
+ <portlet-ref>SelectDemoPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>TableDemoPortletInstance</instance-id>
+ <portlet-ref>TableDemoPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>FilterSelectPortletInstance</instance-id>
+ <portlet-ref>FilterSelectPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>FeatureBrowserPortletInstance</instance-id>
+ <portlet-ref>FeatureBrowserPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>ModalWindowPortletInstance</instance-id>
+ <portlet-ref>ModalWindowPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>CalcPortletInstance</instance-id>
+ <portlet-ref>CalcPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>NotificationDemoPortletInstance</instance-id>
+ <portlet-ref>NotificationDemoPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>ChatServletPortletInstance</instance-id>
+ <portlet-ref>ChatServletPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <instance-id>BrowserDemoPortletInstance</instance-id>
+ <portlet-ref>BrowserDemoPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments> \ No newline at end of file
diff --git a/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java b/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java
index 80a6d73031..8b026232d3 100644
--- a/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java
+++ b/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java
@@ -31,6 +31,8 @@ public class PortletConfigurationGenerator {
private static final String PORTLET_XML_FILE = "portlet.xml";
private static final String LIFERAY_PORTLET_XML_FILE = "liferay-portlet.xml";
private static final String LIFERAY_DISPLAY_XML_FILE = "liferay-display.xml";
+ private static final String JBOSS_OBJECT_FILE = "itmill-object.xml";
+ private static final String JBOSS_INSTANCE_FILE = "portlet-instances.xml";
// "templates" follow;
private static final String PORTLET_XML_HEAD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@@ -107,6 +109,35 @@ public class PortletConfigurationGenerator {
private static final String LIFERAY_DISPLAY_XML_FOOT = "\n"
+ " </category>\n" + "</display>";
+ private static final String JBOSS_INSTANCE_HEAD = "<?xml version=\"1.0\" standalone=\"yes\"?>\r\n"
+ + "<!DOCTYPE deployments PUBLIC\r\n"
+ + " \"-//JBoss Portal//DTD Portlet Instances 2.6//EN\"\r\n"
+ + " \"http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd\">\r\n"
+ + "<deployments>\r\n";
+ private static final String JBOSS_INSTANCE_SECTION = " <deployment>\r\n <instance>\r\n"
+ + " <instance-id>%PORTLETNAME%Instance</instance-id>\r\n"
+ + " <portlet-ref>%PORTLETNAME%</portlet-ref>\r\n"
+ + " </instance>\r\n </deployment>\r\n";
+ private static final String JBOSS_INSTANCE_FOOT = "</deployments>";
+ private static final String JBOSS_OBJECT_HEAD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+ + "<!DOCTYPE deployments PUBLIC\r\n"
+ + " \"-//JBoss Portal//DTD Portal Object 2.6//EN\"\r\n"
+ + " \"http://www.jboss.org/portal/dtd/portal-object_2_6.dtd\">\r\n"
+ + "<deployments>\r\n";
+ private static final String JBOSS_OBJECT_SECTION = " <deployment>\r\n"
+ + " <parent-ref>default.default</parent-ref>\r\n"
+ + " <if-exists>overwrite</if-exists>"
+ + " <window>\r\n"
+ + " <window-name>%PORTLETNAME%Window</window-name>\r\n"
+ + " <content>\r\n"
+ + " <content-type>portlet</content-type>\r\n"
+ + " <content-uri>%PORTLETNAME%Instance</content-uri>\r\n"
+ + " </content>\r\n"
+ + " <region>center</region>\r\n"
+ + " <height>1</height>\r\n"
+ + " </window>\r\n </deployment>\r\n";
+ private static final String JBOSS_OBJECT_FOOT = "</deployments>";
+
/**
* @param args
* <path to directory with web.xml> [widgetset to use]
@@ -193,12 +224,35 @@ public class PortletConfigurationGenerator {
} catch (FileNotFoundException e) {
System.out.println(liferayDisplayXmlFile + " not found!");
}
+ // open jboss object.xml
+ File jbossObjectXmlFile = new File(args[0] + File.separatorChar
+ + JBOSS_OBJECT_FILE);
+ OutputStreamWriter joout = null;
+ try {
+ joout = new OutputStreamWriter(new FileOutputStream(
+ jbossObjectXmlFile), Charset.forName("UTF-8"));
+ } catch (FileNotFoundException e) {
+ System.out.println(jbossObjectXmlFile + " not found!");
+ }
+ // open jboss insrance.xml
+ File jbossInstanceXmlFile = new File(args[0] + File.separatorChar
+ + JBOSS_INSTANCE_FILE);
+ OutputStreamWriter jiout = null;
+ try {
+ jiout = new OutputStreamWriter(new FileOutputStream(
+ jbossInstanceXmlFile), Charset.forName("UTF-8"));
+ } catch (FileNotFoundException e) {
+ System.out.println(jbossInstanceXmlFile + " not found!");
+ }
- if (pout != null && lpout != null && ldout != null) {
+ if (pout != null && lpout != null && ldout != null && joout != null
+ && jiout != null) {
String pstring = PORTLET_XML_HEAD;
String lpstring = LIFERAY_PORTLET_XML_HEAD;
String ldstring = LIFERAY_DISPLAY_XML_HEAD;
+ String jostring = JBOSS_OBJECT_HEAD;
+ String jistring = JBOSS_INSTANCE_HEAD;
Pattern p1 = Pattern
.compile("<servlet-mapping>.*?<servlet-name>(.*?)<\\/servlet-name>.*?<url-pattern>(.*?)<\\/url-pattern>(.*?)<\\/servlet-mapping>");
@@ -264,16 +318,32 @@ public class PortletConfigurationGenerator {
s = s.replaceAll("%URL%", url);
ldstring += s;
+ s = JBOSS_OBJECT_SECTION;
+ s = s.replaceAll("%NAME%", name);
+ s = s.replaceAll("%PORTLETNAME%", pname);
+ s = s.replaceAll("%URL%", url);
+ jostring += s;
+
+ s = JBOSS_INSTANCE_SECTION;
+ s = s.replaceAll("%NAME%", name);
+ s = s.replaceAll("%PORTLETNAME%", pname);
+ s = s.replaceAll("%URL%", url);
+ jistring += s;
+
}
pstring += PORTLET_XML_FOOT;
lpstring += LIFERAY_PORTLET_XML_FOOT;
ldstring += LIFERAY_DISPLAY_XML_FOOT;
+ jostring += JBOSS_OBJECT_FOOT;
+ jistring += JBOSS_INSTANCE_FOOT;
try {
pout.write(pstring);
lpout.write(lpstring);
ldout.write(ldstring);
+ joout.write(jostring);
+ jiout.write(jistring);
} catch (IOException e) {
System.out.println("Write FAILED:" + e);
}
@@ -290,6 +360,12 @@ public class PortletConfigurationGenerator {
if (ldout != null) {
ldout.close();
}
+ if (joout != null) {
+ joout.close();
+ }
+ if (jiout != null) {
+ jiout.close();
+ }
} catch (IOException e) {
System.out.println("Close FAILED: " + e);
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
index 77cca2ac1b..894eba519b 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
@@ -50,6 +50,7 @@ public class ApplicationPortlet implements Portlet {
protected void writeAjaxWindow(RenderRequest request,
RenderResponse response) throws IOException {
+ response.setContentType("text/html");
if (app != null) {
PortletSession sess = request.getPortletSession();
PortletApplicationContext ctx = PortletApplicationContext
@@ -72,7 +73,6 @@ public class ApplicationPortlet implements Portlet {
dispatcher.include(request, response);
} catch (PortletException e) {
- response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print("<h1>Servlet include failed!</h1>");
out.print("<div>" + e + "</div>");