-
1. Re: New to GateIn 3.1.... Need Help Starting Off...
trong.tran Sep 10, 2010 1:04 AM (in response to hell_storm2004)Assume that you have implemented the Hello World portlet correctly, I let you check some points :
1. Ensure the Hello World portlet is declared correctly in portlet.xml file
2. Make sure your web.xml file includes :
<!-- This for portlet registration in GateIn --> <servlet> <servlet-name>PortletWrapper</servlet-name> <servlet-class>org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper</servlet-class> </servlet> <servlet-mapping> <servlet-name>PortletWrapper</servlet-name> <url-pattern>/PortletWrapper</url-pattern> </servlet-mapping>
3. In Application Registry page, the portlet could be imported by clicking on the "Import Applications" button
-
2. Re: New to GateIn 3.1.... Need Help Starting Off...
mwringe Sep 10, 2010 11:06 AM (in response to trong.tran)You do not need to add anything special to the web.xml, your web.xml can be just an empty <web-app></web-app> and GateIn will still pick up your portlets (assuming of course your web-application itself doesn't need anything add here). Just leave the web.xml alone.
You can add the GateInServlet to the web.xml if you want, but its not going to do anything special (its mainly meant for testing purposes and if people want to run some sort of custom setup on non-supported web containers):
<servlet> <servlet-name>GateInServlet</servlet-name> <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>GateInServlet</servlet-name> <url-pattern>/gateinservlet</url-pattern> </servlet-mapping>
The PortletWrapper was the way for doing things in eXo Portal, and is just a wrapper around the GateInServlet for backwards compatibility. So its not needed and is not going to do anything unless you are trying to run a custom setup. And the proper way to use PortletWrapper is to also include the PortletApplicationListener:
<listener> <listener-class>org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener</listener-class> </listener> <servlet> <servlet-name>PortletWrapper</servlet-name> <servlet-class>org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper</servlet-class> </servlet> <servlet-mapping> <servlet-name>PortletWrapper</servlet-name> <url-pattern>/PortletWrapper</url-pattern> </servlet-mapping>
Adding these extra listeners and servlets are just going to confuse people when they realise it works without them. They are not meant to be used in normal portlet applications.
-
3. Re: New to GateIn 3.1.... Need Help Starting Off...
trong.tran Sep 10, 2010 12:21 PM (in response to mwringe)You are right, Matt.
I did not notice that point, thanks for your information.
-
4. Re: New to GateIn 3.1.... Need Help Starting Off...
julien_viet Sep 12, 2010 9:54 AM (in response to mwringe)Actually this is incorrect, doing without the GateIn servlet is a facility solution but it is not portable accross all application servers.
Omitting the declaration works for Tomcat and JBoss Application Server version of GateIn but it might not work for other application servers in which GateIn could deploy in the future.
-
5. Re: New to GateIn 3.1.... Need Help Starting Off...
hell_storm2004 Sep 13, 2010 4:17 AM (in response to hell_storm2004)Thanks for your reply guys! Here is what i did after going through your posts. I have attached all the details needed. Please take a look and let me know if i did everything correctly. Here is my HelloWorldPortlet.java file:
package com.test; import java.io.IOException; import java.io.PrintWriter; import javax.portlet.GenericPortlet; import javax.portlet.PortletConfig; import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; public class HelloWorldPortlet extends GenericPortlet { public void init(PortletConfig pConfig) throws PortletException { super.init(pConfig); } public void doView(RenderRequest pRequest, RenderResponse pResponse) throws PortletException, IOException { pResponse.setContentType("text/html"); PrintWriter printWriter = pResponse.getWriter(); printWriter.println("Hello, World"); } }
web.xml file:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>TempTry</display-name> <servlet> <servlet-name>PortletWrapper</servlet-name> <servlet-class>org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper</servlet-class> </servlet> <servlet> <servlet-name>GateInServlet</servlet-name> <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>PortletWrapper</servlet-name> <url-pattern>/PortletWrapper</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>GateInServlet</servlet-name> <url-pattern>/gateinservlet</url-pattern> </servlet-mapping> <listener> <listener-class>org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener</listener-class> </listener> </web-app>
Also my portelt.xml file.
<?xml version="1.0" encoding="UTF-8"?> <portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <description xml:lang="EN">My First Hello World Portlet</description> <portlet-name>HelloWorld</portlet-name> <display-name xml:lang="EN">Hello World</display-name> <portlet-class>com.test.HelloWorldPortlet</portlet-class> <expiration-cache>-1</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> </supports> <supported-locale>en</supported-locale> <portlet-info> <title>Hello World</title> <short-title>Hello</short-title> <keywords>hello</keywords> </portlet-info> </portlet> </portlet-app>
I have also attached a small pic of my Eclipse packaging of the dynamic web project. Please a look at that as well. The project is named as TempTry. Any guidance would be appreciated.
-
Project Packaing.JPG 17.3 KB
-