diff --git a/maven/blade.jsf.portlet.ds/pom.xml b/maven/blade.jsf.portlet.ds/pom.xml index bfb96d1..52742f6 100644 --- a/maven/blade.jsf.portlet.ds/pom.xml +++ b/maven/blade.jsf.portlet.ds/pom.xml @@ -25,6 +25,16 @@ com.sun.faces jsf-impl + + com.liferay.portal + util-bridges + 7.0.0-SNAPSHOT + + + com.liferay.portal + util-java + 7.0.0-SNAPSHOT + javax.portlet portlet-api @@ -40,6 +50,17 @@ org.osgi.compendium provided + + org.osgi + org.osgi.core + provided + + + com.liferay + com.liferay.portal.jsf.portlet.tracker + 1.0.0 + provided + @@ -54,7 +75,39 @@ true {maven-resources} blade.portlet - javax.portlet;version="[2.0,3)",javax.servlet;version="[2.5,4)" + + javax.faces.* + javax.naming, + javax.portlet;version="[2.0,3)", + javax.portlet.filter;version="[2.0,3)", + javax.servlet;version="[2.5,4)", + javax.servlet.http;version="[2.5,4)", + javax.servlet.jsp, + javax.servlet.jsp.*, + javax.el, + javax.el.*, + javax.management, + javax.management.*, + javax.xml, + javax.xml.*, + javax.naming.*, + com.liferay.portal.model, + com.liferay.staging.portlet.data.handler, + com.liferay.portlet.exportimport.lar, + com.liferay.portal.jsf.portlet.tracker, + com.liferay.portal.kernel.log, + com.liferay.portal.kernel.servlet.filters.invoker, + com.liferay.portal.kernel.servlet, + com.liferay.portal.kernel.portlet, + com.sun.el, + org.w3c.dom, + org.w3c.dom.*, + org.xml.sax, + org.xml.sax.*, + org.osgi.* + + blade-jsf-portlet + /blade-jsf-portlet <_dsannotations>* @@ -62,4 +115,4 @@ - + \ No newline at end of file diff --git a/maven/blade.jsf.portlet.ds/src/main/java/blade/portlet/JSFPortletDS.java b/maven/blade.jsf.portlet.ds/src/main/java/blade/portlet/JSFPortletDS.java index b8e86ab..5938a0f 100644 --- a/maven/blade.jsf.portlet.ds/src/main/java/blade/portlet/JSFPortletDS.java +++ b/maven/blade.jsf.portlet.ds/src/main/java/blade/portlet/JSFPortletDS.java @@ -15,11 +15,14 @@ */ package blade.portlet; +import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; import javax.portlet.Portlet; import javax.portlet.faces.GenericFacesPortlet; +import javax.servlet.ServletContext; @Component( immediate = true, @@ -35,7 +38,13 @@ public class JSFPortletDS extends GenericFacesPortlet { @Activate - public void activate() { + public void activate(BundleContext bundleContext) { System.err.println("!@#$ activated " + this); } + + @Reference(target="(osgi.web.symbolicname=blade.jsf.portlet.ds)") + protected void setServletContext(ServletContext servletContext) { + //wait for the servlet context + } + } \ No newline at end of file diff --git a/maven/blade.jsf.portlet.ds/src/main/resources/WEB-INF/faces-config.xml b/maven/blade.jsf.portlet.ds/src/main/resources/WEB-INF/faces-config.xml new file mode 100644 index 0000000..87c1f85 --- /dev/null +++ b/maven/blade.jsf.portlet.ds/src/main/resources/WEB-INF/faces-config.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/maven/blade.listener.servlet.portlet.ds/pom.xml b/maven/blade.listener.servlet.portlet.ds/pom.xml new file mode 100644 index 0000000..405657e --- /dev/null +++ b/maven/blade.listener.servlet.portlet.ds/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + blade.listener.servlet.portlet.ds + Listener Servlet DS + bundle + + + blade + blade.maven + 1.0.0-SNAPSHOT + + + + + javax.portlet + portlet-api + provided + + + javax.servlet + servlet-api + provided + + + org.osgi + org.osgi.compendium + provided + + + org.osgi + org.osgi.core + provided + + + com.liferay + com.liferay.portal.jsf.portlet.tracker + 1.0.0 + provided + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + *;scope=compile|runtime;groupId=!org.osgi + true + {maven-resources} + blade.portlet + + javax.portlet;version="[2.0,3)", + javax.portlet.filter;version="[2.0,3)", + javax.servlet;version="[2.5,4)", + javax.servlet.http;version="[2.5,4)", + javax.servlet.jsp, + javax.servlet.jsp.*, + javax.el, + javax.el.*, + javax.management, + javax.management.*, + javax.xml, + javax.xml.*, + javax.naming, + javax.naming.*, + com.liferay.portal.model, + com.liferay.staging.portlet.data.handler, + com.liferay.portlet.exportimport.lar, + com.liferay.portal.jsf.portlet.tracker, + com.liferay.portal.kernel.log, + com.liferay.portal.kernel.servlet.filters.invoker, + com.liferay.portal.kernel.servlet, + com.liferay.portal.kernel.portlet, + com.sun.el, + org.w3c.dom, + org.w3c.dom.*, + org.xml.sax, + org.xml.sax.*, + org.osgi.* + + /blade-listener-servlet-portlet + <_dsannotations>* + + + + + + + diff --git a/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/listener/ExampleContextListener.java b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/listener/ExampleContextListener.java new file mode 100644 index 0000000..c285ca1 --- /dev/null +++ b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/listener/ExampleContextListener.java @@ -0,0 +1,39 @@ +package blade.listener; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.ServletRequestEvent; +import javax.servlet.ServletRequestListener; + +public class ExampleContextListener implements ServletContextListener,ServletRequestListener { + + @Override + public void contextInitialized(ServletContextEvent sce) { + System.err.println("Context initialized"); + + ServletContext servletContext = sce.getServletContext(); + + servletContext.setAttribute("contextAttribute", "Listener passed"); + + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + // TODO Auto-generated method stub + + } + + @Override + public void requestDestroyed(ServletRequestEvent sre) { + // TODO Auto-generated method stub + + } + + @Override + public void requestInitialized(ServletRequestEvent sre) { + // TODO Auto-generated method stub + + } + +} diff --git a/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/portlet/ListenerServletPortletDS.java b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/portlet/ListenerServletPortletDS.java new file mode 100644 index 0000000..c997e3f --- /dev/null +++ b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/portlet/ListenerServletPortletDS.java @@ -0,0 +1,43 @@ +/** + * Copyright 2000-present Liferay, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package blade.portlet; + +import com.liferay.portal.jsf.portlet.tracker.JSFPortlet; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; + +import javax.portlet.GenericPortlet; +import javax.portlet.Portlet; + +@Component( + immediate = true, + property = { + "com.liferay.portlet.display-category=category.sample", + "com.liferay.portlet.instanceable=true", + "javax.portlet.display-name=Listener Servlet Portlet DS", + "javax.portlet.init-param.view-template=", + "javax.portlet.security-role-ref=power-user,user" + }, + service = JSFPortlet.class +) +public class ListenerServletPortletDS extends GenericPortlet implements JSFPortlet { + + @Activate + public void activate(BundleContext bundleContext) { + System.err.println("!@#$ activated " + this); + } +} \ No newline at end of file diff --git a/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/servlet/ExampleServlet.java b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/servlet/ExampleServlet.java new file mode 100644 index 0000000..2340809 --- /dev/null +++ b/maven/blade.listener.servlet.portlet.ds/src/main/java/blade/servlet/ExampleServlet.java @@ -0,0 +1,21 @@ +package blade.servlet; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; + +public class ExampleServlet extends HttpServlet { + + @Override + public void init() throws ServletException { + + super.init(); + + ServletContext servletContext = getServletContext(); + + String contextAttributeValue = (String) servletContext.getAttribute("contextAttribute"); + + System.err.println("Context attribute value: " + contextAttributeValue); + } + +} diff --git a/maven/blade.listener.servlet.portlet.ds/src/main/resources/WEB-INF/web.xml b/maven/blade.listener.servlet.portlet.ds/src/main/resources/WEB-INF/web.xml new file mode 100644 index 0000000..a54a4da --- /dev/null +++ b/maven/blade.listener.servlet.portlet.ds/src/main/resources/WEB-INF/web.xml @@ -0,0 +1,19 @@ + + + + + + blade.listener.ExampleContextListener + + + + ExampleServlet + blade.servlet.ExampleServlet + 1 + + + ExampleServlet + *.xhtml + + diff --git a/maven/pom.xml b/maven/pom.xml index acdce62..8a85edb 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -12,7 +12,7 @@ 7.0.0-SNAPSHOT - 2.2.6 + 2.2.12 @@ -52,7 +52,7 @@ com.liferay.faces liferay-faces-bridge-impl - 4.2.0-beta + 4.2.5-ga6 com.liferay.portal @@ -153,4 +153,4 @@ blade.hook.jsp - + \ No newline at end of file