jsf4portlets-devel Mailing List for JSF 4 Portlets (Page 3)
Status: Alpha
Brought to you by:
alonsoft
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(3) |
Aug
(4) |
Sep
(8) |
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(8) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(4) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(23) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <alo...@us...> - 2008-10-19 13:31:42
|
Revision: 43 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=43&view=rev Author: alonsoft Date: 2008-10-19 13:31:32 +0000 (Sun, 19 Oct 2008) Log Message: ----------- Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets-ext/pom.xml trunk/pom.xml Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2008-06-19 16:22:30 UTC (rev 42) +++ trunk/jsf4portlets/pom.xml 2008-10-19 13:31:32 UTC (rev 43) @@ -65,7 +65,7 @@ <artifactId>servlet-api</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> + <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> </dependency> <dependency> Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2008-06-19 16:22:30 UTC (rev 42) +++ trunk/jsf4portlets-ext/pom.xml 2008-10-19 13:31:32 UTC (rev 43) @@ -51,7 +51,7 @@ <artifactId>servlet-api</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> + <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> </dependency> <dependency> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-06-19 16:22:30 UTC (rev 42) +++ trunk/pom.xml 2008-10-19 13:31:32 UTC (rev 43) @@ -191,7 +191,7 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>javax.servlet</groupId> + <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2008-06-19 16:22:33
|
Revision: 42 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=42&view=rev Author: alonsoft Date: 2008-06-19 09:22:30 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Implementation for the Early Draft 3 Added Paths: ----------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeRenderFilter.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/el/BridgeELContextListener.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/DefaultPortletURLEncoder.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/GenericInjectionProvider.java Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeRenderFilter.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeRenderFilter.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeRenderFilter.java 2008-06-19 16:22:30 UTC (rev 42) @@ -0,0 +1,282 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2008 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets; + +import java.io.ByteArrayOutputStream; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.util.logging.Logger; + +import javax.portlet.faces.Bridge; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.UnavailableException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponseWrapper; + +public class BridgeRenderFilter implements Filter { + + private static final Logger logger = Logger.getLogger( + BridgeRenderFilter.class.getPackage().getName(), + "net.sf.jsf4portlets.LogMessages"); + + public static final String RESPONSE_COMPLETE = + "net.sf.jsf4portlets.RESPONSE_COMPLETE"; + + private FilterConfig filterConfig; + private boolean initialized = false; + + public void destroy() { + filterConfig = null; + initialized = false; + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + logger.entering(BridgeRenderFilter.class.getName(), "doFilter", + new Object[]{ request, response, chain }); + + if(!initialized) { + throw new UnavailableException("BridgeRenderFilter not initialized"); + } + + if((request instanceof HttpServletRequest) + && (response instanceof HttpServletResponse)) { + chain.doFilter(request, response); + logger.exiting(BridgeRenderFilter.class.getName(), "doFilter"); + return ; + } + + if(Boolean.TRUE.equals(request.getAttribute(Bridge.RENDER_CONTENT_AFTER_VIEW))) { + BridgeRenderResponseWrapper bridgeResponse = new BridgeRenderResponseWrapper( + (HttpServletResponse) response); + chain.doFilter(request, bridgeResponse); + if(bridgeResponse.isBytes()) { + request.setAttribute(Bridge.AFTER_VIEW_CONTENT, + bridgeResponse.getBytes()); + } else { + request.setAttribute(Bridge.AFTER_VIEW_CONTENT, + bridgeResponse.getChars()); + } + if(bridgeResponse.getStatus() < 200 || bridgeResponse.getStatus() > 299) { + bridgeResponse.flushContentToWrappedResponse(); + request.setAttribute(RESPONSE_COMPLETE, Boolean.TRUE); + } + } else { + chain.doFilter(request, response); + } + + logger.exiting(BridgeRenderFilter.class.getName(), "doFilter"); + } + + public void init(FilterConfig filterConfig) + throws ServletException { + this.filterConfig = filterConfig; + initialized = true; + } + + public FilterConfig getFilterConfig() { + return filterConfig; + } + + public ServletContext getServletContext() { + return filterConfig.getServletContext(); + } + + private class BridgeRenderResponseWrapper extends HttpServletResponseWrapper { + + private ByteArrayWebOutputStream basos; + private PrintWriter pw ; + private CharArrayWriter caw; + private int status = HttpServletResponse.SC_OK; + + public BridgeRenderResponseWrapper(HttpServletResponse response) { + super(response); + } + + @Override + public void sendError(int sc, String msg) throws IOException { + super.sendError(sc, msg); + status = sc; + } + + @Override + public void sendError(int sc) throws IOException { + super.sendError(sc); + status = sc; + } + + @Override + public void setStatus(int sc) { + super.setStatus(sc); + status = sc; + } + + @Override + public void setStatus(int sc, String sm) { + super.setStatus(sc, sm); + status = sc; + } + + public int getStatus() { + return status; + } + + public boolean isBytes() { + return (null != basos); + } + + public boolean isChars() { + return (null != caw); + } + + public byte[] getBytes() { + byte[] result = null; + if (null != basos) { + result = basos.toByteArray(); + } + return result; + } + + public char[] getChars() { + char[] result = null; + if (null != caw) { + result = caw.toCharArray(); + } + return result; + } + + @Override + public String toString() { + String result = null; + if (null != caw) { + result = caw.toString(); + } else if (null != basos) { + result = basos.toString(); + } + return result; + } + + public void flushContentToWrappedResponse() throws IOException { + ServletResponse response = getResponse(); + if(caw != null) { + pw.flush(); + caw.writeTo(response.getWriter()); + caw.reset(); + } else if(basos != null) { + basos.writeTo(response.getWriter(), + response.getCharacterEncoding()); + basos.resetByteArray(); + } + response.flushBuffer(); + } + + public void resetBuffers() throws IOException { + if (null != caw) { + caw.reset(); + } else if (null != basos) { + basos.resetByteArray(); + } + } + + @Override + public ServletOutputStream getOutputStream() throws IOException { + if (pw != null) { + throw new IllegalStateException(); + } + if (null == basos) { + basos = new ByteArrayWebOutputStream(); + } + return basos; + } + + @Override + public PrintWriter getWriter() throws IOException { + if (basos != null) { + throw new IllegalStateException(); + } + if (null == pw) { + caw = new CharArrayWriter(1024); + pw = new PrintWriter(caw); + } + + return pw; + } + + } + + private static class ByteArrayWebOutputStream extends ServletOutputStream { + + private ByteBufferOutputStream bbos; + + public ByteArrayWebOutputStream() { + bbos = new ByteBufferOutputStream(1024); + } + + public void resetByteArray() { + bbos.reset(); + } + + public byte[] toByteArray() { + return bbos.toByteArray(); + } + + @Override + public void write(int n) { + bbos.write(n); + } + + public void writeTo(Writer writer, String encoding) + throws IOException { + ByteBuffer bb = bbos.getByteBuffer(); + CharsetDecoder decoder = Charset.forName(encoding).newDecoder(); + CharBuffer cb = decoder.decode(bb); + writer.write(cb.array()); + } + + } + + private static class ByteBufferOutputStream extends ByteArrayOutputStream { + + public ByteBufferOutputStream(int initialCapacity) { + super(initialCapacity); + } + + public ByteBuffer getByteBuffer() { + return ByteBuffer.wrap(buf, 0, count); + } + + } + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/el/BridgeELContextListener.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/el/BridgeELContextListener.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/el/BridgeELContextListener.java 2008-06-19 16:22:30 UTC (rev 42) @@ -0,0 +1,22 @@ +package net.sf.jsf4portlets.el; + +import javax.el.ELContext; +import javax.el.ELContextEvent; +import javax.el.ELContextListener; +import javax.faces.context.FacesContext; +import javax.portlet.PortletConfig; + +import net.sf.jsf4portlets.util.Util; + +public class BridgeELContextListener implements ELContextListener { + + public void contextCreated(ELContextEvent event) { + ELContext elContext = event.getELContext(); + if(null == elContext.getContext(PortletConfig.class)) { + FacesContext facesContext = (FacesContext) elContext.getContext(FacesContext.class); + PortletConfig portletConfig = Util.getPortletConfig(facesContext.getExternalContext()); + elContext.putContext(PortletConfig.class, portletConfig); + } + } + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/DefaultPortletURLEncoder.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/DefaultPortletURLEncoder.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/DefaultPortletURLEncoder.java 2008-06-19 16:22:30 UTC (rev 42) @@ -0,0 +1,170 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.spi; + +import java.util.Enumeration; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.faces.FacesException; +import javax.faces.context.ExternalContext; +import javax.portlet.ActionResponse; +import javax.portlet.PortletMode; +import javax.portlet.PortletModeException; +import javax.portlet.PortletResponse; +import javax.portlet.PortletSecurityException; +import javax.portlet.PortletURL; +import javax.portlet.RenderResponse; +import javax.portlet.WindowState; +import javax.portlet.WindowStateException; +import javax.portlet.faces.Bridge; +import javax.portlet.faces.Bridge.PortletPhase; + +import net.sf.jsf4portlets.BridgeConstants; +import net.sf.jsf4portlets.context.PortletExternalContext; +import net.sf.jsf4portlets.util.BridgeURL; + +public class DefaultPortletURLEncoder implements PortletURLEncoder { + + private final Logger logger = Logger.getLogger( + DefaultPortletURLEncoder.class.getPackage().getName(), + "net.sf.jsf4portlets.LogMessages"); + + public String encodeActionURL(PortletExternalContext context, String url) { + if (url == null) { + throw new NullPointerException(); + } + + BridgeURL qs = BridgeURL.parse(context, url, "UTF-8"); + if(url.startsWith("#") || qs.isExternal()) { + return url; + } + + String directLink = qs.getParameter(Bridge.DIRECT_LINK); + if(directLink != null) { + if("true".equals(directLink)) { + return qs.toString(); + } else { + qs.removeParameter(Bridge.DIRECT_LINK); + } + } + + String viewId = qs.getViewId(); + if(viewId == null) { + throw new FacesException("Unable to recognize viewId on url: " + url); + } + if(logger.isLoggable(Level.FINER)) { + logger.log(Level.FINER, "J4P_000023", viewId); + } + + String result = null; + qs.setParameter(BridgeConstants.VIEW_ID_PARAMETER, viewId); + PortletPhase phase = context.getPortletLifecyclePhase(); + if(PortletPhase.RenderPhase.equals(phase)) { + RenderResponse response = (RenderResponse) ((ExternalContext) context).getResponse(); + PortletURL portletURL = response.createActionURL(); + + Enumeration<String> paramNames = qs.getParameterNames(); + while(paramNames.hasMoreElements()) { + String param = paramNames.nextElement(); + if(Bridge.PORTLET_MODE_PARAMETER.equals(param)) { + PortletMode portletMode = new PortletMode(qs.getParameter(param)); + try { + portletURL.setPortletMode(portletMode); + } catch (PortletModeException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000052", portletMode); + } + } else if(Bridge.PORTLET_WINDOW_STATE_PARAMETER.equals(param)) { + WindowState windowState = new WindowState(qs.getParameter(param)); + try { + portletURL.setWindowState(windowState); + } catch (WindowStateException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000053", windowState); + } + } else if(Bridge.PORTLET_SECURE_PARAMETER.equals(param)) { + boolean secure = Boolean.parseBoolean(qs.getParameter(param)); + try { + portletURL.setSecure(secure); + } catch (PortletSecurityException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000054", secure); + } + } else { + portletURL.setParameter(param, qs.getParameterValues(param)); + } + } + + result = portletURL.toString(); + } else if(PortletPhase.ActionPhase.equals(phase)) { + ActionResponse response = (ActionResponse) ((ExternalContext) context).getResponse(); + Enumeration<String> paramNames = qs.getParameterNames(); + while(paramNames.hasMoreElements()) { + String param = paramNames.nextElement(); + if(Bridge.PORTLET_MODE_PARAMETER.equals(param)) { + PortletMode portletMode = new PortletMode(qs.getParameter(param)); + try { + response.setPortletMode(portletMode); + } catch (PortletModeException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000052", portletMode); + } + qs.removeParameter(param); + } else if(Bridge.PORTLET_WINDOW_STATE_PARAMETER.equals(param)) { + WindowState windowState = new WindowState(qs.getParameter(param)); + try { + response.setWindowState(windowState); + } catch (WindowStateException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000053", windowState); + } + qs.removeParameter(param); + } else if(Bridge.PORTLET_SECURE_PARAMETER.equals(param)) { + // Can't change the security now + qs.removeParameter(param); + } else { + response.setRenderParameter(param, qs.getParameter(param)); + } + } + + result = qs.toString(); + } else { + throw new IllegalStateException(); + } + return result; + } + + public String encodeResourceURL(PortletExternalContext context, String url) { + if(url == null) { + throw new NullPointerException(); + } + + if(!url.startsWith("http") && !url.startsWith("https") + && !(url.startsWith("/"))) { + url = context.getRequestContextPath() + "/" + url; + } + + PortletResponse response = (PortletResponse) ((ExternalContext) context).getResponse(); + return (response.encodeURL(url)); + } + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/GenericInjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/GenericInjectionProvider.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/GenericInjectionProvider.java 2008-06-19 16:22:30 UTC (rev 42) @@ -0,0 +1,144 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2008 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.spi; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.PreDestroy; +import javax.portlet.faces.annotation.BridgePreDestroy; +import javax.portlet.faces.annotation.BridgeScopeAttributeAdded; + + +public class GenericInjectionProvider implements InjectionProvider { + + private static final Logger logger = Logger.getLogger( + GenericInjectionProvider.class.getPackage().getName(), + "net.sf.jsf4portlets.LogMessages"); + + public GenericInjectionProvider() { } + + public void invokeBridgeScopeAttributeAdded(Object managedBean) + throws InjectionProviderException { + if(managedBean != null) { + Method annotatedMethod = getAnnotatedMethod( + managedBean, BridgeScopeAttributeAdded.class); + invokeMethod(managedBean, annotatedMethod); + } + } + + public void invokeBridgePreDestroy(Object managedBean) + throws InjectionProviderException { + if(managedBean != null) { + Method annotatedMethod = getAnnotatedMethod( + managedBean, BridgePreDestroy.class); + invokeMethod(managedBean, annotatedMethod); + } + } + + public void invokePreDestroy(Object managedBean) + throws InjectionProviderException { + if(managedBean != null) { + Method annotatedMethod = getAnnotatedMethod( + managedBean, PreDestroy.class); + invokeMethod(managedBean, annotatedMethod); + } + } + + private void invokeMethod(Object managedBean, Method method) + throws InjectionProviderException { + if(method != null) { + boolean accessible = method.isAccessible(); + method.setAccessible(true); + try { + method.invoke(managedBean); + } catch(Exception e) { + throw new InjectionProviderException(e); + } finally { + method.setAccessible(accessible); + } + } + } + + private Method getAnnotatedMethod(Object managedBean, + Class<? extends Annotation> annotation) { + Class<?> clazz = managedBean.getClass(); + while(!Object.class.equals(clazz)) { + Method[] methods = clazz.getDeclaredMethods(); + for(Method method : methods) { + if(method.isAnnotationPresent(annotation)) { + // validate method + if(Modifier.isStatic(method.getModifiers())) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000045", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + if(!Void.TYPE.equals(method.getReturnType())) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000046", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + if(method.getParameterTypes().length != 0) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000047", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + Class<?>[] exceptions = method.getExceptionTypes(); + if(exceptions.length != 0) { + boolean hasChecked = false; + for(Class<?> excClass : exceptions) { + if(!RuntimeException.class.isAssignableFrom(excClass)) { + hasChecked = true; + break; + } + } + if(hasChecked) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000048", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + } + return method; + } + } + + clazz = clazz.getSuperclass(); + } + + return null; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2008-06-19 16:20:41
|
Revision: 41 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=41&view=rev Author: alonsoft Date: 2008-06-19 09:20:33 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Implementation for the Early Draft 3 Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextFactoryImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/BridgeURL.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/URLUtil.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java trunk/jsf4portlets-ext/pom.xml trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties trunk/pom.xml trunk/src/site/apt/release_notes.apt trunk/src/site/apt/user_docs.apt Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/pom.xml 2008-06-19 16:20:33 UTC (rev 41) @@ -1,3 +1,27 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2008 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -56,11 +80,6 @@ <groupId>javax.portlet</groupId> <artifactId>portlet-api</artifactId> </dependency> - - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - </dependency> <dependency> <groupId>org.apache.tomcat</groupId> @@ -86,6 +105,10 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> </plugin> <plugin> <groupId>net.sourceforge.maven-taglib</groupId> @@ -94,6 +117,10 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> </plugin> </plugins> </reporting> Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java 2008-06-19 16:20:33 UTC (rev 41) @@ -320,9 +320,7 @@ scopes.put(scopeId, scope); watchRequestScope(context.getExternalContext()); } else if(PortletPhase.RenderPhase.equals(phase)) { - String scopeId = context.getExternalContext() - .getRequestParameterMap().get(REQUEST_SCOPE_KEY); - RequestScope scope = (scopeId != null ? scopes.get(scopeId) : null); + RequestScope scope = getPreviousRequestScope(context); if(scope != null) { scope.setViewState((String) context.getExternalContext() .getRequestMap().get(BridgeConstants.VIEW_STATE)); Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2008-06-19 16:20:33 UTC (rev 41) @@ -69,7 +69,7 @@ * <p>Concrete implementation of <code>ExternalContext</code> for use in * a portlet environment.</p> */ -public class ExternalContextImpl extends ExternalContext +class ExternalContextImpl extends ExternalContext implements PortletExternalContext { private static final Logger logger = Logger.getLogger( @@ -306,12 +306,51 @@ if(null != (viewLink = bridgeUrl.getParameter(Bridge.VIEW_LINK))) { bridgeUrl.removeParameter(Bridge.VIEW_LINK); if("true".equals(viewLink)) { - result = encodeActionURL(bridgeUrl.toString()); + PortletPhase phase = getPortletLifecyclePhase(); + if(PortletPhase.ActionPhase.equals(phase)) { + result = encodeActionURL(bridgeUrl.toString()); + } else if(PortletPhase.RenderPhase.equals(phase)) { + RenderResponse response = (RenderResponse) this.response; + PortletURL portletURL = response.createRenderURL(); + + Enumeration<String> paramNames = bridgeUrl.getParameterNames(); + while(paramNames.hasMoreElements()) { + String param = paramNames.nextElement(); + if(Bridge.PORTLET_MODE_PARAMETER.equals(param)) { + PortletMode portletMode = new PortletMode(bridgeUrl.getParameter(param)); + try { + portletURL.setPortletMode(portletMode); + } catch (PortletModeException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000052", portletMode); + } + } else if(Bridge.PORTLET_WINDOW_STATE_PARAMETER.equals(param)) { + WindowState windowState = new WindowState(bridgeUrl.getParameter(param)); + try { + portletURL.setWindowState(windowState); + } catch (WindowStateException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000053", windowState); + } + } else if(Bridge.PORTLET_SECURE_PARAMETER.equals(param)) { + boolean secure = Boolean.parseBoolean(bridgeUrl.getParameter(param)); + try { + portletURL.setSecure(secure); + } catch (PortletSecurityException e) { + // do nothing as per spec + logger.log(Level.WARNING, "J4P_000054", secure); + } + } else { + portletURL.setParameter(param, bridgeUrl.getParameterValues(param)); + } + } + + result = portletURL.toString(); + } } } } - System.out.println("URL: " + bridgeUrl); if(result == null) { result = response.encodeURL(bridgeUrl.toString()); } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextFactoryImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextFactoryImpl.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextFactoryImpl.java 2008-06-19 16:20:33 UTC (rev 41) @@ -28,7 +28,7 @@ import javax.portlet.PortletRequest; import javax.portlet.PortletResponse; -public class FacesContextFactoryImpl extends FacesContextFactory { +public final class FacesContextFactoryImpl extends FacesContextFactory { private FacesContextFactory delegate = null; Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java 2008-06-19 16:20:33 UTC (rev 41) @@ -21,11 +21,13 @@ package net.sf.jsf4portlets.context; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ResourceBundle; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -57,7 +59,7 @@ * a portlet environment.</p> */ -public final class FacesContextImpl extends FacesContext { +final class FacesContextImpl extends FacesContext { // -------------------------------------------------------- Static Variables @@ -116,6 +118,7 @@ @Override public Iterator<String> getClientIdsWithMessages() { + assertNotReleased(); return (messages.keySet().iterator()); } @@ -143,8 +146,19 @@ } @Override + @SuppressWarnings("unchecked") public Iterator<FacesMessage> getMessages() { assertNotReleased(); + + // Workaround Faces' RI to avoid the warning message + // about pending messages. + Map<String, Object> requestMap = getExternalContext().getRequestMap(); + Set<String> pendingClientIds = (Set) requestMap.get( + "com.sun.faces.clientIdMessagesNotDisplayed"); + if(pendingClientIds != null && !pendingClientIds.isEmpty()) { + pendingClientIds.clear(); + } + List<FacesMessage> results = new ArrayList<FacesMessage>(); Iterator<String> clientIds = messages.keySet().iterator(); while (clientIds.hasNext()) { @@ -248,11 +262,22 @@ } @Override + @SuppressWarnings("unchecked") public Iterator<FacesMessage> getMessages(String clientId) { assertNotReleased(); + + // Workaround Faces' RI to avoid the warning message + // about pending messages. + Map<String, Object> requestMap = getExternalContext().getRequestMap(); + Set<String> pendingClientIds = (Set) requestMap.get( + "com.sun.faces.clientIdMessagesNotDisplayed"); + if(pendingClientIds != null && !pendingClientIds.isEmpty()) { + pendingClientIds.remove(clientId); + } + List<FacesMessage> list = messages.get(clientId); if (list == null) { - list = new ArrayList<FacesMessage>(); + list = Collections.<FacesMessage>emptyList(); } return (list.iterator()); } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2008-06-19 16:20:33 UTC (rev 41) @@ -35,7 +35,6 @@ import net.sf.jsf4portlets.BridgeConstants; import net.sf.jsf4portlets.util.Util; -import net.sf.jsf4portlets.vendor.GenericInjectionProvider; /** * @author A. Alonso Domínguez @@ -48,6 +47,9 @@ private static final String[] EMPTY_ARRAY = new String[0]; + private static final String INJECTION_PROVIDER_INSTANCE = + "net.sf.jsf4portlets.injection_provider.INSTANCE"; + private static final String INJECTION_PROVIDER_PROPERTY = "net.sf.jsf4portlets.injection_provider"; @@ -59,16 +61,21 @@ "net.sf.jsf4portlets.LogMessages"); public static InjectionProvider createInstance(PortletContext portletContext) { - String providerClass = findProviderClass(portletContext); - InjectionProvider provider = getProviderInstance(providerClass, portletContext); - if(provider.getClass() != NoopInjectionProvider.class) { - if(logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "J4P_000037", providerClass); + InjectionProvider provider = (InjectionProvider) portletContext + .getAttribute(INJECTION_PROVIDER_INSTANCE); + if(provider == null) { + String providerClass = findProviderClass(portletContext); + provider = getProviderInstance(providerClass, portletContext); + if(provider.getClass() != NoopInjectionProvider.class) { + if(logger.isLoggable(Level.FINE)) { + logger.log(Level.FINE, "J4P_000037", providerClass); + } + } else { + if(logger.isLoggable(Level.FINE)) { + logger.log(Level.FINE, "J4P_000038"); + } } - } else { - if(logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "J4P_000038"); - } + portletContext.setAttribute(INJECTION_PROVIDER_INSTANCE, provider); } return provider; } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java 2008-06-19 16:20:33 UTC (rev 41) @@ -23,7 +23,6 @@ import javax.faces.context.ExternalContext; import javax.portlet.PortletConfig; -import net.sf.jsf4portlets.util.DefaultPortletURLEncoder; import net.sf.jsf4portlets.util.Util; public final class PortletURLEncoderFactory { Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/BridgeURL.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/BridgeURL.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/BridgeURL.java 2008-06-19 16:20:33 UTC (rev 41) @@ -115,12 +115,11 @@ bridgeUrl.contextPath = context.getRequestContextPath(); processPath = processPath.substring(bridgeUrl.contextPath.length()); } - System.out.println("Context-Path: " + bridgeUrl.contextPath); if(processPath.length() > 0) { int idx = processPath.indexOf("?"); if(idx != -1) { - bridgeUrl.setPath(processPath.substring(0, idx - 1)); + bridgeUrl.setPath(processPath.substring(0, idx)); processPath = processPath.substring(idx + 1); } else { bridgeUrl.setPath(processPath); @@ -133,7 +132,7 @@ String name, value; idx = token.indexOf('='); if(idx > -1) { - name = token.substring(0, idx - 1); + name = token.substring(0, idx); value = token.substring(idx + 1); } else { name = token; Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/URLUtil.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/URLUtil.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/URLUtil.java 2008-06-19 16:20:33 UTC (rev 41) @@ -31,7 +31,7 @@ * @author alonso * */ -public final class URLUtil { +final class URLUtil { public static String getExtensionMapping(String viewId) { int i = viewId.indexOf("?"); Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java 2008-06-19 16:20:33 UTC (rev 41) @@ -21,6 +21,7 @@ package net.sf.jsf4portlets.vendor; import net.sf.jsf4portlets.spi.ContainerInjectionProvider; +import net.sf.jsf4portlets.spi.GenericInjectionProvider; import net.sf.jsf4portlets.spi.InjectionProviderException; import org.mortbay.jetty.plus.annotation.LifeCycleCallbackCollection; Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java 2008-06-19 16:20:33 UTC (rev 41) @@ -23,6 +23,7 @@ import javax.portlet.PortletContext; import net.sf.jsf4portlets.spi.ContainerInjectionProvider; +import net.sf.jsf4portlets.spi.GenericInjectionProvider; import net.sf.jsf4portlets.spi.InjectionProviderException; import org.apache.AnnotationProcessor; Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/pom.xml 2008-06-19 16:20:33 UTC (rev 41) @@ -1,3 +1,27 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2008 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -91,6 +115,10 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> </plugin> <plugin> <groupId>net.sourceforge.maven-taglib</groupId> @@ -99,6 +127,10 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> </plugin> </plugins> </reporting> Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,6 @@ */ package net.sf.jsf4portlets.event; -import java.util.Enumeration; import java.util.Queue; import java.util.logging.Level; import java.util.logging.Logger; @@ -34,8 +33,9 @@ import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; -import net.sf.jsf4portlets.config.ApplicationConfiguration; -import net.sf.jsf4portlets.config.ManagedBeanImpl; +import net.sf.jsf4portlets.config.Configuration; +import net.sf.jsf4portlets.config.ConfigurationFactory; +import net.sf.jsf4portlets.config.ManagedBean; import net.sf.jsf4portlets.util.Util; public class EventPhaseListener implements PhaseListener { @@ -82,12 +82,9 @@ private void broadcastEvent(FacesContext context, PortletEvent event) throws FacesException { - ApplicationConfiguration appConf = ApplicationConfiguration - .getInstance(context.getExternalContext()); - Enumeration<String> names = appConf.getManagedBeanNames(); - while(names.hasMoreElements()) { - String beanName = names.nextElement(); - ManagedBeanImpl managedBean = appConf.getManagedBean(beanName); + Configuration appConf = ConfigurationFactory + .getConfiguration(context.getExternalContext()); + for(ManagedBean managedBean : appConf.getManagedBeans()) { Class<?> beanClass; try { beanClass = Util.loadClass(managedBean.getClassName(), this); @@ -96,12 +93,13 @@ } if(PortletListener.class.isAssignableFrom(beanClass)) { - Object bean = resolveManagedBean(context, beanName, beanClass); + Object bean = resolveManagedBean(context, + managedBean.getName(), beanClass); assert bean != null; if(logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "J4PE_000002", new Object[]{ - event.getEventName(), beanName + event.getEventName(), managedBean.getName() }); } ((PortletListener) bean).processPortlet(event); Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ /* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - * Copyright (C) 2007 A. Alonso Dominguez + * Copyright (C) 2008 A. Alonso Dominguez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2008-06-19 16:20:33 UTC (rev 41) @@ -2,7 +2,7 @@ <!-- JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - Copyright (C) 2007 A. Alonso Dominguez + Copyright (C) 2008 A. Alonso Dominguez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Modified: trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties 2008-06-19 16:20:33 UTC (rev 41) @@ -1,5 +1,5 @@ # JSF 4 Portlets - JSF Portlet Bridge (JSR-301) -# Copyright (C) 2007 A. Alonso Dominguez +# Copyright (C) 2008 A. Alonso Dominguez # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/pom.xml 2008-06-19 16:20:33 UTC (rev 41) @@ -1,3 +1,27 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2008 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -72,13 +96,19 @@ <layout>default</layout> </snapshotRepository> </distributionManagement> - + <repositories> <repository> - <id>java.net</id> + <id>maven1-java.net</id> + <name>Java.NET Maven 1 Repository</name> <url>http://download.java.net/maven/1</url> <layout>legacy</layout> </repository> + <repository> + <id>maven2-java.net</id> + <name>Java.NET Maven 2 Repository</name> + <url>http://download.java.net/maven/2</url> + </repository> </repositories> <modules> @@ -98,6 +128,14 @@ <target>1.5</target> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <configuration> + <downloadSources>true</downloadSources> + <downloadJavadocs>true</downloadJavadocs> + </configuration> + </plugin> </plugins> </pluginManagement> <plugins> @@ -122,16 +160,19 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <aggregate>true</aggregate> + </configuration> </plugin> <plugin> <groupId>net.sourceforge.maven-taglib</groupId> <artifactId>maven-taglib-plugin</artifactId> </plugin> - <!--<plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> - </plugin>--> + </plugin> </plugins> </reporting> Modified: trunk/src/site/apt/release_notes.apt =================================================================== --- trunk/src/site/apt/release_notes.apt 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/src/site/apt/release_notes.apt 2008-06-19 16:20:33 UTC (rev 41) @@ -1,6 +1,6 @@ ~~ ~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) -~~ Copyright (C) 2007 A. Alonso Dominguez +~~ Copyright (C) 2008 A. Alonso Dominguez ~~ ~~ This library is free software; you can redistribute it and/or ~~ modify it under the terms of the GNU Lesser General Public @@ -21,3 +21,11 @@ ~~ JSF 4 Portlets - Release Notes + + This is an implementation of the Early Draft 3 for JSR-301. + + This library is in <<alpha>> state, so API changes can come up without +notification. Use it by your own risk. + + The specification is currently an Early Draft, so some features may not +be available. Modified: trunk/src/site/apt/user_docs.apt =================================================================== --- trunk/src/site/apt/user_docs.apt 2008-06-18 18:20:39 UTC (rev 40) +++ trunk/src/site/apt/user_docs.apt 2008-06-19 16:20:33 UTC (rev 41) @@ -1,6 +1,6 @@ ~~ ~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) -~~ Copyright (C) 2007 A. Alonso Dominguez +~~ Copyright (C) 2008 A. Alonso Dominguez ~~ ~~ This library is free software; you can redistribute it and/or ~~ modify it under the terms of the GNU Lesser General Public @@ -80,7 +80,7 @@ <portlet-app ...> <portlet> - <portlet-name>MyFacesPortlet</portlet-name> + <portlet-name>WelcomeFacesPortlet</portlet-name> <portlet-class> javax.portlet.faces.GenericFacesPortlet </portlet-class> @@ -104,15 +104,6 @@ If you want to configure this two features to every portlet in the same web application you must set the following in your <<<WEB-INF/web.xml>>> file. You can also specify these parameters in the <<<WEB-INF/portlet.xml>>> file as portlet init parameters. -*** Performing redirects againts the portal page: - -+--- -<context-param> - <param-name>javax.portlet.faces.ENCODE_REDIRECT_URL</param-name> - <param-value>true</param-value> -</context-param> -+--- - *** Preserving action parameters This attribute is used when we need access the portlet parameters which caused the current view to be rendered during the render phase. This parameters can be accessed using EL expressions like <<<#\{param.[param_name]\}>>>. @@ -154,7 +145,7 @@ +--- <filter> <filter-name>Faces Portlet Render Filter</filter-name> - <filter-class>javax.portlet.faces.BridgeRenderFilter</filter-class> + <filter-class>net.sf.jsf4portlets.BridgeRenderFilter</filter-class> </filter> <filter-mapping> @@ -204,4 +195,4 @@ <name>javax.portlet.faces.defaultViewId.[custom_portlet_mode]</name> <value>/custom.jsf</value> </init-param> -+--- \ No newline at end of file ++--- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2008-06-13 16:08:10
|
Revision: 39 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=39&view=rev Author: alonsoft Date: 2008-06-13 09:08:04 -0700 (Fri, 13 Jun 2008) Log Message: ----------- Restructuracion - ED3 Modified Paths: -------------- trunk/jsf4portlets-ext/pom.xml trunk/pom.xml Added Paths: ----------- trunk/jsf4portlets/ trunk/jsf4portlets/pom.xml trunk/jsf4portlets/src/ trunk/jsf4portlets/src/main/ trunk/jsf4portlets/src/main/java/ trunk/jsf4portlets/src/main/java/javax/ trunk/jsf4portlets/src/main/java/javax/portlet/ trunk/jsf4portlets/src/main/java/net/ trunk/jsf4portlets/src/main/java/net/sf/ trunk/jsf4portlets/src/main/resources/ trunk/jsf4portlets/src/main/resources/META-INF/ trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd trunk/jsf4portlets/src/main/resources/META-INF/services/ trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider trunk/jsf4portlets/src/main/resources/net/ trunk/jsf4portlets/src/main/resources/net/sf/ trunk/jsf4portlets/src/site/ trunk/jsf4portlets/src/site/site.xml Removed Paths: ------------- trunk/jsf4portlets/src/main/java/javax/portlet/ trunk/jsf4portlets/src/main/java/net/sf/ trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider trunk/jsf4portlets/src/main/resources/net/sf/ trunk/jsf4portlets/src/site/site.xml trunk/jsf4portlets-api/ trunk/jsf4portlets-impl/ Copied: trunk/jsf4portlets/pom.xml (from rev 36, trunk/jsf4portlets-impl/pom.xml) =================================================================== --- trunk/jsf4portlets/pom.xml (rev 0) +++ trunk/jsf4portlets/pom.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,97 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-3-SNAPSHOT</version> + </parent> + + <artifactId>jsf4portlets-impl</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets Impl</name> + + <description> + This is the main module of JSF 4 Portlets. This module brings an implementation of + the JSF Portlet Bridge (JSR-301) which allows JSR-168 Portlets running as JSF applications. + </description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>catalina</artifactId> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-plus</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + </plugins> + </reporting> + +</project> Copied: trunk/jsf4portlets/src/main/java/javax (from rev 36, trunk/jsf4portlets-api/src/main/java/javax) Copied: trunk/jsf4portlets/src/main/java/javax/portlet (from rev 38, trunk/jsf4portlets-api/src/main/java/javax/portlet) Copied: trunk/jsf4portlets/src/main/java/net (from rev 36, trunk/jsf4portlets-impl/src/main/java/net) Copied: trunk/jsf4portlets/src/main/java/net/sf (from rev 38, trunk/jsf4portlets-impl/src/main/java/net/sf) Copied: trunk/jsf4portlets/src/main/resources/META-INF (from rev 36, trunk/jsf4portlets-api/src/main/resources/META-INF) Deleted: trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF =================================================================== --- trunk/jsf4portlets-api/src/main/resources/META-INF/MANIFEST.MF 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF 2008-06-13 16:08:04 UTC (rev 39) @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Archiver-Version: Plexus Archiver -Built-By: A. Alonso Dominguez -Build-Jdk: jdk 1.5 -Specification-Title: Portlet 1.0 Bridge for Java Server Faces 1.2 -Specification-Version: 1.0.0ed3 -Implementation-Title: JSF 4 Portlets -Implementation-Version: 1.0-alpha-3 -Implementation-Vendor: SourceForge.net \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF (from rev 38, trunk/jsf4portlets-api/src/main/resources/META-INF/MANIFEST.MF) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/MANIFEST.MF 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Archiver-Version: Plexus Archiver +Built-By: A. Alonso Dominguez +Build-Jdk: jdk 1.5 +Specification-Title: Portlet 1.0 Bridge for Java Server Faces 1.2 +Specification-Version: 1.0.0ed3 +Implementation-Title: JSF 4 Portlets +Implementation-Version: 1.0-alpha-3 +Implementation-Vendor: SourceForge.net \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml (from rev 36, trunk/jsf4portlets-impl/src/main/resources/META-INF/faces-config.xml) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2008 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<faces-config xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:bridge="http://jsf4portlets.sf.net/jsfportlet" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd + http://jsf4portlets.sf.net/jsfportlet http://jsf4portlets.sf.net/xml/ns/portlet1.0_bridge_faces1.2_faces-config-extension.xsd" + version="1.2"> + + <lifecycle> + <phase-listener> + net.sf.jsf4portlets.application.BridgeLifecycleListener + </phase-listener> + </lifecycle> + + <application> + <view-handler> + net.sf.jsf4portlets.application.ViewHandlerImpl + </view-handler> + <state-manager> + net.sf.jsf4portlets.application.StateManagerImpl + </state-manager> + <el-resolver> + javax.portlet.faces.el.PortletELResolver + </el-resolver> + <application-extension> + <bridge:excluded-attributes> + <bridge:excluded-attribute> + com.sun.faces.* + </bridge:excluded-attribute> + <bridge:excluded-attribute> + net.sf.jsf4portlets.* + </bridge:excluded-attribute> + </bridge:excluded-attributes> + </application-extension> + </application> + +</faces-config> \ No newline at end of file Deleted: trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd =================================================================== --- trunk/jsf4portlets-api/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd 2008-06-13 16:08:04 UTC (rev 39) @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - Copyright (C) 2008 A. Alonso Dominguez - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - A. Alonso Dominguez - alo...@us... ---> - -<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" - targetNamespace="http://jsf4portlets.sf.net/jsfportlet" id="bridge" - xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - <xs:element name="excluded-attributes"> - <xs:annotation> - <xs:documentation> - </xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence> - <xs:element name="excluded-attribute" type="xs:string" - minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:documentation> - </xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - -</xs:schema> \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd (from rev 38, trunk/jsf4portlets-api/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/portlet1.0_bridge_faces1.2_faces-config-extension.xsd 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2008 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" + targetNamespace="http://jsf4portlets.sf.net/jsfportlet" id="bridge" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="excluded-attributes"> + <xs:annotation> + <xs:documentation> + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="excluded-attribute" type="xs:string" + minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + +</xs:schema> \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/services (from rev 36, trunk/jsf4portlets-impl/src/main/resources/META-INF/services) Deleted: trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory =================================================================== --- trunk/jsf4portlets-impl/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory 2008-06-13 16:08:04 UTC (rev 39) @@ -1 +0,0 @@ -net.sf.jsf4portlets.context.FacesContextFactoryImpl \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory (from rev 38, trunk/jsf4portlets-impl/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/javax.faces.context.FacesContextFactory 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1 @@ +net.sf.jsf4portlets.context.FacesContextFactoryImpl \ No newline at end of file Deleted: trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge =================================================================== --- trunk/jsf4portlets-impl/src/main/resources/META-INF/services/javax.portlet.faces.Bridge 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge 2008-06-13 16:08:04 UTC (rev 39) @@ -1 +0,0 @@ -net.sf.jsf4portlets.BridgeImpl \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge (from rev 38, trunk/jsf4portlets-impl/src/main/resources/META-INF/services/javax.portlet.faces.Bridge) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/javax.portlet.faces.Bridge 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1 @@ +net.sf.jsf4portlets.BridgeImpl \ No newline at end of file Deleted: trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider =================================================================== --- trunk/jsf4portlets-impl/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2008-06-13 16:08:04 UTC (rev 39) @@ -1,2 +0,0 @@ -net.sf.jsf4portlets.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor -net.sf.jsf4portlets.vendor.Jetty6InjectionProvider:org.mortbay.jetty.annotation.LifeCycleCallbackCollection \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider (from rev 38, trunk/jsf4portlets-impl/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider) =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,2 @@ +net.sf.jsf4portlets.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor +net.sf.jsf4portlets.vendor.Jetty6InjectionProvider:org.mortbay.jetty.annotation.LifeCycleCallbackCollection \ No newline at end of file Copied: trunk/jsf4portlets/src/main/resources/net (from rev 36, trunk/jsf4portlets-impl/src/main/resources/net) Copied: trunk/jsf4portlets/src/main/resources/net/sf (from rev 38, trunk/jsf4portlets-impl/src/main/resources/net/sf) Copied: trunk/jsf4portlets/src/site (from rev 36, trunk/jsf4portlets-impl/src/site) Deleted: trunk/jsf4portlets/src/site/site.xml =================================================================== --- trunk/jsf4portlets-impl/src/site/site.xml 2008-06-10 21:17:17 UTC (rev 36) +++ trunk/jsf4portlets/src/site/site.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - Copyright (C) 2007 A. Alonso Dominguez - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - A. Alonso Dominguez - alo...@us... ---> - -<project name="JSF 4 Portlets Core"> - <bannerLeft> - <name>SourceForge.net Logo</name> - <src>http://sflogo.sourceforge.net/sflogo.php?group_id=196120&type=5</src> - <href>http://www.sourceforge.net</href> - </bannerLeft> - <bannerRight> - <name>JSF 4 Portlets</name> - <href>http://jsf4portlets.sf.net</href> - </bannerRight> - - <body> - <links> - <item name="JSF 4 Portlets" href="http://jsf4portlets.sf.net" /> - <item name="SF Project Page" href="http://sf.net/projects/jsf4portlets" /> - <item name="JSR-301" href="http://jcp.org/en/jsr/detail?id=301" /> - </links> - - <menu name="Main Menu"> - <item name="Overview" href="index.html" /> - <item name="License" href="license.html" /> - </menu> - - <menu ref="reports" /> - </body> -</project> \ No newline at end of file Copied: trunk/jsf4portlets/src/site/site.xml (from rev 38, trunk/jsf4portlets-impl/src/site/site.xml) =================================================================== --- trunk/jsf4portlets/src/site/site.xml (rev 0) +++ trunk/jsf4portlets/src/site/site.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2007 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<project name="JSF 4 Portlets Core"> + <bannerLeft> + <name>SourceForge.net Logo</name> + <src>http://sflogo.sourceforge.net/sflogo.php?group_id=196120&type=5</src> + <href>http://www.sourceforge.net</href> + </bannerLeft> + <bannerRight> + <name>JSF 4 Portlets</name> + <href>http://jsf4portlets.sf.net</href> + </bannerRight> + + <body> + <links> + <item name="JSF 4 Portlets" href="http://jsf4portlets.sf.net" /> + <item name="SF Project Page" href="http://sf.net/projects/jsf4portlets" /> + <item name="JSR-301" href="http://jcp.org/en/jsr/detail?id=301" /> + </links> + + <menu name="Main Menu"> + <item name="Overview" href="index.html" /> + <item name="License" href="license.html" /> + </menu> + + <menu ref="reports" /> + </body> +</project> \ No newline at end of file Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2008-06-11 23:47:09 UTC (rev 38) +++ trunk/jsf4portlets-ext/pom.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -55,8 +55,7 @@ </dependency> <dependency> <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets-impl</artifactId> - <version>${pom.version}</version> + <artifactId>jsf4portlets</artifactId> </dependency> <dependency> @@ -105,4 +104,4 @@ </plugins> </reporting> -</project> \ No newline at end of file +</project> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-06-11 23:47:09 UTC (rev 38) +++ trunk/pom.xml 2008-06-13 16:08:04 UTC (rev 39) @@ -82,8 +82,7 @@ </repositories> <modules> - <module>jsf4portlets-api</module> - <module>jsf4portlets-impl</module> + <module>jsf4portlets</module> <module>jsf4portlets-ext</module> </modules> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2008-06-11 23:44:06
|
Revision: 37 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=37&view=rev Author: alonsoft Date: 2008-06-11 16:44:02 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Added pom.xml Added Paths: ----------- trunk/jsf4portlets-api/pom.xml Added: trunk/jsf4portlets-api/pom.xml =================================================================== --- trunk/jsf4portlets-api/pom.xml (rev 0) +++ trunk/jsf4portlets-api/pom.xml 2008-06-11 23:44:02 UTC (rev 37) @@ -0,0 +1,66 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-3-SNAPSHOT</version> + </parent> + + <artifactId>jsf4portlets-api</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets API</name> + + <description> + This is the main module of JSF 4 Portlets. This module brings an implementation of + the JSF Portlet Bridge (JSR-301) which allows JSR-168 Portlets running as JSF applications. + </description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-10-21 11:32:17
|
Revision: 35 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=35&view=rev Author: alonsoft Date: 2007-10-21 04:31:56 -0700 (Sun, 21 Oct 2007) Log Message: ----------- Modified for future version Modified Paths: -------------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java trunk/jsf4portlets-ext/pom.xml trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java trunk/jsf4portlets-ext/src/site/site.xml trunk/pom.xml Added Paths: ----------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoder.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/DefaultPortletURLEncoder.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java trunk/jsf4portlets-ext/src/site/apt/portlet_events.apt Removed Paths: ------------- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-10-21 11:31:56 UTC (rev 35) @@ -26,7 +26,13 @@ import java.net.MalformedURLException; import java.net.URL; import java.security.Principal; -import java.util.*; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; @@ -41,11 +47,11 @@ import javax.portlet.PortletRequest; import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletResponse; -import javax.portlet.PortletURL; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; -import javax.portlet.faces.*; -import javax.portlet.faces.Bridge.*; +import javax.portlet.faces.Bridge; +import javax.portlet.faces.BridgeDefaultViewNotSpecifiedException; +import javax.portlet.faces.Bridge.PortletPhase; import net.sf.jsf4portlets.BridgeConstants; import net.sf.jsf4portlets.RequestScope; @@ -55,6 +61,8 @@ import net.sf.jsf4portlets.spi.InjectionProvider; import net.sf.jsf4portlets.spi.InjectionProviderException; import net.sf.jsf4portlets.spi.InjectionProviderFactory; +import net.sf.jsf4portlets.spi.PortletURLEncoder; +import net.sf.jsf4portlets.spi.PortletURLEncoderFactory; import net.sf.jsf4portlets.util.PathString; import net.sf.jsf4portlets.util.Util; @@ -153,67 +161,8 @@ @Override public String encodeActionURL(String url) { - logger.entering(ExternalContextImpl.class.getName(), "encodeActionURL", url); - if (url == null) { - throw new NullPointerException(); - } - if(!url.startsWith("#") && (url.startsWith("/") - && !url.startsWith(getRequestContextPath()))) { - logger.exiting(ExternalContext.class.getName(), "encodeActionURL", url); - return url; - } - - PathString qs = PathString.parse(this, url); - String directLink = qs.getParameter(Bridge.DIRECT_LINK); - if(directLink != null) { - if("true".equals(directLink)) { - logger.exiting(ExternalContext.class.getName(), "encodeActionURL", qs); - return qs.toString(); - } else { - qs.removeParameter(Bridge.DIRECT_LINK); - } - } - - String viewId = null; - if(qs.getContextPath().equals(getRequestContextPath())) { - ApplicationConfiguration config = - ApplicationConfiguration.getInstance(this); - String mapping = config.getFacesMapping(); - if(Util.isPrefixMapped(mapping)) { - int slash = mapping.lastIndexOf("/"); - String prefix = mapping.substring(0, slash); - if(qs.getPath().startsWith(prefix)) { - viewId = qs.getPath().substring(slash); - } - } - } - if(viewId == null) { - viewId = qs.getPath(); - } - if(!viewId.startsWith("/")) { - viewId = "/" + viewId; - } - if(logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "J4P_000023", viewId); - } - - String result = null; - PortletPhase phase = Util.getPortletLifecyclePhase(this); - if(PortletPhase.RenderPhase.equals(phase)) { - RenderResponse response = (RenderResponse) getResponse(); - PortletURL portletURL = response.createActionURL(); - portletURL.setParameters(qs.getParameterMap()); - portletURL.setParameter(BridgeConstants.VIEW_ID_PARAMETER, viewId); - result = portletURL.toString(); - } else if(PortletPhase.ActionPhase.equals(phase)) { - RequestScope requestScope = Util.getRequestScope(this); - requestScope.setParameters(qs.getParameterMap()); - result = viewId; - } else { - throw new IllegalStateException(); - } - logger.exiting(ExternalContext.class.getName(), "encodeActionURL", result); - return result; + PortletURLEncoder encoder = PortletURLEncoderFactory.getEncoder(this); + return encoder.encodeActionURL(this, url); } @Override @@ -226,16 +175,8 @@ @Override public String encodeResourceURL(String url) { - if(url == null) { - throw new NullPointerException(); - } - - if(!url.startsWith("http") && !url.startsWith("https") - && !(url.startsWith("/"))) { - url = getRequestContextPath() + "/" + url; - } - - return (response.encodeURL(url)); + PortletURLEncoder encoder = PortletURLEncoderFactory.getEncoder(this); + return encoder.encodeResourceURL(this, url); } @Override Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoder.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoder.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoder.java 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,31 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.spi; + +import javax.faces.context.ExternalContext; + +public interface PortletURLEncoder { + + public String encodeActionURL(ExternalContext context, String url); + + public String encodeResourceURL(ExternalContext context, String url); + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/PortletURLEncoderFactory.java 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,49 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.spi; + +import javax.faces.context.ExternalContext; +import javax.portlet.PortletConfig; + +import net.sf.jsf4portlets.util.DefaultPortletURLEncoder; +import net.sf.jsf4portlets.util.Util; + +public final class PortletURLEncoderFactory { + + private static final PortletURLEncoder DEFAULT_ENCODER = + new DefaultPortletURLEncoder(); + + public static final String ENCODER_ATTR_PREFIX = + "javax.portlet.faces.extension.encoder."; + + public static PortletURLEncoder getEncoder(ExternalContext context) { + PortletConfig portletConfig = Util.getPortletConfig(context); + PortletURLEncoder instance = (PortletURLEncoder) context.getApplicationMap().get( + ENCODER_ATTR_PREFIX + portletConfig.getPortletName()); + if(instance == null) { + instance = DEFAULT_ENCODER; + } + return instance; + } + + private PortletURLEncoderFactory() { } + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/DefaultPortletURLEncoder.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/DefaultPortletURLEncoder.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/DefaultPortletURLEncoder.java 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,118 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.util; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.faces.context.ExternalContext; +import javax.portlet.PortletResponse; +import javax.portlet.PortletURL; +import javax.portlet.RenderResponse; +import javax.portlet.faces.Bridge; +import javax.portlet.faces.Bridge.PortletPhase; + +import net.sf.jsf4portlets.BridgeConstants; +import net.sf.jsf4portlets.RequestScope; +import net.sf.jsf4portlets.config.ApplicationConfiguration; +import net.sf.jsf4portlets.spi.PortletURLEncoder; + +public class DefaultPortletURLEncoder implements PortletURLEncoder { + + private final Logger logger = Logger.getLogger( + DefaultPortletURLEncoder.class.getPackage().getName(), + "net.sf.jsf4portlets.LogMessages"); + + public String encodeActionURL(ExternalContext context, String url) { + if (url == null) { + throw new NullPointerException(); + } + if(!url.startsWith("#") && (url.startsWith("/") + && !url.startsWith(context.getRequestContextPath()))) { + return url; + } + + PathString qs = PathString.parse(context, url); + String directLink = qs.getParameter(Bridge.DIRECT_LINK); + if(directLink != null) { + if("true".equals(directLink)) { + return qs.toString(); + } else { + qs.removeParameter(Bridge.DIRECT_LINK); + } + } + + String viewId = null; + if(qs.getContextPath().equals(context.getRequestContextPath())) { + ApplicationConfiguration config = + ApplicationConfiguration.getInstance(context); + String mapping = config.getFacesMapping(); + if(Util.isPrefixMapped(mapping)) { + int slash = mapping.lastIndexOf("/"); + String prefix = mapping.substring(0, slash); + if(qs.getPath().startsWith(prefix)) { + viewId = qs.getPath().substring(slash); + } + } + } + if(viewId == null) { + viewId = qs.getPath(); + } + if(!viewId.startsWith("/")) { + viewId = "/" + viewId; + } + if(logger.isLoggable(Level.FINER)) { + logger.log(Level.FINER, "J4P_000023", viewId); + } + + String result = null; + PortletPhase phase = Util.getPortletLifecyclePhase(context); + if(PortletPhase.RenderPhase.equals(phase)) { + RenderResponse response = (RenderResponse) context.getResponse(); + PortletURL portletURL = response.createActionURL(); + portletURL.setParameters(qs.getParameterMap()); + portletURL.setParameter(BridgeConstants.VIEW_ID_PARAMETER, viewId); + result = portletURL.toString(); + } else if(PortletPhase.ActionPhase.equals(phase)) { + RequestScope requestScope = Util.getRequestScope(context); + requestScope.setParameters(qs.getParameterMap()); + result = viewId; + } else { + throw new IllegalStateException(); + } + return result; + } + + public String encodeResourceURL(ExternalContext context, String url) { + if(url == null) { + throw new NullPointerException(); + } + + if(!url.startsWith("http") && !url.startsWith("https") + && !(url.startsWith("/"))) { + url = context.getRequestContextPath() + "/" + url; + } + + PortletResponse response = (PortletResponse) context.getResponse(); + return (response.encodeURL(url)); + } + +} Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/pom.xml 2007-10-21 11:31:56 UTC (rev 35) @@ -70,6 +70,11 @@ <artifactId>portletappengine</artifactId> <groupId>com.sun.portal.portletcontainer</groupId> </dependency> + + <dependency> + <groupId>jsf-extensions</groupId> + <artifactId>jsf-extensions-run-time</artifactId> + </dependency> <dependency> <groupId>junit</groupId> Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java 2007-10-21 11:31:56 UTC (rev 35) @@ -1,3 +1,23 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ package net.sf.jsf4portlets.event; import java.util.LinkedList; Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java 2007-10-21 11:31:56 UTC (rev 35) @@ -1,3 +1,23 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ package net.sf.jsf4portlets.event; import java.util.Enumeration; @@ -75,7 +95,7 @@ throw new FacesException(e); } - if(PortletEventListener.class.isAssignableFrom(beanClass)) { + if(PortletListener.class.isAssignableFrom(beanClass)) { Object bean = resolveManagedBean(context, beanName, beanClass); assert bean != null; @@ -84,7 +104,7 @@ event.getEventName(), beanName }); } - ((PortletEventListener) bean).handleEvent(event); + ((PortletListener) bean).processPortlet(event); } } } Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java 2007-10-21 11:31:56 UTC (rev 35) @@ -1,3 +1,23 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ package net.sf.jsf4portlets.event; import java.util.EventObject; @@ -4,6 +24,14 @@ import javax.portlet.Portlet; +/** + * Representation of the event information received + * by the portlet and broadcasted to the application + * managed beans + * + * @author A. Alonso Domínguez + * + */ public class PortletEvent extends EventObject { private String eventName; @@ -15,14 +43,30 @@ this.eventData = eventData; } + /** + * Obtains the portlet which received the event + * + * @return the portlet which received the event + */ public Portlet getPortlet() { return (Portlet) super.getSource(); } + /** + * Obtains the event name + * + * @return the event name + */ public String getEventName() { return eventName; } + /** + * Obtains the object which represents the + * event data + * + * @return the event data + */ public Object getEventData() { return eventData; } Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventHelper.java 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,59 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.event; + +import java.io.Serializable; + +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import javax.portlet.PortletRequest; + +import com.sun.portal.portletappengine.ipc.EventNotRegisteredException; +import com.sun.portal.portletappengine.ipc.PortletEventBroker; + +public final class PortletEventHelper { + + private FacesContext context; + + public PortletEventHelper(FacesContext context) { + this.context = context; + } + + public void fireEvent(String name, Object data) + throws FacesException { + if(!(data instanceof Serializable)) { + throw new IllegalArgumentException(); + } + + PortletRequest request = (PortletRequest) context + .getExternalContext().getRequest(); + PortletEventBroker broker = new PortletEventBroker(request); + com.sun.portal.portletappengine.ipc.PortletEvent event; + try { + event = broker.createEvent(name); + } catch(EventNotRegisteredException e) { + throw new FacesException(e); + } + event.setEventData((Serializable) data); + event.fire(); + } + +} Deleted: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java 2007-10-21 11:31:56 UTC (rev 35) @@ -1,9 +0,0 @@ -package net.sf.jsf4portlets.event; - -import java.util.EventListener; - -public interface PortletEventListener extends EventListener { - - public void handleEvent(PortletEvent event); - -} Copied: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java (from rev 34, trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java) =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletListener.java 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,29 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.event; + +import java.util.EventListener; + +public interface PortletListener extends EventListener { + + public void processPortlet(PortletEvent event); + +} Modified: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java 2007-10-21 11:31:56 UTC (rev 35) @@ -1,3 +1,23 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ package net.sf.jsf4portlets.facelets; import java.io.IOException; Added: trunk/jsf4portlets-ext/src/site/apt/portlet_events.apt =================================================================== --- trunk/jsf4portlets-ext/src/site/apt/portlet_events.apt (rev 0) +++ trunk/jsf4portlets-ext/src/site/apt/portlet_events.apt 2007-10-21 11:31:56 UTC (rev 35) @@ -0,0 +1,133 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + + --- + JSF 4 Portlets Extensions - Portlet Events + --- + A. Alonso Dominguez + --- + +Inter-Portlet Communication + +* Before Starting + + This is an especial feature on JSR-168 portlets and support for portlet events must be implemented on the portlet container. Currently, JSF 4 Portlets gives support for portlet events if those portlets are deployed with the {{{http://portlet-container.dev.java.net}Open Source Portlet Container}}. + +Event Support + +* Configuring Container + + Firts of all, you must add a file called <<<sun-portlet.xml>>> to the <<<WEB-INF>>> folder inside your portlet application. In that file you must specify which portlets will generate/consume events. Following is an example: + ++--- +<sun-portlet-app> +... + + <portlet> + <portlet-name>Faces Portlet</portlet-name> + ... + + <events> + <generates-event>EventName</generates-event> + + <consume-event>PayOrder</consume-event> + ... + </events> + + </portlet> + +... +</sun-portlet-app> ++--- + + If you need more information you take a look at the following link: {{https://portlet-container.dev.java.net/docs/ipc/IPC.html}}. + +* Configure the EventFacesPortlet + + Once you have configured which events will generate/consume your portlet, you must use a portlet implementation able to listen to portlet events. JSF 4 Portlets gives you one at: <<<net.sf.jsf4portlets.event.EventFacesPortlet>>>. + + Notice that <<<net.sf.jsf4portlets.event.EventFacesPortlet>>> is an extension of <<<javax.portlet.faces.GenericFacesPortlet>>> so it must be configured the same way the faces portlet is configured. You may take a look at the {{{http://jsf4portlets.sf.net/web/user_docs.html}User Documentation}}. Following is an example of how to configure the <<<EventFacesPortlet>>>: + ++--- +<portlet-app> +... + + <portlet> + <portlet-name>Faces Portlet</portlet-name> + <portlet-class> + net.sf.jsf4portlets.event.EventFacesPortlet + </portlet-class> + + ... + </portlet> + +... +</portlet-app> ++--- + +Working with events + +* Generating Events + + Events are generated using a helper class called <<<net.sf.jsf4portlets.event.PortletEventHelper>>>: + ++--- +import ... +import net.sf.jsf4portlets.event.PortletEventHelper + +... + +public class EventGeneratorBean { + + public void actionPerformed(ActionEvent event) { + FacesContext context = FacesContext.getCurrentInstance(); + + // Do action processing + + PortletEventHelper helper = new PortletEventHelper(context); + helper.fireEvent("EventName", eventData); + } + +} ++--- + +* Consuming Events + + Portlet events are received by managed beans just before the <<<RENDER_RESPONSE>>> phase. A managed bean which needs to be aware of portlet events must implement the <<<net.sf.jsf4portlets.event.PortletListener>>> interface. This interface has just a method which is the entry point of the event processing. Following is an example of a managed bean which is aware of portlet events: + ++--- +import ... +import net.sf.jsf4portlets.event.PortletEvent +import net.sf.jsf4portlets.event.PortletListener + +... + +public class EventAwareBean implements PortletListener { + + public void processPortlet(PortletEvent event) { + if("PayOrder".equals(event.getEventName()) { + // Process "PayOrder" bean. + } + } + +} ++--- \ No newline at end of file Modified: trunk/jsf4portlets-ext/src/site/site.xml =================================================================== --- trunk/jsf4portlets-ext/src/site/site.xml 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/jsf4portlets-ext/src/site/site.xml 2007-10-21 11:31:56 UTC (rev 35) @@ -46,7 +46,8 @@ </menu> <menu name="Feature Documentation"> - <item name="Facelets" href="facelets.html" /> + <item name="Facelets" href="facelets.html" /> + <item name="Portlet Events" href="portlet_events.html" /> </menu> <menu ref="reports" /> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-28 18:08:20 UTC (rev 34) +++ trunk/pom.xml 2007-10-21 11:31:56 UTC (rev 35) @@ -72,7 +72,15 @@ <layout>default</layout> </snapshotRepository> </distributionManagement> - + + <repositories> + <repository> + <id>java.net</id> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </repository> + </repositories> + <modules> <module>jsf4portlets</module> <module>jsf4portlets-ext</module> @@ -250,8 +258,16 @@ <scope>provided</scope> <optional>true</optional> </dependency> - + <dependency> + <groupId>jsf-extensions</groupId> + <artifactId>jsf-extensions-run-time</artifactId> + <version>0.1alpha4</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets</artifactId> <version>${pom.version}</version> @@ -267,4 +283,4 @@ </dependencies> </dependencyManagement> -</project> \ No newline at end of file +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-28 18:08:24
|
Revision: 34 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=34&view=rev Author: alonsoft Date: 2007-09-28 11:08:20 -0700 (Fri, 28 Sep 2007) Log Message: ----------- Added event support at extensions module Modified Paths: -------------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java trunk/jsf4portlets-ext/pom.xml trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml trunk/pom.xml Added Paths: ----------- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java trunk/jsf4portlets-ext/src/main/resources/net/ trunk/jsf4portlets-ext/src/main/resources/net/sf/ trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java 2007-09-28 08:59:28 UTC (rev 33) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java 2007-09-28 18:08:20 UTC (rev 34) @@ -60,6 +60,7 @@ PortletContext portletContext = (PortletContext) context.getContext(); result = new ApplicationConfiguration(); result.configure(portletContext); + context.getApplicationMap().put(INSTANCE_KEY, result); } return result; } Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-09-28 08:59:28 UTC (rev 33) +++ trunk/jsf4portlets-ext/pom.xml 2007-09-28 18:08:20 UTC (rev 34) @@ -59,6 +59,19 @@ </dependency> <dependency> + <artifactId>container</artifactId> + <groupId>com.sun.portal.portletcontainer</groupId> + </dependency> + <dependency> + <artifactId>portletcontainer</artifactId> + <groupId>com.sun.portal.portletcontainer</groupId> + </dependency> + <dependency> + <artifactId>portletappengine</artifactId> + <groupId>com.sun.portal.portletcontainer</groupId> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventFacesPortlet.java 2007-09-28 18:08:20 UTC (rev 34) @@ -0,0 +1,56 @@ +package net.sf.jsf4portlets.event; + +import java.util.LinkedList; +import java.util.Queue; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.portlet.PortletSession; +import javax.portlet.faces.GenericFacesPortlet; + +import com.sun.portal.portletappengine.ipc.EventRequest; +import com.sun.portal.portletappengine.ipc.EventResponse; +import com.sun.portal.portletappengine.ipc.PortletEventListener; + +public class EventFacesPortlet extends GenericFacesPortlet +implements PortletEventListener { + + protected static final String QUEUED_EVENTS = + "javax.portlet.faces.extension.QUEUED_EVENTS"; + + private final Logger logger = Logger.getLogger( + EventFacesPortlet.class.getPackage().getName(), + "net.sf.jsf4portlets.ExtLogMessages"); + + public void handleEvent(EventRequest request, EventResponse response) { + Queue<PortletEvent> queue = getEventQueue(request); + PortletEvent event = new PortletEvent(this, + request.getEventName(), request.getEventData()); + queue.add(event); + if(logger.isLoggable(Level.FINER)) { + logger.log(Level.FINER, "J4PE_000001", new Object[]{ + event.getEventName(), getPortletName() + }); + } + } + + /** + * Obtains an event queue from the portlet session scope + * related to the given <code>EventRequest</code>. + * + * @param request the <code>EventRequest</code> + * @return an event queue + */ + @SuppressWarnings("unchecked") + private Queue<PortletEvent> getEventQueue(EventRequest request) { + PortletSession session = request.getPortletSession(true); + Queue<PortletEvent> queue = (Queue<PortletEvent>) session + .getAttribute(QUEUED_EVENTS); + if(queue == null) { + queue = new LinkedList<PortletEvent>(); + session.setAttribute(QUEUED_EVENTS, queue); + } + return queue; + } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/EventPhaseListener.java 2007-09-28 18:08:20 UTC (rev 34) @@ -0,0 +1,107 @@ +package net.sf.jsf4portlets.event; + +import java.util.Enumeration; +import java.util.Queue; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.el.ELException; +import javax.el.ExpressionFactory; +import javax.el.ValueExpression; +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; + +import net.sf.jsf4portlets.config.ApplicationConfiguration; +import net.sf.jsf4portlets.config.ManagedBeanBean; +import net.sf.jsf4portlets.util.Util; + +public class EventPhaseListener implements PhaseListener { + + private final Logger logger = Logger.getLogger( + EventPhaseListener.class.getPackage().getName(), + "net.sf.jsf4portlets.ExtLogMessages"); + + public void afterPhase(PhaseEvent event) { + if(PhaseId.RESTORE_VIEW.equals(event.getPhaseId())) { + FacesContext context = event.getFacesContext(); + broadcast(context); + + context.getExternalContext().getSessionMap() + .remove(EventFacesPortlet.QUEUED_EVENTS); + } + } + + public void beforePhase(PhaseEvent event) { + if(PhaseId.RENDER_RESPONSE.equals(event.getPhaseId())) { + FacesContext context = event.getFacesContext(); + broadcast(context); + + context.getExternalContext().getSessionMap() + .remove(EventFacesPortlet.QUEUED_EVENTS); + } + } + + public PhaseId getPhaseId() { + return PhaseId.ANY_PHASE; + } + + @SuppressWarnings("unchecked") + private void broadcast(FacesContext context) { + Queue<PortletEvent> queue = (Queue<PortletEvent>) context + .getExternalContext().getSessionMap().get(EventFacesPortlet.QUEUED_EVENTS); + if(queue != null) { + PortletEvent event; + while(null != (event = queue.poll())) { + broadcastEvent(context, event); + } + } + } + + private void broadcastEvent(FacesContext context, PortletEvent event) + throws FacesException { + ApplicationConfiguration appConf = ApplicationConfiguration + .getInstance(context.getExternalContext()); + Enumeration<String> names = appConf.getManagedBeanNames(); + while(names.hasMoreElements()) { + String beanName = names.nextElement(); + ManagedBeanBean managedBean = appConf.getManagedBean(beanName); + Class<?> beanClass; + try { + beanClass = Util.loadClass(managedBean.getClassName(), this); + } catch(ClassNotFoundException e) { + throw new FacesException(e); + } + + if(PortletEventListener.class.isAssignableFrom(beanClass)) { + Object bean = resolveManagedBean(context, beanName, beanClass); + assert bean != null; + + if(logger.isLoggable(Level.FINER)) { + logger.log(Level.FINER, "J4PE_000002", new Object[]{ + event.getEventName(), beanName + }); + } + ((PortletEventListener) bean).handleEvent(event); + } + } + } + + private Object resolveManagedBean(FacesContext context, + String name, Class<?> beanClass) + throws FacesException { + ExpressionFactory ef = context.getApplication() + .getExpressionFactory(); + try { + ValueExpression ve = ef.createValueExpression( + context.getELContext(), "#{" + name + "}", + beanClass); + return beanClass.cast(ve.getValue(context.getELContext())); + } catch(ELException e) { + throw new FacesException(e); + } + } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEvent.java 2007-09-28 18:08:20 UTC (rev 34) @@ -0,0 +1,30 @@ +package net.sf.jsf4portlets.event; + +import java.util.EventObject; + +import javax.portlet.Portlet; + +public class PortletEvent extends EventObject { + + private String eventName; + private Object eventData; + + public PortletEvent(Portlet source, String eventName, Object eventData) { + super(source); + this.eventName = eventName; + this.eventData = eventData; + } + + public Portlet getPortlet() { + return (Portlet) super.getSource(); + } + + public String getEventName() { + return eventName; + } + + public Object getEventData() { + return eventData; + } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/event/PortletEventListener.java 2007-09-28 18:08:20 UTC (rev 34) @@ -0,0 +1,9 @@ +package net.sf.jsf4portlets.event; + +import java.util.EventListener; + +public interface PortletEventListener extends EventListener { + + public void handleEvent(PortletEvent event); + +} Modified: trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2007-09-28 08:59:28 UTC (rev 33) +++ trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2007-09-28 18:08:20 UTC (rev 34) @@ -27,4 +27,10 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> + <lifecycle> + <phase-listener> + net.sf.jsf4portlets.event.EventPhaseListener + </phase-listener> + </lifecycle> + </faces-config> \ No newline at end of file Added: trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties (rev 0) +++ trunk/jsf4portlets-ext/src/main/resources/net/sf/jsf4portlets/ExtLogMessages.properties 2007-09-28 18:08:20 UTC (rev 34) @@ -0,0 +1,22 @@ +# JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +# Copyright (C) 2007 A. Alonso Dominguez +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# A. Alonso Dominguez +# alo...@us... +# +J4PE_000001=J4PE000001: PortletEvent \'{0}\' has been queued for portlet {1}. +J4PE_000002=J4PE000002: Broadcasting event \'{0}\' to managed bean \"{1}\". \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-28 08:59:28 UTC (rev 33) +++ trunk/pom.xml 2007-09-28 18:08:20 UTC (rev 34) @@ -195,7 +195,7 @@ <groupId>org.apache.tomcat</groupId> <artifactId>catalina</artifactId> <version>6.0.13</version> - <scope>compile</scope> + <scope>provided</scope> <optional>true</optional> </dependency> @@ -203,7 +203,7 @@ <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-plus</artifactId> <version>6.1.2</version> - <scope>compile</scope> + <scope>provided</scope> <optional>true</optional> <exclusions> <exclusion> @@ -230,6 +230,28 @@ </dependency> <dependency> + <groupId>com.sun.portal.portletcontainer</groupId> + <artifactId>container</artifactId> + <version>1.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>com.sun.portal.portletcontainer</groupId> + <artifactId>portletcontainer</artifactId> + <version>1.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>com.sun.portal.portletcontainer</groupId> + <artifactId>portletappengine</artifactId> + <version>1.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + + <dependency> <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets</artifactId> <version>${pom.version}</version> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-28 08:59:29
|
Revision: 33 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=33&view=rev Author: alonsoft Date: 2007-09-28 01:59:28 -0700 (Fri, 28 Sep 2007) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets-ext/pom.xml trunk/pom.xml Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2007-09-28 08:59:20 UTC (rev 32) +++ trunk/jsf4portlets/pom.xml 2007-09-28 08:59:28 UTC (rev 33) @@ -4,7 +4,7 @@ <parent> <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2</version> + <version>1.0-alpha-3-SNAPSHOT</version> </parent> <artifactId>jsf4portlets</artifactId> Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-09-28 08:59:20 UTC (rev 32) +++ trunk/jsf4portlets-ext/pom.xml 2007-09-28 08:59:28 UTC (rev 33) @@ -4,7 +4,7 @@ <parent> <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2</version> + <version>1.0-alpha-3-SNAPSHOT</version> </parent> <artifactId>jsf4portlets-ext</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-28 08:59:20 UTC (rev 32) +++ trunk/pom.xml 2007-09-28 08:59:28 UTC (rev 33) @@ -3,7 +3,7 @@ <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2</version> + <version>1.0-alpha-3-SNAPSHOT</version> <packaging>pom</packaging> @@ -11,9 +11,9 @@ <url>http://jsf4portlets.sf.net/</url> <scm> - <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</connection> - <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</developerConnection> - <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</url> + <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/trunk</connection> + <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/trunk</developerConnection> + <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/trunk</url> </scm> <description> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-28 08:59:23
|
Revision: 32 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=32&view=rev Author: alonsoft Date: 2007-09-28 01:59:20 -0700 (Fri, 28 Sep 2007) Log Message: ----------- [maven-scm] copy for tag jsf4portlets-project-1.0-alpha-2 Added Paths: ----------- tags/jsf4portlets-project-1.0-alpha-2/ Copied: tags/jsf4portlets-project-1.0-alpha-2 (from rev 31, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-27 17:43:56
|
Revision: 31 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=31&view=rev Author: alonsoft Date: 2007-09-27 10:43:53 -0700 (Thu, 27 Sep 2007) Log Message: ----------- [maven-release-plugin] prepare release jsf4portlets-project-1.0-alpha-2 Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets-ext/pom.xml trunk/pom.xml Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2007-09-27 17:32:02 UTC (rev 30) +++ trunk/jsf4portlets/pom.xml 2007-09-27 17:43:53 UTC (rev 31) @@ -1,54 +1,54 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2-SNAPSHOT</version> - </parent> - - <artifactId>jsf4portlets</artifactId> - <packaging>jar</packaging> - - <name>JSF 4 Portlets Core</name> - - <description> - This is the main module of JSF 4 Portlets. This module brings an implementation of - the JSF Portlet Bridge (JSR-301) which allows JSR-168 Portlets running as JSF applications. - </description> - - <dependencies> - <dependency> - <groupId>javax.el</groupId> - <artifactId>el-api</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - </dependency> - <dependency> - <groupId>javax.faces</groupId> - <artifactId>jsf-api</artifactId> - </dependency> - <dependency> - <groupId>javax.annotation</groupId> - <artifactId>jsr250-api</artifactId> - </dependency> - <dependency> - <groupId>javax.portlet</groupId> - <artifactId>portlet-api</artifactId> - </dependency> - - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - </dependency> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-2</version> + </parent> + + <artifactId>jsf4portlets</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets Core</name> + + <description> + This is the main module of JSF 4 Portlets. This module brings an implementation of + the JSF Portlet Bridge (JSR-301) which allows JSR-168 Portlets running as JSF applications. + </description> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + </dependency> + + <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>catalina</artifactId> </dependency> @@ -56,31 +56,31 @@ <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-plus</artifactId> </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-project-info-reports-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <groupId>net.sourceforge.maven-taglib</groupId> - <artifactId>maven-taglib-plugin</artifactId> - </plugin> - </plugins> - </reporting> - - <build> - </build> - -</project> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <build> + </build> + +</project> \ No newline at end of file Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-09-27 17:32:02 UTC (rev 30) +++ trunk/jsf4portlets-ext/pom.xml 2007-09-27 17:43:53 UTC (rev 31) @@ -1,87 +1,87 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2-SNAPSHOT</version> - </parent> - - <artifactId>jsf4portlets-ext</artifactId> - <packaging>jar</packaging> - - <name>JSF 4 Portlets Extensions</name> - - <description> - This is the extensions module of JSF 4 Portlets. This module brings some - additional features to the bridge implementation like Facelets support and more. - </description> - - <dependencies> - <dependency> - <groupId>javax.el</groupId> - <artifactId>el-api</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - </dependency> - <dependency> - <groupId>javax.faces</groupId> - <artifactId>jsf-api</artifactId> - </dependency> - <dependency> - <groupId>javax.annotation</groupId> - <artifactId>jsr250-api</artifactId> - </dependency> - <dependency> - <groupId>javax.portlet</groupId> - <artifactId>portlet-api</artifactId> - </dependency> - - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - </dependency> - - <dependency> - <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets</artifactId> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-2</version> + </parent> + + <artifactId>jsf4portlets-ext</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets Extensions</name> + + <description> + This is the extensions module of JSF 4 Portlets. This module brings some + additional features to the bridge implementation like Facelets support and more. + </description> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> </dependency> - - <dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + </dependency> + + <dependency> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets</artifactId> + </dependency> + + <dependency> <groupId>com.sun.facelets</groupId> - <artifactId>jsf-facelets</artifactId> + <artifactId>jsf-facelets</artifactId> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - </dependency> - </dependencies> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-project-info-reports-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <groupId>net.sourceforge.maven-taglib</groupId> - <artifactId>maven-taglib-plugin</artifactId> - </plugin> - </plugins> - </reporting> - - <build> - </build> - -</project> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <build> + </build> + +</project> \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-27 17:32:02 UTC (rev 30) +++ trunk/pom.xml 2007-09-27 17:43:53 UTC (rev 31) @@ -1,248 +1,248 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets-project</artifactId> - <version>1.0-alpha-2-SNAPSHOT</version> - - <packaging>pom</packaging> - - <name>JSF 4 Portlets</name> - <url>http://jsf4portlets.sf.net/</url> - - <scm> - <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/trunk</connection> - <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/trunk</developerConnection> - <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/trunk</url> - </scm> - - <description> - JSF 4 Portlets is an implementation of the JSR-301 (JSF Portlet Bridge). - </description> - - <licenses> - <license> - <name>Lesser General Public License</name> - <url>http://www.opensource.org/licenses/lgpl-license.php</url> - </license> - </licenses> - - <developers> - <developer> - <id>alonso</id> - <name>A. Alonso Dominguez</name> - <email>alo...@us...</email> - <roles> - <role>Developer</role> - </roles> - <timezone>-1</timezone> - </developer> - </developers> - - <mailingLists> - <mailingList> - <name>Developer Mailing List</name> - <subscribe>jsf...@li...</subscribe> - <unsubscribe>jsf...@li...</unsubscribe> - </mailingList> - </mailingLists> - - <issueManagement> - <system>SourceForge.net</system> - <url>http://sourceforge.net/tracker/?group_id=196120</url> - </issueManagement> - - <distributionManagement> - <site> - <id>shell.sf.net</id> - <name>JSF 4 Portlets Website</name> - <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/web</url> - </site> - <repository> - <id>shell.sf.net</id> - <name>JSF 4 Portlets Release Repository</name> - <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/repository/releases</url> - <uniqueVersion>false</uniqueVersion> - </repository> - <snapshotRepository> - <id>shell.sf.net</id> - <name>JSF 4 Portlets Snapshot Repository</name> - <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/repository/snapshots</url> - <uniqueVersion>true</uniqueVersion> - <layout>default</layout> - </snapshotRepository> - </distributionManagement> - - <modules> - <module>jsf4portlets</module> - <module>jsf4portlets-ext</module> - </modules> - - <build> - <defaultGoal>install</defaultGoal> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - </plugins> - </pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/bin.xml</descriptor> - <descriptor>src/assembly/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> - </build> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-project-info-reports-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <groupId>net.sourceforge.maven-taglib</groupId> - <artifactId>maven-taglib-plugin</artifactId> - </plugin> - <!--<plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-changelog-plugin</artifactId> - </plugin>--> - </plugins> - </reporting> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>javax.el</groupId> - <artifactId>el-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.1</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.faces</groupId> - <artifactId>jsf-api</artifactId> - <version>1.2</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.annotation</groupId> - <artifactId>jsr250-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.portlet</groupId> - <artifactId>portlet-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - <version>1.8</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <artifactId>avalon-framework</artifactId> - <groupId>avalon-framework</groupId> - </exclusion> - <exclusion> - <artifactId>log4j</artifactId> - <groupId>log4j</groupId> - </exclusion> - <exclusion> - <artifactId>logkit</artifactId> - <groupId>logkit</groupId> - </exclusion> - <exclusion> - <artifactId>servlet-api</artifactId> - <groupId>javax.servlet</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>catalina</artifactId> - <version>6.0.13</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-plus</artifactId> - <version>6.1.2</version> - <scope>compile</scope> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - </exclusion> - <exclusion> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </exclusion> - <exclusion> - <groupId>geronimo-spec</groupId> - <artifactId>geronimo-spec-jta</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>com.sun.facelets</groupId> - <artifactId>jsf-facelets</artifactId> - <version>1.1.11</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - - <dependency> - <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - </dependencyManagement> - -</project> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-2</version> + + <packaging>pom</packaging> + + <name>JSF 4 Portlets</name> + <url>http://jsf4portlets.sf.net/</url> + + <scm> + <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</connection> + <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</developerConnection> + <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/tags/jsf4portlets-project-1.0-alpha-2</url> + </scm> + + <description> + JSF 4 Portlets is an implementation of the JSR-301 (JSF Portlet Bridge). + </description> + + <licenses> + <license> + <name>Lesser General Public License</name> + <url>http://www.opensource.org/licenses/lgpl-license.php</url> + </license> + </licenses> + + <developers> + <developer> + <id>alonso</id> + <name>A. Alonso Dominguez</name> + <email>alo...@us...</email> + <roles> + <role>Developer</role> + </roles> + <timezone>-1</timezone> + </developer> + </developers> + + <mailingLists> + <mailingList> + <name>Developer Mailing List</name> + <subscribe>jsf...@li...</subscribe> + <unsubscribe>jsf...@li...</unsubscribe> + </mailingList> + </mailingLists> + + <issueManagement> + <system>SourceForge.net</system> + <url>http://sourceforge.net/tracker/?group_id=196120</url> + </issueManagement> + + <distributionManagement> + <site> + <id>shell.sf.net</id> + <name>JSF 4 Portlets Website</name> + <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/web</url> + </site> + <repository> + <id>shell.sf.net</id> + <name>JSF 4 Portlets Release Repository</name> + <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/repository/releases</url> + <uniqueVersion>false</uniqueVersion> + </repository> + <snapshotRepository> + <id>shell.sf.net</id> + <name>JSF 4 Portlets Snapshot Repository</name> + <url>scp://shell.sf.net/home/groups/j/js/jsf4portlets/htdocs/repository/snapshots</url> + <uniqueVersion>true</uniqueVersion> + <layout>default</layout> + </snapshotRepository> + </distributionManagement> + + <modules> + <module>jsf4portlets</module> + <module>jsf4portlets-ext</module> + </modules> + + <build> + <defaultGoal>install</defaultGoal> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/bin.xml</descriptor> + <descriptor>src/assembly/src.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + <!--<plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + </plugin>--> + </plugins> + </reporting> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + <version>1.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + <version>1.8</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <artifactId>avalon-framework</artifactId> + <groupId>avalon-framework</groupId> + </exclusion> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + <exclusion> + <artifactId>logkit</artifactId> + <groupId>logkit</groupId> + </exclusion> + <exclusion> + <artifactId>servlet-api</artifactId> + <groupId>javax.servlet</groupId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>catalina</artifactId> + <version>6.0.13</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-plus</artifactId> + <version>6.1.2</version> + <scope>compile</scope> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>javax.activation</groupId> + <artifactId>activation</artifactId> + </exclusion> + <exclusion> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + </exclusion> + <exclusion> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-jta</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>com.sun.facelets</groupId> + <artifactId>jsf-facelets</artifactId> + <version>1.1.11</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + </dependencyManagement> + +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-27 17:32:05
|
Revision: 30 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=30&view=rev Author: alonsoft Date: 2007-09-27 10:32:02 -0700 (Thu, 27 Sep 2007) Log Message: ----------- Prepared for alpha-2 release Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties trunk/pom.xml trunk/src/assembly/bin.xml trunk/src/assembly/src.xml trunk/src/site/site.xml Added Paths: ----------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java trunk/jsf4portlets/src/site/ trunk/jsf4portlets/src/site/site.xml trunk/jsf4portlets-ext/src/site/ trunk/jsf4portlets-ext/src/site/apt/ trunk/jsf4portlets-ext/src/site/apt/facelets.apt trunk/jsf4portlets-ext/src/site/apt/index.apt trunk/jsf4portlets-ext/src/site/site.xml trunk/src/site/apt/repositories.apt Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/jsf4portlets/pom.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -52,6 +52,10 @@ <groupId>org.apache.tomcat</groupId> <artifactId>catalina</artifactId> </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-plus</artifactId> + </dependency> <dependency> <groupId>junit</groupId> Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2007-09-27 17:32:02 UTC (rev 30) @@ -127,7 +127,7 @@ try { Class<?> clazz = Class.forName(className, true, InjectionProviderFactory.class.getClassLoader()); - if(clazz.isAssignableFrom(InjectionProvider.class)) { + if(InjectionProvider.class.isAssignableFrom(clazz)) { try { Constructor<?> cons = clazz.getConstructor(PortletContext.class); provider = (InjectionProvider) cons.newInstance( @@ -177,7 +177,9 @@ String[] parts = entry.split(":"); if(parts.length != 2) { - // TODO log about this problem + if(logger.isLoggable(Level.SEVERE)) { + logger.log(Level.SEVERE, "J4P_000050", entry); + } return null; } @@ -188,11 +190,15 @@ return parts[0]; } } else { - // TODO Entry not discoverable + if(logger.isLoggable(Level.SEVERE)) { + logger.log(Level.SEVERE, "J4P_000051", parts[0]); + } return null; } } catch(ClassNotFoundException e) { - // TODO provider not found + if(logger.isLoggable(Level.SEVERE)) { + logger.log(Level.SEVERE, "J4P_000034", parts[0]); + } return null; } Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Jetty6InjectionProvider.java 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,45 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.vendor; + +import net.sf.jsf4portlets.spi.ContainerInjectionProvider; +import net.sf.jsf4portlets.spi.InjectionProviderException; + +import org.mortbay.jetty.plus.annotation.LifeCycleCallbackCollection; + +public class Jetty6InjectionProvider extends ContainerInjectionProvider { + + private LifeCycleCallbackCollection callbacks; + + public Jetty6InjectionProvider() { + callbacks = new LifeCycleCallbackCollection(); + } + + public void invokePreDestroy(Object managedBean) + throws InjectionProviderException { + try { + callbacks.callPreDestroyCallback(managedBean); + } catch(Exception e) { + throw new InjectionProviderException(e); + } + } + +} Modified: trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2007-09-27 17:32:02 UTC (rev 30) @@ -1 +1,2 @@ -net.sf.jsf4portlets.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor \ No newline at end of file +net.sf.jsf4portlets.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor +net.sf.jsf4portlets.vendor.Jetty6InjectionProvider:org.mortbay.jetty.annotation.LifeCycleCallbackCollection \ No newline at end of file Modified: trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties =================================================================== --- trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-09-27 17:32:02 UTC (rev 30) @@ -67,3 +67,5 @@ J4P_000047=J4P000047: Injection method {0} should be declared with no parameters for annotation {1}. J4P_000048=J4P000048: Injection method {0} should thrown no checked exceptions for annotation {1}. J4P_000049=J4P000049: Cannot read injection provider service. +J4P_000050=J4P000050: Illegal injection provider service entry: {0} +J4P_000051=J4P000051: Entry {0} is not a container specific injection provider. Added: trunk/jsf4portlets/src/site/site.xml =================================================================== --- trunk/jsf4portlets/src/site/site.xml (rev 0) +++ trunk/jsf4portlets/src/site/site.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2007 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<project name="JSF 4 Portlets Core"> + <bannerLeft> + <name>SourceForge.net Logo</name> + <src>http://sflogo.sourceforge.net/sflogo.php?group_id=196120&type=5</src> + <href>http://www.sourceforge.net</href> + </bannerLeft> + <bannerRight> + <name>JSF 4 Portlets</name> + <href>http://jsf4portlets.sf.net</href> + </bannerRight> + + <body> + <links> + <item name="JSF 4 Portlets" href="http://jsf4portlets.sf.net" /> + <item name="SF Project Page" href="http://sf.net/projects/jsf4portlets" /> + <item name="JSR-301" href="http://jcp.org/en/jsr/detail?id=301" /> + </links> + + <menu name="Main Menu"> + <item name="Overview" href="index.html" /> + <item name="License" href="license.html" /> + </menu> + + <menu ref="reports" /> + </body> +</project> \ No newline at end of file Added: trunk/jsf4portlets-ext/src/site/apt/facelets.apt =================================================================== --- trunk/jsf4portlets-ext/src/site/apt/facelets.apt (rev 0) +++ trunk/jsf4portlets-ext/src/site/apt/facelets.apt 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,45 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + + --- + JSF 4 Portlets Extensions - Facelets + --- + A. Alonso Dom\xEDnguez + --- + +Facelets Support + + If you would like to use {{{http://facelets.dev.java.net}JSF Facelets}} you must configure the <<<FaceletPortletViewHandler>>> in your <<<faces-config.xml>>> like following: + ++--- +<faces-config> + ... + + <application> + <view-handler> + net.sf.jsf4portlets.facelets.FaceletPortletViewHandler + </view-handler> + </application> + + ... +</faces-config> ++--- \ No newline at end of file Added: trunk/jsf4portlets-ext/src/site/apt/index.apt =================================================================== --- trunk/jsf4portlets-ext/src/site/apt/index.apt (rev 0) +++ trunk/jsf4portlets-ext/src/site/apt/index.apt 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,38 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + + --- + JSF 4 Portlets Extensions + --- + A. Alonso Dom\xEDnguez + --- + + +JSF 4 Portlets Extensions + + This is the extensions module of JSF 4 Portlets. This module brings some additional features to the bridge implementation. Currently the only extension available is support for {{{http://facelets.dev.java.net}JSF Facelets}}, more features will be implemented in the future. + + Planned features: + + * Inter-Portlet Communication. This will require deploying portlets with the {{{http://portlet-container.dev.java.net}Open Source Portlet Container}}. This feature will allow Faces' managed beans to be aware of portlet events. + + * AJAX Support. \ No newline at end of file Added: trunk/jsf4portlets-ext/src/site/site.xml =================================================================== --- trunk/jsf4portlets-ext/src/site/site.xml (rev 0) +++ trunk/jsf4portlets-ext/src/site/site.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2007 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<project name="JSF 4 Portlets Extensions"> + <bannerLeft> + <name>SourceForge.net Logo</name> + <src>http://sflogo.sourceforge.net/sflogo.php?group_id=196120&type=5</src> + <href>http://www.sourceforge.net</href> + </bannerLeft> + <bannerRight> + <name>JSF 4 Portlets</name> + <href>http://jsf4portlets.sf.net</href> + </bannerRight> + + <body> + <links> + <item name="JSF 4 Portlets" href="http://jsf4portlets.sf.net" /> + <item name="SF Project Page" href="http://sf.net/projects/jsf4portlets" /> + <item name="JSR-301" href="http://jcp.org/en/jsr/detail?id=301" /> + </links> + + <menu name="Main Menu"> + <item name="Overview" href="index.html" /> + <item name="License" href="license.html" /> + </menu> + + <menu name="Feature Documentation"> + <item name="Facelets" href="facelets.html" /> + </menu> + + <menu ref="reports" /> + </body> +</project> \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/pom.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -79,6 +79,7 @@ </modules> <build> + <defaultGoal>install</defaultGoal> <pluginManagement> <plugins> <plugin> @@ -199,6 +200,28 @@ </dependency> <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-plus</artifactId> + <version>6.1.2</version> + <scope>compile</scope> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>javax.activation</groupId> + <artifactId>activation</artifactId> + </exclusion> + <exclusion> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + </exclusion> + <exclusion> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-jta</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> <groupId>com.sun.facelets</groupId> <artifactId>jsf-facelets</artifactId> <version>1.1.11</version> Modified: trunk/src/assembly/bin.xml =================================================================== --- trunk/src/assembly/bin.xml 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/src/assembly/bin.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -32,23 +32,31 @@ <moduleSets> <moduleSet> <includes> - <include>net.sf.jsf4portlets:jsf4portlets</include> - <include>net.sf.jsf4portlets:jsf4portlets-ext</include> + <include>net.sf.jsf4portlets:*</include> </includes> <binaries> - <outputDirectory>/lib</outputDirectory> + <outputDirectory>/</outputDirectory> <unpack>false</unpack> <dependencySets> <dependencySet> <outputDirectory>/lib</outputDirectory> - <scope>runtime</scope> <excludes> + <exclude>net.sf.jsf4portlets:jsf4portlets</exclude> <exclude>org.apache.tomcat:*</exclude> - <exclude>com.sun.facelets:*</exclude> + <exclude>org.mortbay.jetty:jetty-plus</exclude> </excludes> </dependencySet> </dependencySets> </binaries> + <sources> + <includeModuleDirectory>true</includeModuleDirectory> + <outputDirectoryMapping>/doc/${artifactId}</outputDirectoryMapping> + <fileSets> + <fileSet> + <directory>target/site</directory> + </fileSet> + </fileSets> + </sources> </moduleSet> </moduleSets> <fileSets> @@ -64,25 +72,8 @@ <outputDirectory>/lib</outputDirectory> </fileSet> <fileSet> - <directory>target</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>*.jar</include> - </includes> + <directory>target/site</directory> + <outputDirectory>/doc</outputDirectory> </fileSet> - <fileSet> - <directory>target/site/apidocs</directory> - <outputDirectory>/doc/apidocs</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> - <fileSet> - <directory>target/site/tlddoc</directory> - <outputDirectory>/doc/tlddocs</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> </fileSets> </assembly> \ No newline at end of file Modified: trunk/src/assembly/src.xml =================================================================== --- trunk/src/assembly/src.xml 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/src/assembly/src.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -29,6 +29,27 @@ <format>tar.bz2</format> <format>zip</format> </formats> + <moduleSets> + <moduleSet> + <includes> + <include>net.sf.jsf4portlets:jsf4portlets</include> + <include>net.sf.jsf4portlets:jsf4portlets-ext</include> + </includes> + <sources> + <fileSets> + <fileSet> + <directory>src</directory> + <outputDirectory>src</outputDirectory> + </fileSet> + <fileSet> + <includes> + <include>pom.xml</include> + </includes> + </fileSet> + </fileSets> + </sources> + </moduleSet> + </moduleSets> <fileSets> <fileSet> <includes> @@ -41,9 +62,6 @@ <fileSet> <directory>src</directory> <outputDirectory>/src</outputDirectory> - <includes> - <include>**/*</include> - </includes> </fileSet> </fileSets> </assembly> \ No newline at end of file Added: trunk/src/site/apt/repositories.apt =================================================================== --- trunk/src/site/apt/repositories.apt (rev 0) +++ trunk/src/site/apt/repositories.apt 2007-09-27 17:32:02 UTC (rev 30) @@ -0,0 +1,61 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + + --- + JSF 4 Portlets - Repositories + --- + A. Alonso Dom\xEDnguez + --- + +Maven 2 Repositories + + JSF 4 Portlets is not available at the maven2 central repository because some dependency issues, it will be available in the future when that issues become resolved. Ragard of this, it is possible to use jsf4portlets with a Maven2 project configuring the specific repositories for JSF 4 Portlets at {{{http://www.sourceforge.net}SourceForge.net}}: + + * <<Releases>>: {{http://jsf4portlets.sf.net/repository/releases}} + + * <<Snapshots>>: {{http://jsf4portlets.sf.net/repository/snapshots}} + + Following is an example of how to configure these maven 2 repositories for your project. + +* Releases + ++--- +<repositories> + <repository> + <id>releases.jsf4portlets</id> + <url>http://jsf4portlets.sf.net/repository/releases</url> + <layout>default</layout> + </repository> +</repositories> ++--- + +* Snapshots + ++--- +<repositories> + <repository> + <id>snapshots.jsf4portlets</id> + <url>http://jsf4portlets.sf.net/repository/snapshots</url> + <layout>default</layout> + </repository> +</repositories> ++--- \ No newline at end of file Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2007-09-26 17:47:31 UTC (rev 29) +++ trunk/src/site/site.xml 2007-09-27 17:32:02 UTC (rev 30) @@ -33,6 +33,11 @@ <href>http://jsf4portlets.sf.net</href> </bannerRight> + <poweredBy> + <logo name="Maven" href="http://maven.apache.org/" + img="http://maven.apache.org/images/logos/maven-feather.png"/> + </poweredBy> + <body> <links> <item name="SF Project Page" href="http://sf.net/projects/jsf4portlets" /> @@ -49,9 +54,13 @@ <menu name="Documentation"> <item name="User Documentation" href="user_docs.html" /> - <item name="Java Docs" href="apidocs/index.html" /> + <item name="Java Docs" href="jsf4portlets/apidocs/index.html" /> </menu> + <menu name="Developer Documentation"> + <item name="Maven 2 Repositories" href="repositories.html" /> + </menu> + <menu ref="modules" /> <menu ref="reports" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-26 17:47:39
|
Revision: 29 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=29&view=rev Author: alonsoft Date: 2007-09-26 10:47:31 -0700 (Wed, 26 Sep 2007) Log Message: ----------- Website and docs updated Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/BridgeLifecycleListener.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerWrapper.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/Util.java trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties trunk/jsf4portlets-ext/pom.xml trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml trunk/pom.xml trunk/src/assembly/bin.xml trunk/src/site/apt/download.apt trunk/src/site/apt/release_notes.apt trunk/src/site/apt/user_docs.apt trunk/src/site/site.xml trunk/src/site/xdoc/getting_started.xml Added Paths: ----------- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/ContainerInjectionProvider.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/GenericInjectionProvider.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider trunk/src/legal/ trunk/src/site/ Removed Paths: ------------- trunk/jsf4portlets/src/legal/ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/ext/ trunk/jsf4portlets/src/main/resources/META-INF/jsf4portlets.tld trunk/jsf4portlets/src/site/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/ Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/pom.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -12,6 +12,11 @@ <name>JSF 4 Portlets Core</name> + <description> + This is the main module of JSF 4 Portlets. This module brings an implementation of + the JSF Portlet Bridge (JSR-301) which allows JSR-168 Portlets running as JSF applications. + </description> + <dependencies> <dependency> <groupId>javax.el</groupId> @@ -42,6 +47,11 @@ <groupId>commons-digester</groupId> <artifactId>commons-digester</artifactId> </dependency> + + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>catalina</artifactId> + </dependency> <dependency> <groupId>junit</groupId> @@ -63,10 +73,6 @@ <groupId>net.sourceforge.maven-taglib</groupId> <artifactId>maven-taglib-plugin</artifactId> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-changelog-plugin</artifactId> - </plugin> </plugins> </reporting> Modified: trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java =================================================================== --- trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java 2007-09-26 17:47:31 UTC (rev 29) @@ -70,6 +70,7 @@ } // Implement the method that satisfies NamingContainer + @Override public String getContainerClientId(FacesContext context) { return PortletNamingContainerUIViewRoot.getContainerClientId( context, super.getContainerClientId(context)); Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-09-26 17:47:31 UTC (rev 29) @@ -78,6 +78,7 @@ facesContextFactory = null; lifecycle = null; portletConfig = null; + requestScopeManager = null; logger.log(Level.FINEST, "J4P_000004", getPortletName()); } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java 2007-09-26 17:47:31 UTC (rev 29) @@ -51,7 +51,13 @@ import net.sf.jsf4portlets.config.PortletConfiguration; import net.sf.jsf4portlets.config.PortletConfiguration.BooleanPortletParameter; import net.sf.jsf4portlets.util.Util; - + +/** + * Manages the state of the request scope + * + * @author A. Alonso Dominguez + * + */ public class RequestScopeManager { public static final int DEFAULT_MAX_MANAGED_REQUEST_SCOPES = 1000; @@ -70,11 +76,20 @@ private int maxRequestScopes; - public RequestScopeManager(int maxRequestScopes) { + public RequestScopeManager(int maxRequestScopes) { + if(maxRequestScopes < 0) { + throw new IllegalArgumentException(); + } + this.maxRequestScopes = maxRequestScopes; scopes = new HashMap<String, RequestScope>(this.maxRequestScopes); } - + + /** + * Restores the current request scope into the given <code>FacesContext</code> + * + * @param context the current <code>FacesContext</code> + */ public void restore(FacesContext context) { ExternalContext extContext = context.getExternalContext(); PortletRequest request = (PortletRequest) extContext.getRequest(); @@ -140,7 +155,13 @@ request.setAttribute(BridgeConstants.REQUEST_SCOPE, scope); releasePreviousRequestScope(request); } - + + /** + * Stores the current state of the <code>FacesContext</code> into the + * request scope for later use. + * + * @param context the current <code>FacesContext</code> + */ @SuppressWarnings("unchecked") public void save(FacesContext context) { ExternalContext extContext = context.getExternalContext(); @@ -219,7 +240,8 @@ } } - scope.setViewRoot(context.getViewRoot()); + scope.setViewRoot(context.getViewRoot()); + scope.setViewId(null); } if(scope != null) { Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/BridgeLifecycleListener.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/BridgeLifecycleListener.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/BridgeLifecycleListener.java 2007-09-26 17:47:31 UTC (rev 29) @@ -21,18 +21,17 @@ package net.sf.jsf4portlets.application; import java.util.logging.Level; -import java.util.logging.LogRecord; import java.util.logging.Logger; -import javax.portlet.*; -import javax.faces.component.*; +import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; -import javax.portlet.faces.*; +import javax.portlet.PortletResponse; +import javax.portlet.faces.Bridge; import javax.portlet.faces.Bridge.PortletPhase; -import javax.portlet.faces.component.*; +import javax.portlet.faces.component.PortletNamingContainerUIViewRoot; import net.sf.jsf4portlets.util.Util; Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java 2007-09-26 17:47:31 UTC (rev 29) @@ -28,9 +28,7 @@ import java.util.logging.Logger; import javax.faces.context.ExternalContext; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import javax.portlet.PortletContext; import org.apache.commons.digester.Digester; import org.xml.sax.SAXException; @@ -42,7 +40,7 @@ * @author A. Alonso Dominguez * @version 1.0 */ -public final class ApplicationConfiguration implements ServletContextListener { +public final class ApplicationConfiguration { private static final String INSTANCE_KEY = ApplicationConfiguration.class.getName(); @@ -56,8 +54,14 @@ "javax.faces.webapp.FacesServlet"; public static ApplicationConfiguration getInstance(ExternalContext context) { - return (ApplicationConfiguration) context + ApplicationConfiguration result = (ApplicationConfiguration) context .getApplicationMap().get(INSTANCE_KEY); + if(result == null) { + PortletContext portletContext = (PortletContext) context.getContext(); + result = new ApplicationConfiguration(); + result.configure(portletContext); + } + return result; } private final Logger logger = Logger.getLogger( @@ -112,53 +116,44 @@ public Enumeration<String> getManagedBeanNames() { return facesConfig.getManagedBeanNames(); } - - // ServletContextListener - - public void contextInitialized(ServletContextEvent event) { - ServletContext servletContext = event.getServletContext(); - if(isFacesApp(servletContext)) { + protected void configure(PortletContext portletContext) { + if(isFacesApp(portletContext)) { logger.log(Level.INFO, "J4P_000028", - servletContext.getContextPath()); + portletContext.getPortletContextName()); try { - facesConfig = loadFacesConfig(servletContext); - webappConfig = loadWebXml(servletContext); + facesConfig = loadFacesConfig(portletContext); + webappConfig = loadWebXml(portletContext); } catch(Exception e) { throw new ExceptionInInitializerError(e); } - servletContext.setAttribute(INSTANCE_KEY, this); + portletContext.setAttribute(INSTANCE_KEY, this); } } - public void contextDestroyed(ServletContextEvent event) { - ServletContext servletContext = event.getServletContext(); - servletContext.removeAttribute(INSTANCE_KEY); - } - private Digester createDigester() { Digester digester = new Digester(); digester.setClassLoader(Thread.currentThread().getContextClassLoader()); return digester; } - private InputStream getStream(ServletContext servletContext, String path) + private InputStream getStream(PortletContext portletContext, String path) throws IOException { - InputStream in = servletContext.getResourceAsStream(path); + InputStream in = portletContext.getResourceAsStream(path); if(in == null) { throw new FileNotFoundException( - servletContext.getRealPath(path)); + portletContext.getRealPath(path)); } return in; } - private boolean isFacesApp(ServletContext servletContext) { - InputStream in = servletContext.getResourceAsStream(FACES_CONFIG_XML); + private boolean isFacesApp(PortletContext portletContext) { + InputStream in = portletContext.getResourceAsStream(FACES_CONFIG_XML); return (in != null); } - private FacesConfigBean loadFacesConfig(ServletContext servletContext) + private FacesConfigBean loadFacesConfig(PortletContext portletContext) throws IOException, SAXException { Digester digester = createDigester(); @@ -169,11 +164,11 @@ digester.addBeanPropertySetter("faces-config/managed-bean/managed-bean-class", "className"); digester.addBeanPropertySetter("faces-config/managed-bean/managed-bean-scope", "scope"); - InputStream in = getStream(servletContext, FACES_CONFIG_XML); + InputStream in = getStream(portletContext, FACES_CONFIG_XML); return (FacesConfigBean) digester.parse(in); } - private WebAppBean loadWebXml(ServletContext servletContext) + private WebAppBean loadWebXml(PortletContext portletContext) throws IOException, SAXException { Digester digester = createDigester(); @@ -187,7 +182,7 @@ digester.addCallParam("web-app/servlet-mapping/servlet-name", 0); digester.addCallParam("web-app/servlet-mapping/url-pattern", 1); - InputStream in = getStream(servletContext, WEB_APP_XML); + InputStream in = getStream(portletContext, WEB_APP_XML); return (WebAppBean) digester.parse(in); } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerWrapper.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerWrapper.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerWrapper.java 2007-09-26 17:47:31 UTC (rev 29) @@ -31,7 +31,7 @@ import net.sf.jsf4portlets.util.Util; /** - * @author alonso + * @author A. Alonso Dominguez * */ public class ResponseStateManagerWrapper extends ResponseStateManager { @@ -43,8 +43,10 @@ } /** - * @param arg0 - * @return + * Obtains an object which represents the components' state for restore. + * + * @param context the current <code>FacesContext</code> + * @return the components' state * @deprecated * @see javax.faces.render.ResponseStateManager#getComponentStateToRestore(javax.faces.context.FacesContext) */ @@ -54,9 +56,11 @@ } /** - * @param arg0 - * @param arg1 - * @return + * Obtains the current state of the given view + * + * @param context the current <code>FacesContext</code> + * @param viewId the current <code>viewId</code> + * @return the view state * @see javax.faces.render.ResponseStateManager#getState(javax.faces.context.FacesContext, java.lang.String) */ public Object getState(FacesContext context, String viewId) { @@ -64,9 +68,11 @@ } /** - * @param arg0 - * @param arg1 - * @return + * Obtains the tree structure for restore + * + * @param context the current <code>FacesContext</code> + * @param treeId the current <code>treeId</code> + * @return the tree structure * @deprecated * @see javax.faces.render.ResponseStateManager#getTreeStructureToRestore(javax.faces.context.FacesContext, java.lang.String) */ @@ -76,8 +82,10 @@ } /** - * @param arg0 - * @return + * Checks if the bridge is performing a postback + * + * @param context the current <code>FacesContext</code> + * @return <code>true</code> - if we are inside a postback request, <code>false</code> otherwise. * @see javax.faces.render.ResponseStateManager#isPostback(javax.faces.context.FacesContext) */ public boolean isPostback(FacesContext context) { @@ -90,9 +98,13 @@ } /** - * @param arg0 - * @param arg1 - * @throws IOException + * Writes the current state of the view into the request scope, + * then delegate to wrapped response state manager so view state + * can be written to the response too. + * + * @param context the current <code>FacesContext</code> + * @param view the view state to be written. + * @throws IOException * @deprecated * @see javax.faces.render.ResponseStateManager#writeState(javax.faces.context.FacesContext, javax.faces.application.StateManager.SerializedView) */ Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/ContainerInjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/ContainerInjectionProvider.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/ContainerInjectionProvider.java 2007-09-26 17:47:31 UTC (rev 29) @@ -0,0 +1,36 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.spi; + +import net.sf.jsf4portlets.util.Util; + +public abstract class ContainerInjectionProvider implements InjectionProvider { + + public static boolean isInjectionFeatureEnabled(String delegateClass) { + try { + Util.loadClass(delegateClass, null); + return true; + } catch(ClassNotFoundException e) { + return false; + } + } + +} Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/spi/InjectionProviderFactory.java 2007-09-26 17:47:31 UTC (rev 29) @@ -20,15 +20,23 @@ */ package net.sf.jsf4portlets.spi; -import java.lang.reflect.Method; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import javax.annotation.PreDestroy; import javax.faces.context.ExternalContext; +import javax.portlet.PortletContext; import net.sf.jsf4portlets.BridgeConstants; +import net.sf.jsf4portlets.util.Util; +import net.sf.jsf4portlets.vendor.GenericInjectionProvider; /** * @author A. Alonso Dom\xEDnguez @@ -41,8 +49,19 @@ private static final InjectionProvider NOOP_PROVIDER = new NoopInjectionProvider(); + private static final InjectionProvider GENERIC_INJECTION_PROVIDER = + new GenericInjectionProvider(); + + private static final String[] EMPTY_ARRAY = new String[0]; + + private static final String INJECTION_PROVIDER_PROPERTY = + "net.sf.jsf4portlets.injection_provider"; + + private static final String INJECTION_SERVICE = + "META-INF/services/" + InjectionProvider.class.getName(); + private static Logger logger = Logger.getLogger( - "net.sf.jsf4portlets.application", + InjectionProviderFactory.class.getPackage().getName(), "net.sf.jsf4portlets.LogMessages"); static { @@ -57,7 +76,7 @@ public static InjectionProvider createInstance(ExternalContext context) { String providerClass = findProviderClass(context); - InjectionProvider provider = getProviderInstance(providerClass); + InjectionProvider provider = getProviderInstance(providerClass, context); if(provider.getClass() != NoopInjectionProvider.class) { if(logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "J4P_000037", providerClass); @@ -73,21 +92,56 @@ private static String findProviderClass(ExternalContext context) { String provider = context.getInitParameter( BridgeConstants.INJECTION_PROVIDER); - return (provider != null) ? provider : - System.getProperty(BridgeConstants.INJECTION_PROVIDER); + if(provider != null) { + return provider; + } else { + provider = System.getProperty(INJECTION_PROVIDER_PROPERTY); + } + + if(provider != null) { + return provider; + } else { + String[] serviceEntries = getServiceEntries(); + if(serviceEntries.length > 0) { + for(int i = 0;i < serviceEntries.length;i++) { + provider = getProviderFromEntry(serviceEntries[i]); + if(provider != null) { + break; + } + } + } else { + return null; + } + } + + return provider; } - private static InjectionProvider getProviderInstance(String className) { + private static InjectionProvider getProviderInstance(String className, + ExternalContext context) { if(!INJECTION_ENABLED) { return NOOP_PROVIDER; } - InjectionProvider provider = new DefaultInjectionProvider(); + InjectionProvider provider = GENERIC_INJECTION_PROVIDER; if(className != null) { try { Class<?> clazz = Class.forName(className, true, InjectionProviderFactory.class.getClassLoader()); if(clazz.isAssignableFrom(InjectionProvider.class)) { - provider = (InjectionProvider) clazz.newInstance(); + try { + Constructor<?> cons = clazz.getConstructor(PortletContext.class); + provider = (InjectionProvider) cons.newInstance( + (PortletContext) context.getContext()); + } catch(NoSuchMethodException e) { + provider = (InjectionProvider) clazz.newInstance(); + } catch(InvocationTargetException e) { + if(logger.isLoggable(Level.SEVERE)) { + LogRecord logRecord = new LogRecord(Level.SEVERE, "J4P_000036"); + logRecord.setParameters(new Object[]{ className }); + logRecord.setThrown(e); + logger.log(logRecord); + } + } } else { if(logger.isLoggable(Level.SEVERE)) { logger.log(Level.SEVERE, "J4P_000035", className); @@ -116,24 +170,74 @@ return provider; } - private static class DefaultInjectionProvider implements InjectionProvider { - - public void invokePreDestroy(Object managedBean) - throws InjectionProviderException { - Class<?> managedBeanClass = managedBean.getClass(); - for(Method method : managedBeanClass.getDeclaredMethods()) { - if(!method.isAnnotationPresent(PreDestroy.class)) { - continue; + private static String getProviderFromEntry(String entry) { + if(entry == null || entry.length() == 0) { + return null; + } + + String[] parts = entry.split(":"); + if(parts.length != 2) { + // TODO log about this problem + return null; + } + + try { + Class<?> clazz = Util.loadClass(parts[0], null); + if(ContainerInjectionProvider.class.isAssignableFrom(clazz)) { + if(ContainerInjectionProvider.isInjectionFeatureEnabled(parts[1])) { + return parts[0]; } - + } else { + // TODO Entry not discoverable + return null; + } + } catch(ClassNotFoundException e) { + // TODO provider not found + return null; + } + + return null; + } + + private static String[] getServiceEntries() { + String[] results = EMPTY_ARRAY; + ClassLoader loader = Util.getClassLoader(null); + + InputStream stream = null; + BufferedReader reader = null; + try { + stream = loader.getResourceAsStream(INJECTION_SERVICE); + if(stream != null) { try { - method.invoke(managedBean); + reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); } catch(Exception e) { - throw new InjectionProviderException(e); + reader = new BufferedReader(new InputStreamReader(stream)); } + List<String> list = new ArrayList<String>(); + for(String line = reader.readLine();line != null;line = reader.readLine()) { + list.add(line.trim()); + } + results = list.toArray(new String[list.size()]); } + } catch(Exception e) { + if(logger.isLoggable(Level.SEVERE)) { + logger.log(Level.SEVERE, "J4P_000049", e); + } + results = EMPTY_ARRAY; + } finally { + if(stream != null) { + try { + stream.close(); + } catch(Exception e) { } + } + if(reader != null) { + try { + reader.close(); + } catch(Exception e) { } + } } + return results; } private static class NoopInjectionProvider implements InjectionProvider { Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/Util.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/Util.java 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/util/Util.java 2007-09-26 17:47:31 UTC (rev 29) @@ -106,10 +106,20 @@ return mapping.startsWith("/"); } + public static Class<?> loadClass(String className, Object caller) + throws ClassNotFoundException { + ClassLoader loader = getClassLoader(caller); + return loader.loadClass(className); + } + public static ClassLoader getClassLoader(Object caller) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if(loader == null) { - loader = caller.getClass().getClassLoader(); + if(caller != null) { + loader = caller.getClass().getClassLoader(); + } else { + loader = Util.class.getClassLoader(); + } } return loader; } Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/GenericInjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/GenericInjectionProvider.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/GenericInjectionProvider.java 2007-09-26 17:47:31 UTC (rev 29) @@ -0,0 +1,124 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.vendor; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.PreDestroy; + +import net.sf.jsf4portlets.spi.InjectionProvider; +import net.sf.jsf4portlets.spi.InjectionProviderException; + +public class GenericInjectionProvider implements InjectionProvider { + + private final Logger logger = Logger.getLogger( + GenericInjectionProvider.class.getPackage().getName(), + "net.sf.jsf4portlets.LogMessages"); + + public void invokePreDestroy(Object managedBean) + throws InjectionProviderException { + if(managedBean != null) { + Method annotatedMethod = getAnnotatedMethod( + managedBean, PreDestroy.class); + invokeMethod(managedBean, annotatedMethod); + } + } + + private void invokeMethod(Object managedBean, Method method) + throws InjectionProviderException { + if(method != null) { + boolean accessible = method.isAccessible(); + method.setAccessible(true); + try { + method.invoke(managedBean); + } catch(Exception e) { + throw new InjectionProviderException(e); + } finally { + method.setAccessible(accessible); + } + } + } + + private Method getAnnotatedMethod(Object managedBean, + Class<? extends Annotation> annotation) { + Class<?> clazz = managedBean.getClass(); + while(!Object.class.equals(clazz)) { + Method[] methods = clazz.getDeclaredMethods(); + for(Method method : methods) { + if(method.isAnnotationPresent(annotation)) { + // validate method + if(Modifier.isStatic(method.getModifiers())) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000045", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + if(!Void.TYPE.equals(method.getReturnType())) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000046", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + if(method.getParameterTypes().length != 0) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000047", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + Class<?>[] exceptions = method.getExceptionTypes(); + if(exceptions.length != 0) { + boolean hasChecked = false; + for(Class<?> excClass : exceptions) { + if(!RuntimeException.class.isAssignableFrom(excClass)) { + hasChecked = true; + break; + } + } + if(hasChecked) { + if(logger.isLoggable(Level.WARNING)) { + logger.log(Level.WARNING, "J4P_000048", new Object[]{ + method.getName(), annotation.getName() + }); + } + continue; + } + } + return method; + } + } + + clazz = clazz.getSuperclass(); + } + + return null; + } + +} Added: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java (rev 0) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/vendor/Tomcat6InjectionProvider.java 2007-09-26 17:47:31 UTC (rev 29) @@ -0,0 +1,52 @@ +/* JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + * Copyright (C) 2007 A. Alonso Dominguez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * A. Alonso Dominguez + * alo...@us... + */ +package net.sf.jsf4portlets.vendor; + +import javax.portlet.PortletContext; + +import net.sf.jsf4portlets.spi.ContainerInjectionProvider; +import net.sf.jsf4portlets.spi.InjectionProviderException; + +import org.apache.AnnotationProcessor; + +public class Tomcat6InjectionProvider extends ContainerInjectionProvider { + + private PortletContext portletContext; + + public Tomcat6InjectionProvider(PortletContext portletContext) { + this.portletContext = portletContext; + } + + public void invokePreDestroy(Object managedBean) + throws InjectionProviderException { + try { + getProcessor().preDestroy(managedBean); + } catch(Exception e) { + throw new InjectionProviderException(e); + } + } + + protected AnnotationProcessor getProcessor() { + return (AnnotationProcessor) portletContext.getAttribute( + AnnotationProcessor.class.getName()); + } + +} Modified: trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/resources/META-INF/faces-config.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -48,18 +48,4 @@ </el-resolver> </application> - <component> - <description> - PortletPage component used to namespace portlet's - view components. - </description> - <display-name>Portlet Page</display-name> - <component-type> - net.sf.jsf4portlets.PortletPage - </component-type> - <component-class> - net.sf.jsf4portlets.ext.UIPortletPage - </component-class> - </component> - </faces-config> \ No newline at end of file Deleted: trunk/jsf4portlets/src/main/resources/META-INF/jsf4portlets.tld =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/jsf4portlets.tld 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/resources/META-INF/jsf4portlets.tld 2007-09-26 17:47:31 UTC (rev 29) @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - JSF 4 Portlets - JSF Portlet Bridge (JSR-301) - Copyright (C) 2007 A. Alonso Dominguez - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - A. Alonso Dominguez - alo...@us... ---> - -<!DOCTYPE taglib - PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" - "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> - -<taglib> - <tlib-version>1.0</tlib-version> - <jsp-version>2.1</jsp-version> - <short-name>j4p</short-name> - <uri>http://jsf4portlets.sf.net/tld/jsf4portlets_1_0.tld</uri> - <display-name>JSF 4 Portlets TagLib</display-name> - - <listener> - <listener-class> - net.sf.jsf4portlets.config.ApplicationConfiguration - </listener-class> - </listener> - - <tag> - <name>portletPage</name> - <tag-class> - net.sf.jsf4portlets.ext.PortletPageTag - </tag-class> - <body-content>JSP</body-content> - <display-name>PortletPage Tag</display-name> - <description> - PortletPage component tag handler. - </description> - </tag> -</taglib> \ No newline at end of file Added: trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider =================================================================== --- trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider (rev 0) +++ trunk/jsf4portlets/src/main/resources/META-INF/services/net.sf.jsf4portlets.spi.InjectionProvider 2007-09-26 17:47:31 UTC (rev 29) @@ -0,0 +1 @@ +net.sf.jsf4portlets.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor \ No newline at end of file Modified: trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties =================================================================== --- trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-09-26 17:47:31 UTC (rev 29) @@ -62,3 +62,8 @@ J4P_000042=J4P000042: Exception caught when delegating the faces request during renderView. J4P_000043=J4P000043: Portlet {0} has init param {1} but it is deprecated. It should be replaced by {2}. J4P_000044=J4P000044: Using {0} as view root for portlet {1} +J4P_000045=J4P000045: Injection method {0} should not be declared 'static' for annotation {1}. +J4P_000046=J4P000046: Return type of injection method {0} should be 'void' for annotation {1}. +J4P_000047=J4P000047: Injection method {0} should be declared with no parameters for annotation {1}. +J4P_000048=J4P000048: Injection method {0} should thrown no checked exceptions for annotation {1}. +J4P_000049=J4P000049: Cannot read injection provider service. Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets-ext/pom.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -12,6 +12,11 @@ <name>JSF 4 Portlets Extensions</name> + <description> + This is the extensions module of JSF 4 Portlets. This module brings some + additional features to the bridge implementation like Facelets support and more. + </description> + <dependencies> <dependency> <groupId>javax.el</groupId> @@ -47,10 +52,7 @@ <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets</artifactId> </dependency> - <dependency> - <groupId>org.ajax4jsf</groupId> - <artifactId>ajax4jsf</artifactId> - </dependency> + <dependency> <groupId>com.sun.facelets</groupId> <artifactId>jsf-facelets</artifactId> @@ -76,10 +78,6 @@ <groupId>net.sourceforge.maven-taglib</groupId> <artifactId>maven-taglib-plugin</artifactId> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-changelog-plugin</artifactId> - </plugin> </plugins> </reporting> Modified: trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -27,32 +27,4 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> - <lifecycle> - <phase-listener> - net.sf.jsf4portlets.ajax.AjaxPortletLifecycleListener - </phase-listener> - </lifecycle> - - <managed-bean> - <managed-bean-name>ajaxContext</managed-bean-name> - <managed-bean-class> - net.sf.jsf4portlets.ajax.AjaxPortletContext - </managed-bean-class> - <managed-bean-scope>request</managed-bean-scope> - </managed-bean> - - <render-kit> - <renderer> - <component-family> - javax.faces.ViewRoot - </component-family> - <renderer-type> - javax.faces.ViewRoot - </renderer-type> - <renderer-class> - net.sf.jsf4portlets.ajax.AjaxPortletViewRootRenderer - </renderer-class> - </renderer> - </render-kit> - </faces-config> \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/pom.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -119,10 +119,10 @@ <groupId>net.sourceforge.maven-taglib</groupId> <artifactId>maven-taglib-plugin</artifactId> </plugin> - <plugin> + <!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> - </plugin> + </plugin>--> </plugins> </reporting> @@ -191,9 +191,9 @@ </dependency> <dependency> - <groupId>org.ajax4jsf</groupId> - <artifactId>ajax4jsf</artifactId> - <version>1.1.1</version> + <groupId>org.apache.tomcat</groupId> + <artifactId>catalina</artifactId> + <version>6.0.13</version> <scope>compile</scope> <optional>true</optional> </dependency> Modified: trunk/src/assembly/bin.xml =================================================================== --- trunk/src/assembly/bin.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/assembly/bin.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -38,11 +38,14 @@ <binaries> <outputDirectory>/lib</outputDirectory> <unpack>false</unpack> - <includeDependecies>false</includeDependencies> <dependencySets> <dependencySet> <outputDirectory>/lib</outputDirectory> <scope>runtime</scope> + <excludes> + <exclude>org.apache.tomcat:*</exclude> + <exclude>com.sun.facelets:*</exclude> + </excludes> </dependencySet> </dependencySets> </binaries> @@ -57,6 +60,10 @@ </includes> </fileSet> <fileSet> + <directory>src/legal</directory> + <outputDirectory>/lib</outputDirectory> + </fileSet> + <fileSet> <directory>target</directory> <outputDirectory>/</outputDirectory> <includes> @@ -65,14 +72,14 @@ </fileSet> <fileSet> <directory>target/site/apidocs</directory> - <outputDirectory>/apidocs</outputDirectory> + <outputDirectory>/doc/apidocs</outputDirectory> <includes> <include>**/*</include> </includes> </fileSet> <fileSet> <directory>target/site/tlddoc</directory> - <outputDirectory>/tlddocs</outputDirectory> + <outputDirectory>/doc/tlddocs</outputDirectory> <includes> <include>**/*</include> </includes> Copied: trunk/src/legal (from rev 28, trunk/jsf4portlets/src/legal) Copied: trunk/src/site (from rev 28, trunk/jsf4portlets/src/site) Modified: trunk/src/site/apt/download.apt =================================================================== --- trunk/jsf4portlets/src/site/apt/download.apt 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/site/apt/download.apt 2007-09-26 17:47:31 UTC (rev 29) @@ -1,3 +1,25 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + --- Download JSF 4 Portlets --- @@ -8,11 +30,37 @@ Downloads for JSF 4 Portlets are served by {{{http://www.sourceforge.net}SourceForge.net}}, you can access the global project downloads through the following link {{http://sourceforge.net/project/showfiles.php?group_id=196120}}. -* Current Release : 1.0-alpha-1 +* Current Release : 1.0-alpha-2 + Implements JSR-301 Early Draft 2 + ** Binary Distributions *----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Windows (*.zip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-bin.zip?modtime=1180909157&big_mirror=0}jsf4portlets-1.0-alpha-2-bin.zip}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Unix (gzip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-bin.tar.gz?modtime=1180909046&big_mirror=0}jsf4portlets-1.0-alpha-2-bin.tar.gz}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Unix (bzip2) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-bin.tar.bz2?modtime=1180909014&big_mirror=0}jsf4portlets-1.0-alpha-2-bin.tar.bz2}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +** Source Distributions + +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Windows (*.zip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-src.zip?modtime=1180909373&big_mirror=0}jsf4portlets-1.0-alpha-2-src.zip}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Unix (gzip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-src.tar.gz?modtime=1180909345&big_mirror=0}jsf4portlets-1.0-alpha-2-src.tar.gz}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + Unix (bzip2) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-2-src.tar.bz2?modtime=1180909325&big_mirror=0}jsf4portlets-1.0-alpha-2-src.tar.bz2}} | +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +* Older release : 1.0-alpha-1 + + Implements JSR-301 Early Draft 1 + +** Binary Distributions + +*----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ Windows (*.zip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-1-bin.zip?modtime=1180909157&big_mirror=0}jsf4portlets-1.0-alpha-1-bin.zip}} | *----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ Unix (gzip) | {{{http://downloads.sourceforge.net/jsf4portlets/jsf4portlets-1.0-alpha-1-bin.tar.gz?modtime=1180909046&big_mirror=0}jsf4portlets-1.0-alpha-1-bin.tar.gz}} | Modified: trunk/src/site/apt/release_notes.apt =================================================================== --- trunk/jsf4portlets/src/site/apt/release_notes.apt 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/site/apt/release_notes.apt 2007-09-26 17:47:31 UTC (rev 29) @@ -1 +1,23 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + JSF 4 Portlets - Release Notes Modified: trunk/src/site/apt/user_docs.apt =================================================================== --- trunk/jsf4portlets/src/site/apt/user_docs.apt 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/site/apt/user_docs.apt 2007-09-26 17:47:31 UTC (rev 29) @@ -1,3 +1,25 @@ +~~ +~~ JSF 4 Portlets - JSF Portlet Bridge (JSR-301) +~~ Copyright (C) 2007 A. Alonso Dominguez +~~ +~~ This library is free software; you can redistribute it and/or +~~ modify it under the terms of the GNU Lesser General Public +~~ License as published by the Free Software Foundation; either +~~ version 2.1 of the License, or (at your option) any later version. +~~ +~~ This library is distributed in the hope that it will be useful, +~~ but WITHOUT ANY WARRANTY; without even the implied warranty of +~~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +~~ Lesser General Public License for more details. +~~ +~~ You should have received a copy of the GNU Lesser General Public +~~ License along with this library; if not, write to the Free Software +~~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +~~ +~~ A. Alonso Dominguez +~~ alo...@us... +~~ + --- Using JSF 4 Portlets --- @@ -48,6 +70,8 @@ </context-param> +--- + This context init parameter is useful when we have more than one implementation of the JSF Portlet Bridge in the classpath, so we need to specify which of the current implementations of the Bridge interface must be used by our portlets. + ** Basic Portlet Configuration So, the last work is to configure the <<<javax.portlet.faces.GenericFacesPortlet>>>. This portlet will delegate all work to the bridge implementation. This portlet needs at least one init parameter so it can know the default <<<viewId>>> to be rendered when no <<<viewId>>> has been requested. Following there is an example: @@ -77,6 +101,7 @@ ** Bridge Parameters JSF portlets have the ability to preserve its action parameters during the render phase and to perform redirects againts the portal. This two features are disabled by default so they must be configured so portlets can take advantage of them. + If you want to configure this two features to every portlet in the same web application you must set the following in your <<<WEB-INF/web.xml>>> file. You can also specify these parameters in the <<<WEB-INF/portlet.xml>>> file as portlet init parameters. *** Performing redirects againts the portal page: @@ -90,17 +115,60 @@ *** Preserving action parameters + This attribute is used when we need access the portlet parameters which caused the current view to be rendered during the render phase. This parameters can be accessed using EL expressions like <<<#\{param.[param_name]\}>>>. + +--- <context-param> - <param-name>javax.portlet.faces.PRESERVE_ACTION_PARAMS</param-name> + <param-name>javax.portlet.faces.preserveActionParams</param-name> <param-value>true</param-value> </context-param> +--- +** Portlet Render Policy + + This is a special feature of the JSF Portlet Bridge. The render policy stablishes if the bridge should delegate rendering to parent view handlers. Delegation of the render operation depends of 3 different possible values: + + [DEFAULT] Renders the current view delegating the render operation to the parent <<<ViewHandler>>>. If this operation throws any exception, then the bridge will try to render the output by itself. + + [ALWAYS_DELEGATE] Always delegate the render operation to the parent <<<ViewHandler>>>. If this operation throws any exception, it should be caught by the <<<GenericFacesPortlet>>> and rethrown as a <<<PortletException>>>. + + [NEVER_DELEGATE] Never delegate the render operation to the parent <<<ViewHandler>>>. The bridge will always try to render the current view by itself. + + The default behaivour is <<<DEFAULT>>>, if we need to change this, we must stablish a portlet init parameter like below: + ++--- +<portlet> + ... + + <init-param> + <name>javax.portlet.faces.renderPolicy</name> + <value>NEVER_DELEGATE</value> + </init-param> + + ... +</portlet> ++--- + + This feature allows retaining the natural order of non-Faces and Faces output when both exists in the same JSP file. Because JSR-168 doesn't allows request/response wrapping, we need to configure a servlet filter around the Faces' servlet like following: + ++--- +<filter> + <filter-name>Faces Portlet Render Filter</filter-name> + <filter-class>javax.portlet.faces.BridgeRenderFilter</filter-class> +</filter> + +<filter-mapping> + <filter-name>Faces Portlet Render Filter</filter-name> + <servlet-name>FacesServlet</servlet-name> + <dispatcher>INCLUDE</dispatcher> +</filter-mapping> ++--- + ** Portlet Modes - JSF 4 Porlets supports portlets with 3 different portlet modes: <<<VIEW>>>, <<<EDIT>>> and <<<HELP>>>, in the future custom portlet modes will also be supported. Every portlet needs to configure the <<<VIEW>>> mode as the default, <<<EDIT>>> and <<<HELP>>> modes are optional. - Each portlet mode has a corresponding portlet init parameter so portlet can stablish the default viewId for the current portlet mode: + JSF 4 Porlets supports portlets with standard portlet modes (<<<VIEW>>>, <<<EDIT>>> and <<<HELP>>>) and custom portlet modes. Every portlet needs to configure the <<<VIEW>>> mode as the default, <<<EDIT>>> and <<<HELP>>> modes are optional. Custom portlet modes must be defined in <<<portlet.xml>>> to become available. + + Each portlet mode has a corresponding portlet init parameter so portlet can stablish the default viewId for the current portlet mode. When a portlet receives a PortletRequest for portlet mode which has not been configured, a <<<BridgeDefaultViewNotSpecifiedException>>> is thrown. *** View @@ -124,7 +192,16 @@ +--- <init-param> - <name>javax.portlet.faces.defaultViewId</name> + <name>javax.portlet.faces.defaultViewId.help</name> <value>/help.jsf</value> </init-param> +--- + +*** Custom Portlet Modes + ++--- +<init-param> + <name>javax.portlet.faces.defaultViewId.[custom_portlet_mode]</name> + <value>/custom.jsf</value> +</init-param> ++--- \ No newline at end of file Modified: trunk/src/site/site.xml =================================================================== --- trunk/jsf4portlets/src/site/site.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/site/site.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -50,9 +50,10 @@ <menu name="Documentation"> <item name="User Documentation" href="user_docs.html" /> <item name="Java Docs" href="apidocs/index.html" /> - <item name="Taglib Docs" href="tlddoc/index.html" /> </menu> + <menu ref="modules" /> + <menu ref="reports" /> </body> </project> Modified: trunk/src/site/xdoc/getting_started.xml =================================================================== --- trunk/jsf4portlets/src/site/xdoc/getting_started.xml 2007-09-06 17:28:35 UTC (rev 28) +++ trunk/src/site/xdoc/getting_started.xml 2007-09-26 17:47:31 UTC (rev 29) @@ -36,7 +36,7 @@ <p>Copy distributed libraries into directory <tt>[TOMCAT_HOME]/lib</tt>. The result must to be like following:</p> <source><![CDATA[ [TOMCAT_HOME]/lib/... -[TOMCAT_HOME]/lib/jsf4portlets-1.0-alpha-1.jar +[TOMCAT_HOME]/lib/jsf4portlets-1.0-alpha-2.jar [TOMCAT_HOME]/lib/commons-digester-1.8.jar [TOMCAT_HOME]/lib/commons-beanutils-1.7.0.jar [TOMCAT_HOME]/lib/commons-logging-1.1.jar @@ -49,7 +49,7 @@ <p>Copy distributed libraries into <tt>/lib</tt> directory inside the domain tree. The result must be like the following.</p> <source><![CDATA[ [DOMAIN_HOME]/lib/... -[DOMAIN_HOME]/lib/jsf4portlets-1.0-alpha-1.jar +[DOMAIN_HOME]/lib/jsf4portlets-1.0-alpha-2.jar [DOMAIN_HOME]/lib/commons-digester-1.8.jar [DOMAIN_HOME]/lib/commons-beanutils-1.7.0.jar [DOMAIN_HOME]/lib/commons-logging-1.1.jar @@ -69,7 +69,7 @@ <context-param> <param-name> - javax.portlet.faces.extension.bridgeClass + javax.portlet.faces.BridgeClassName </param-name> <param-value> net.sf.jsf4portlets.BridgeImpl @@ -86,7 +86,7 @@ ... <init-param> <name> - javax.portlet.faces.extension.bridgeClass + javax.portlet.faces.BridgeClassName </name> <value> net.sf.jsf4portlets.BridgeImpl @@ -117,7 +117,7 @@ ]]></source> </subsection> <subsection name="JSF Portlet configuration"> - <p>JSF 4 Portlet requires at least one parameter to be configured in <tt>portlet.xml</tt> for each portlet. This parameter is <tt>javax.portlet.faces.extension.INIT_VIEW</tt> and it's needed to know the first view to be rendered when no viewId has been requested.</p> + <p>JSF 4 Portlet requires at least one parameter to be configured in <tt>portlet.xml</tt> for each portlet. This parameter is <code>javax.portlet.faces.defaultViewId.view</code> and it's needed to know the first view to be rendered when no viewId has been requested.</p> <source><![CDATA[ <portlet-app ...> @@ -128,7 +128,7 @@ </portlet-class> <init-param> - <name>javax.portlet.faces.extension.INIT_VIEW</name> + <name>javax.portlet.faces.defaultViewId.view</name> <value>/path/to/viewId</value> </init-param> </portlet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-06 17:28:37
|
Revision: 28 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=28&view=rev Author: alonsoft Date: 2007-09-06 10:28:35 -0700 (Thu, 06 Sep 2007) Log Message: ----------- Added facelet support Added Paths: ----------- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/facelets/FaceletPortletViewHandler.java 2007-09-06 17:28:35 UTC (rev 28) @@ -0,0 +1,50 @@ +package net.sf.jsf4portlets.facelets; + +import java.io.IOException; +import java.io.StringWriter; + +import javax.faces.FacesException; +import javax.faces.application.ViewHandler; +import javax.faces.context.FacesContext; +import javax.faces.context.ExternalContext; +import javax.faces.context.ResponseWriter; +import javax.faces.render.RenderKit; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import com.sun.facelets.FaceletViewHandler; + +public class FaceletPortletViewHandler extends FaceletViewHandler { + + public FaceletPortletViewHandler(ViewHandler parent) { + super(parent); + } + + protected ResponseWriter createResponseWriter(FacesContext context) + throws FacesException, IOException { + ExternalContext extContext = context.getExternalContext(); + RenderKit renderKit = context.getRenderKit(); + + RenderRequest request = (RenderRequest) extContext.getRequest(); + RenderResponse response = (RenderResponse) extContext.getResponse(); + + String contentType = request.getResponseContentType(); + if(contentType == null) { + contentType = "text/html"; + } + + String encoding = response.getCharacterEncoding(); + if(encoding == null) { + encoding = "ISO-8859-1"; + } + + ResponseWriter writer = renderKit.createResponseWriter( + new StringWriter(), contentType, encoding); + contentType = writer.getContentType(); + response.setContentType(contentType); + + writer = writer.cloneWithWriter(response.getWriter()); + return writer; + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-09-03 09:53:03
|
Revision: 27 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=27&view=rev Author: alonsoft Date: 2007-09-03 01:08:54 -0700 (Mon, 03 Sep 2007) Log Message: ----------- Fixed parent's pom.xml Modified Paths: -------------- trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/ViewHandlerImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties trunk/jsf4portlets-ext/pom.xml trunk/pom.xml Added Paths: ----------- trunk/jsf4portlets-ext/src/ trunk/jsf4portlets-ext/src/main/ trunk/jsf4portlets-ext/src/main/java/ trunk/jsf4portlets-ext/src/main/java/net/ trunk/jsf4portlets-ext/src/main/java/net/sf/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxConstants.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletContext.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletLifecycleListener.java trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletViewRootRenderer.java trunk/jsf4portlets-ext/src/main/resources/ trunk/jsf4portlets-ext/src/main/resources/META-INF/ trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml Modified: trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java =================================================================== --- trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java 2007-09-03 08:08:54 UTC (rev 27) @@ -63,7 +63,7 @@ if (additionalId != null) return namespace + additionalId; else - return namespace; + return namespace.substring(0, namespace.length() - 1); } else { return null; } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/ViewHandlerImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/ViewHandlerImpl.java 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/application/ViewHandlerImpl.java 2007-09-03 08:08:54 UTC (rev 27) @@ -42,6 +42,7 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.RenderKit; import javax.faces.render.RenderKitFactory; +import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import javax.portlet.RenderResponse; import javax.portlet.faces.Bridge; @@ -52,6 +53,7 @@ import net.sf.jsf4portlets.BridgeConstants; import net.sf.jsf4portlets.config.PortletConfiguration; import net.sf.jsf4portlets.config.PortletConfiguration.PortletParameter; +import net.sf.jsf4portlets.util.Util; public class ViewHandlerImpl extends ViewHandlerWrapper { @@ -98,6 +100,14 @@ viewRoot.getClass().getName())) { viewRoot = new PortletNamingContainerUIViewRoot(viewRoot); } + + if(logger.isLoggable(Level.FINE)) { + PortletConfig portletConfig = Util + .getPortletConfig(context.getExternalContext()); + logger.log(Level.FINE, "J4P_000044", new Object[]{ + viewRoot.getClass().getName(), portletConfig.getPortletName() + }); + } } return viewRoot; } Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-09-03 08:08:54 UTC (rev 27) @@ -206,8 +206,8 @@ portletURL.setParameter(BridgeConstants.VIEW_ID_PARAMETER, viewId); result = portletURL.toString(); } else if(PortletPhase.ActionPhase.equals(phase)) { - //RequestScope requestScope = Util.getRequestScope(this); - //requestScope.setParameters(qs.getParameterMap()); + RequestScope requestScope = Util.getRequestScope(this); + requestScope.setParameters(qs.getParameterMap()); result = viewId; } else { throw new IllegalStateException(); @@ -430,10 +430,8 @@ viewId = requestScope.getViewId(); } } else if(PortletPhase.ActionPhase.equals(phase)) { - if(viewId == null) { - viewId = getRequestParameterMap().get( + viewId = getRequestParameterMap().get( BridgeConstants.VIEW_ID_PARAMETER); - } } if(viewId == null) { viewId = (String) getRequestMap().get( Modified: trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java =================================================================== --- trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets/src/main/java/net/sf/jsf4portlets/context/FacesContextImpl.java 2007-09-03 08:08:54 UTC (rev 27) @@ -92,6 +92,7 @@ } this.econtext = econtext; this.lifecycle = lifecycle; + setCurrentInstance(this); logger.log(Level.FINEST, "J4P_000031", this); } @@ -260,6 +261,7 @@ renderResponse = false; responseComplete = false; viewRoot = null; + // Make sure to clear our ThreadLocal instance. setCurrentInstance(null); } Modified: trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties =================================================================== --- trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets/src/main/resources/net/sf/jsf4portlets/LogMessages.properties 2007-09-03 08:08:54 UTC (rev 27) @@ -60,4 +60,5 @@ J4P_000040=J4P000040: Executing faces context previous to render. J4P_000041=J4P000041: RestoreView phase has been invoked during bridge's RENDER_PHASE. Cortocircuiting faces lifecycle. J4P_000042=J4P000042: Exception caught when delegating the faces request during renderView. -J4P_000043=J4P000043: Portlet {0} has init param {1} but it is deprecated. It should be replaced by {2}. +J4P_000043=J4P000043: Portlet {0} has init param {1} but it is deprecated. It should be replaced by {2}. +J4P_000044=J4P000044: Using {0} as view root for portlet {1} Modified: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/jsf4portlets-ext/pom.xml 2007-09-03 08:08:54 UTC (rev 27) @@ -44,9 +44,22 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets</artifactId> + </dependency> + <dependency> + <groupId>org.ajax4jsf</groupId> + <artifactId>ajax4jsf</artifactId> </dependency> + <dependency> + <groupId>com.sun.facelets</groupId> + <artifactId>jsf-facelets</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> </dependencies> <reporting> @@ -71,26 +84,6 @@ </reporting> <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/bin.xml</descriptor> - <descriptor>src/assembly/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> </build> </project> Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxConstants.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxConstants.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxConstants.java 2007-09-03 08:08:54 UTC (rev 27) @@ -0,0 +1,16 @@ +package net.sf.jsf4portlets.ajax; + +public final class AjaxConstants { + + public static final String ACTION_URL_PARAM = + "org.ajax4jsf.portlet.ACTION_URL"; + + public static final String NAMESPACE_PARAM = + "org.ajax4jsf.portlet.NAMESPACE"; + + public static final String PORTLET_MODE_PARAM = + "org.ajax4jsf.portlet.PORTLET_MODE"; + + private AjaxConstants() { } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletContext.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletContext.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletContext.java 2007-09-03 08:08:54 UTC (rev 27) @@ -0,0 +1,61 @@ +package net.sf.jsf4portlets.ajax; + +import javax.faces.component.UIViewRoot; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +import org.ajax4jsf.framework.ajax.AjaxContext; +import org.ajax4jsf.framework.util.config.WebXml; + +public class AjaxPortletContext extends AjaxContext { + + @Override + public String getAjaxActionURL(FacesContext context) { + if(context == null) { + throw new NullPointerException("FacesContext is null"); + } + + UIViewRoot viewRoot = context.getViewRoot(); + if(viewRoot == null) { + throw new NullPointerException("Faces' view tree is null"); + } + + String viewId = viewRoot.getViewId(); + if(viewId == null) { + throw new NullPointerException("Faces' viewId is null"); + } + if(!viewId.startsWith("/")) { + throw new IllegalArgumentException("Illegal viewId: " + viewId); + } + + ExternalContext externalContext = context.getExternalContext(); + WebXml webXml = (WebXml) externalContext + .getApplicationMap().get(WebXml.CONTEXT_ATTRIBUTE); + if(webXml == null) { + throw new IllegalStateException("Ajax Filter not properly configured"); + } + + StringBuffer actionURL = new StringBuffer( + externalContext.getRequestContextPath()); + if(webXml.isPrefixMapping()) { + String facesFilterPrefix = webXml.getFacesFilterPrefix(); + if(facesFilterPrefix.endsWith("/")) { + facesFilterPrefix = facesFilterPrefix + .substring(0, facesFilterPrefix.length() - 1); + } + actionURL.append(facesFilterPrefix).append(viewId); + } else { + int dot = viewId.lastIndexOf('.'); + if(dot < 0) { + actionURL.append(viewId).append( + webXml.getFacesFilterSuffix()); + } else { + actionURL.append(viewId.substring(0, dot)) + .append(webXml.getFacesFilterSuffix()); + } + } + + return externalContext.encodeActionURL(actionURL.toString()); + } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletLifecycleListener.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletLifecycleListener.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletLifecycleListener.java 2007-09-03 08:08:54 UTC (rev 27) @@ -0,0 +1,52 @@ +package net.sf.jsf4portlets.ajax; + +import javax.faces.application.ViewHandler; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; +import javax.portlet.RenderRequest; +import javax.portlet.faces.component.PortletNamingContainer; +import javax.portlet.faces.component.PortletNamingContainerUIViewRoot; + +import org.ajax4jsf.framework.ajax.AjaxContext; + +public class AjaxPortletLifecycleListener implements PhaseListener { + + public void afterPhase(PhaseEvent event) {} + + @SuppressWarnings("unchecked") + public void beforePhase(PhaseEvent event) { + FacesContext context = event.getFacesContext(); + ViewHandler viewHandler = context.getApplication().getViewHandler(); + RenderRequest request = (RenderRequest) context + .getExternalContext().getRequest(); + + AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context); + String viewId = context.getViewRoot().getViewId(); + String actionURL = viewHandler.getActionURL(context, viewId); + ajaxContext.getCommonAjaxParameters().put( + AjaxConstants.ACTION_URL_PARAM, actionURL); + + String portletMode = request.getPortletMode().toString(); + ajaxContext.getCommonAjaxParameters().put( + AjaxConstants.PORTLET_MODE_PARAM, portletMode); + + String namespace; + UIViewRoot viewRoot = context.getViewRoot(); + if(viewRoot instanceof PortletNamingContainer) { + namespace = viewRoot.getClientId(context); + } else { + namespace = PortletNamingContainerUIViewRoot.getContainerClientId( + context, viewRoot.getContainerClientId(context)); + } + ajaxContext.getCommonAjaxParameters().put( + AjaxConstants.NAMESPACE_PARAM, namespace); + } + + public PhaseId getPhaseId() { + return PhaseId.RENDER_RESPONSE; + } + +} Added: trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletViewRootRenderer.java =================================================================== --- trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletViewRootRenderer.java (rev 0) +++ trunk/jsf4portlets-ext/src/main/java/net/sf/jsf4portlets/ajax/AjaxPortletViewRootRenderer.java 2007-09-03 08:08:54 UTC (rev 27) @@ -0,0 +1,56 @@ +package net.sf.jsf4portlets.ajax; + +import java.io.IOException; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.context.ResponseWriter; +import javax.portlet.faces.component.PortletNamingContainerUIViewRoot; + +import org.ajax4jsf.framework.ajax.AjaxContext; +import org.ajax4jsf.framework.renderer.AjaxContainerRenderer; +import org.ajax4jsf.framework.renderer.AjaxRendererUtils; +import org.ajax4jsf.framework.renderer.AjaxViewRootRenderer; + +public class AjaxPortletViewRootRenderer extends AjaxViewRootRenderer { + + @Override + protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) + throws IOException { + AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context); + String namespace = PortletNamingContainerUIViewRoot + .getContainerClientId(context, null); + String ajaxParameterName = context.getExternalContext() + .getRequestParameterMap().get(AjaxContainerRenderer.AJAX_PARAMETER_NAME); + + if(!ajaxContext.isAjaxRequest() && null != namespace && null != ajaxParameterName) { + // Navigation, encode window + writer.startElement("div", component); + writer.writeAttribute("id", namespace, null); + } + + super.doEncodeBegin(writer, context, component); + } + + @Override + protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) + throws IOException { + super.doEncodeEnd(writer, context, component); + + AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context); + String namespace = PortletNamingContainerUIViewRoot + .getContainerClientId(context, null); + String ajaxParameterName = context.getExternalContext() + .getRequestParameterMap().get(AjaxContainerRenderer.AJAX_PARAMETER_NAME); + + if(!ajaxContext.isAjaxRequest() && null != namespace && null != ajaxParameterName) { + writer.endElement("div"); + ajaxContext.setAjaxRequest(true); + ajaxContext.addRenderedArea(namespace); + AjaxRendererUtils.encodeAreas(context, component); + } + } + + + +} Added: trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml =================================================================== --- trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml (rev 0) +++ trunk/jsf4portlets-ext/src/main/resources/META-INF/faces-config.xml 2007-09-03 08:08:54 UTC (rev 27) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + JSF 4 Portlets - JSF Portlet Bridge (JSR-301) + Copyright (C) 2007 A. Alonso Dominguez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A. Alonso Dominguez + alo...@us... +--> + +<faces-config xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" + version="1.2"> + + <lifecycle> + <phase-listener> + net.sf.jsf4portlets.ajax.AjaxPortletLifecycleListener + </phase-listener> + </lifecycle> + + <managed-bean> + <managed-bean-name>ajaxContext</managed-bean-name> + <managed-bean-class> + net.sf.jsf4portlets.ajax.AjaxPortletContext + </managed-bean-class> + <managed-bean-scope>request</managed-bean-scope> + </managed-bean> + + <render-kit> + <renderer> + <component-family> + javax.faces.ViewRoot + </component-family> + <renderer-type> + javax.faces.ViewRoot + </renderer-type> + <renderer-class> + net.sf.jsf4portlets.ajax.AjaxPortletViewRootRenderer + </renderer-class> + </renderer> + </render-kit> + +</faces-config> \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-08-23 17:29:22 UTC (rev 26) +++ trunk/pom.xml 2007-09-03 08:08:54 UTC (rev 27) @@ -74,7 +74,7 @@ </distributionManagement> <modules> - <module>jsf4portlets-core</module> + <module>jsf4portlets</module> <module>jsf4portlets-ext</module> </modules> @@ -89,7 +89,7 @@ <target>1.5</target> </configuration> </plugin> - <plugins> + </plugins> </pluginManagement> <plugins> <plugin> @@ -191,18 +191,34 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> + <groupId>org.ajax4jsf</groupId> + <artifactId>ajax4jsf</artifactId> + <version>1.1.1</version> + <scope>compile</scope> + <optional>true</optional> </dependency> <dependency> + <groupId>com.sun.facelets</groupId> + <artifactId>jsf-facelets</artifactId> + <version>1.1.11</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets</artifactId> <version>${pom.version}</version> <scope>compile</scope> </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> </dependencies> </dependencyManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-08-23 17:29:24
|
Revision: 26 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=26&view=rev Author: alonsoft Date: 2007-08-23 10:29:22 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Revision of maven files. Modified Paths: -------------- trunk/jsf4portlets/pom.xml trunk/pom.xml trunk/src/assembly/bin.xml Added Paths: ----------- trunk/src/ trunk/src/assembly/ Removed Paths: ------------- trunk/jsf4portlets/src/assembly/ Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets/pom.xml 2007-08-23 17:18:01 UTC (rev 25) +++ trunk/jsf4portlets/pom.xml 2007-08-23 17:29:22 UTC (rev 26) @@ -71,26 +71,6 @@ </reporting> <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/bin.xml</descriptor> - <descriptor>src/assembly/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> </build> </project> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-08-23 17:18:01 UTC (rev 25) +++ trunk/pom.xml 2007-08-23 17:29:22 UTC (rev 26) @@ -79,17 +79,21 @@ </modules> <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugins> + </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> @@ -123,76 +127,83 @@ </reporting> <dependencyManagement> - <dependencies> - <dependency> - <groupId>javax.el</groupId> - <artifactId>el-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.1</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.faces</groupId> - <artifactId>jsf-api</artifactId> - <version>1.2</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.annotation</groupId> - <artifactId>jsr250-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.portlet</groupId> - <artifactId>portlet-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + <version>1.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - <version>1.8</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <artifactId>avalon-framework</artifactId> - <groupId>avalon-framework</groupId> - </exclusion> - <exclusion> - <artifactId>log4j</artifactId> - <groupId>log4j</groupId> - </exclusion> - <exclusion> - <artifactId>logkit</artifactId> - <groupId>logkit</groupId> - </exclusion> - <exclusion> - <artifactId>servlet-api</artifactId> - <groupId>javax.servlet</groupId> - </exclusion> - </exclusions> - </dependency> + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + <version>1.8</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <artifactId>avalon-framework</artifactId> + <groupId>avalon-framework</groupId> + </exclusion> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + <exclusion> + <artifactId>logkit</artifactId> + <groupId>logkit</groupId> + </exclusion> + <exclusion> + <artifactId>servlet-api</artifactId> + <groupId>javax.servlet</groupId> + </exclusion> + </exclusions> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> </dependencyManagement> </project> Copied: trunk/src/assembly (from rev 25, trunk/jsf4portlets/src/assembly) Modified: trunk/src/assembly/bin.xml =================================================================== --- trunk/jsf4portlets/src/assembly/bin.xml 2007-08-23 17:18:01 UTC (rev 25) +++ trunk/src/assembly/bin.xml 2007-08-23 17:29:22 UTC (rev 26) @@ -29,6 +29,25 @@ <format>tar.bz2</format> <format>zip</format> </formats> + <moduleSets> + <moduleSet> + <includes> + <include>net.sf.jsf4portlets:jsf4portlets</include> + <include>net.sf.jsf4portlets:jsf4portlets-ext</include> + </includes> + <binaries> + <outputDirectory>/lib</outputDirectory> + <unpack>false</unpack> + <includeDependecies>false</includeDependencies> + <dependencySets> + <dependencySet> + <outputDirectory>/lib</outputDirectory> + <scope>runtime</scope> + </dependencySet> + </dependencySets> + </binaries> + </moduleSet> + </moduleSets> <fileSets> <fileSet> <includes> @@ -59,10 +78,4 @@ </includes> </fileSet> </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>/lib</outputDirectory> - <scope>runtime</scope> - </dependencySet> - </dependencySets> </assembly> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-08-23 17:18:03
|
Revision: 25 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=25&view=rev Author: alonsoft Date: 2007-08-23 10:18:01 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Redistribution of project components Modified Paths: -------------- trunk/jsf4portlets/pom.xml Added Paths: ----------- trunk/jsf4portlets/ Removed Paths: ------------- trunk/jsf4portlets-core/ Copied: trunk/jsf4portlets (from rev 24, trunk/jsf4portlets-core) Modified: trunk/jsf4portlets/pom.xml =================================================================== --- trunk/jsf4portlets-core/pom.xml 2007-08-23 17:11:29 UTC (rev 24) +++ trunk/jsf4portlets/pom.xml 2007-08-23 17:18:01 UTC (rev 25) @@ -7,7 +7,7 @@ <version>1.0-alpha-2-SNAPSHOT</version> </parent> - <artifactId>jsf4portlets-core</artifactId> + <artifactId>jsf4portlets</artifactId> <packaging>jar</packaging> <name>JSF 4 Portlets Core</name> @@ -71,7 +71,6 @@ </reporting> <build> - <finalName>jsf4portlets</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-08-23 17:11:48
|
Revision: 24 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=24&view=rev Author: alonsoft Date: 2007-08-23 10:11:29 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Redistribution of project components Modified Paths: -------------- trunk/pom.xml Added Paths: ----------- trunk/jsf4portlets-core/ trunk/jsf4portlets-core/pom.xml trunk/jsf4portlets-core/src/ trunk/jsf4portlets-core/src/assembly/ trunk/jsf4portlets-core/src/legal/ trunk/jsf4portlets-core/src/main/ trunk/jsf4portlets-core/src/site/ trunk/jsf4portlets-core/src/test/ trunk/jsf4portlets-ext/ trunk/jsf4portlets-ext/pom.xml Removed Paths: ------------- trunk/jsf4portlets-core/src/assembly/ trunk/jsf4portlets-core/src/legal/ trunk/jsf4portlets-core/src/main/ trunk/jsf4portlets-core/src/site/ trunk/jsf4portlets-core/src/test/ trunk/src/ Copied: trunk/jsf4portlets-core/pom.xml (from rev 21, trunk/pom.xml) =================================================================== --- trunk/jsf4portlets-core/pom.xml (rev 0) +++ trunk/jsf4portlets-core/pom.xml 2007-08-23 17:11:29 UTC (rev 24) @@ -0,0 +1,97 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-2-SNAPSHOT</version> + </parent> + + <artifactId>jsf4portlets-core</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets Core</name> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <build> + <finalName>jsf4portlets</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/bin.xml</descriptor> + <descriptor>src/assembly/src.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> + +</project> Copied: trunk/jsf4portlets-core/src (from rev 21, trunk/src) Copied: trunk/jsf4portlets-core/src/assembly (from rev 23, trunk/src/assembly) Copied: trunk/jsf4portlets-core/src/legal (from rev 23, trunk/src/legal) Copied: trunk/jsf4portlets-core/src/main (from rev 23, trunk/src/main) Copied: trunk/jsf4portlets-core/src/site (from rev 23, trunk/src/site) Copied: trunk/jsf4portlets-core/src/test (from rev 23, trunk/src/test) Added: trunk/jsf4portlets-ext/pom.xml =================================================================== --- trunk/jsf4portlets-ext/pom.xml (rev 0) +++ trunk/jsf4portlets-ext/pom.xml 2007-08-23 17:11:29 UTC (rev 24) @@ -0,0 +1,96 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>net.sf.jsf4portlets</groupId> + <artifactId>jsf4portlets-project</artifactId> + <version>1.0-alpha-2-SNAPSHOT</version> + </parent> + + <artifactId>jsf4portlets-ext</artifactId> + <packaging>jar</packaging> + + <name>JSF 4 Portlets Extensions</name> + + <dependencies> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + </dependency> + <dependency> + <groupId>javax.faces</groupId> + <artifactId>jsf-api</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + </dependency> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/bin.xml</descriptor> + <descriptor>src/assembly/src.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> + +</project> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-08-21 15:07:12 UTC (rev 23) +++ trunk/pom.xml 2007-08-23 17:11:29 UTC (rev 24) @@ -2,10 +2,10 @@ <modelVersion>4.0.0</modelVersion> <groupId>net.sf.jsf4portlets</groupId> - <artifactId>jsf4portlets</artifactId> + <artifactId>jsf4portlets-project</artifactId> <version>1.0-alpha-2-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>pom</packaging> <name>JSF 4 Portlets</name> <url>http://jsf4portlets.sf.net/</url> @@ -73,6 +73,56 @@ </snapshotRepository> </distributionManagement> + <modules> + <module>jsf4portlets-core</module> + <module>jsf4portlets-ext</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/bin.xml</descriptor> + <descriptor>src/assembly/src.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <dependencyManagement> <dependencies> <dependency> <groupId>javax.el</groupId> @@ -143,49 +193,6 @@ <scope>test</scope> </dependency> </dependencies> + </dependencyManagement> - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-project-info-reports-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <groupId>net.sourceforge.maven-taglib</groupId> - <artifactId>maven-taglib-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-changelog-plugin</artifactId> - </plugin> - </plugins> - </reporting> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/bin.xml</descriptor> - <descriptor>src/assembly/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> - </build> - </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-08-21 15:07:14
|
Revision: 23 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=23&view=rev Author: alonsoft Date: 2007-08-21 08:07:12 -0700 (Tue, 21 Aug 2007) Log Message: ----------- Early Draft 2 Update Modified Paths: -------------- trunk/src/main/java/javax/portlet/faces/Bridge.java trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java trunk/src/main/java/net/sf/jsf4portlets/BridgeConstants.java trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java trunk/src/main/java/net/sf/jsf4portlets/application/BridgeLifecycleListener.java trunk/src/main/java/net/sf/jsf4portlets/application/ViewHandlerImpl.java trunk/src/main/java/net/sf/jsf4portlets/config/PortletConfiguration.java trunk/src/main/java/net/sf/jsf4portlets/context/ApplicationMap.java trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java trunk/src/main/java/net/sf/jsf4portlets/context/RenderRequestParameterMap.java trunk/src/main/java/net/sf/jsf4portlets/context/RenderRequestParameterValuesMap.java trunk/src/main/java/net/sf/jsf4portlets/context/SessionMap.java trunk/src/main/java/net/sf/jsf4portlets/ext/PortletPageTag.java trunk/src/main/java/net/sf/jsf4portlets/ext/UIPortletPage.java trunk/src/main/java/net/sf/jsf4portlets/util/PathString.java trunk/src/main/java/net/sf/jsf4portlets/util/Util.java trunk/src/main/resources/META-INF/faces-config.xml trunk/src/main/resources/META-INF/jsf4portlets.tld trunk/src/main/resources/net/sf/jsf4portlets/LogMessages.properties trunk/src/site/apt/user_docs.apt Added Paths: ----------- trunk/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java trunk/src/main/java/javax/portlet/faces/BridgeException.java trunk/src/main/java/javax/portlet/faces/BridgeRenderFilter.java trunk/src/main/java/javax/portlet/faces/component/ trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java trunk/src/main/java/javax/portlet/faces/el/ trunk/src/main/java/javax/portlet/faces/el/PortletELResolver.java trunk/src/main/java/net/sf/jsf4portlets/RequestScopeManager.java trunk/src/main/java/net/sf/jsf4portlets/config/ApplicationConfiguration.java trunk/src/main/java/net/sf/jsf4portlets/renderkit/RenderKitFactoryWrapper.java trunk/src/main/java/net/sf/jsf4portlets/renderkit/RenderKitWrapper.java trunk/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerWrapper.java trunk/src/main/resources/META-INF/services/javax.portlet.faces.Bridge Removed Paths: ------------- trunk/src/main/java/net/sf/jsf4portlets/BridgePhase.java trunk/src/main/java/net/sf/jsf4portlets/application/EncodedByteArrayOutputStream.java trunk/src/main/java/net/sf/jsf4portlets/application/ViewHandlerResponseWrapper.java trunk/src/main/java/net/sf/jsf4portlets/el/ELConstants.java trunk/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java trunk/src/main/java/net/sf/jsf4portlets/renderkit/ResponseStateManagerImpl.java trunk/src/main/resources/javax/ Modified: trunk/src/main/java/javax/portlet/faces/Bridge.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/Bridge.java 2007-07-06 09:25:03 UTC (rev 22) +++ trunk/src/main/java/javax/portlet/faces/Bridge.java 2007-08-21 15:07:12 UTC (rev 23) @@ -3,21 +3,223 @@ import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletConfig; -import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; +/** + * The <CODE>Bridge</CODE> interface is used by a portlet to + * execute a JSF artifact. Its lifecycle follows the pattern used by other web + * components such as portlets or servlets, namely: + * <ul> + * <li><code>init</code>: one time (per portlet) initialization. Usually + * invoked during portlet <code>init</code> but may also occur + * lazily. Context is passed to the Bridge at initialization via + * <code>PortletContext</code> attributes. See method description for + * details. + * </li> + * <li><code>doFacesRequest</code>: called for each portlet request that is to + * be handled by Faces. Must only be called after the bridge has been + * initialized. + * </li> + * <li><code>destroy</code>: called to destroy this bridge instance. Usually + * invoked during portlet <code>destroy</code> but may also occur earlier + * if the portlet decides to reclaim resources. + * </li> + * </ul> + * <P> + * Portlet developers are encouraged to allow deployers an ability to configure + * the particular Bridge implementation it uses within a given deployment. This + * ensures a best fit solution for a given application server, portlet container, + * and/or Faces environment. The specifics for this configuation are undefined. + * Each portlet can define a preferred mechanism. Subclasses of + * {@link GenericFacesPortlet} automatically inherit this behavior as it + * recognizes a defined portlet initialization parameter. + * <p> + * Implementations of this <code>Bridge</code> interface are required to have + * a <code>code</code> constructor. + */ + public interface Bridge { + + // Base Bridge attribute/context parameter prefix + public static final String BRIDGE_PACKAGE_PREFIX = "javax.portlet.faces."; + + // Following are the names of context init parameters that control + // Bridge behavior. These are specified in the web.xml + + public static final String MAX_MANAGED_REQUEST_SCOPES = + BRIDGE_PACKAGE_PREFIX + "MAX_MANAGED_REQUEST_SCOPES"; + + public static final String LIFECYCLE_ID = + "javax.faces.LIFECYCLE_ID"; + + // Attribute signifying whether this render is a postback or not. + public static final String IS_POSTBACK_ATTRIBUTE = + BRIDGE_PACKAGE_PREFIX + "isPostback"; + + // Special session attribute name to hold the application_scope in the + // portlet_scope of the session so these are accessible as well. + public static final String APPLICATION_SCOPE_MAP = "javax.portlet.faces.ApplicationScopeMap"; + + + // Following are the names of context attributes that a portlet can set prior + // to calling the bridge's init() method to control Bridge behavior. + + // These attributes are scoped to a specific portlet in the context + // hence to acquire one must include the portlet name within attribute name: + // BRIDGE_PACKAGE_PREFIX + context.getPortletName() + attributeName + + // if "true" indicates the bridge will preserve all the action params in its + // request scope and restore them as parameters in the subsequent renders + public static final String PRESERVE_ACTION_PARAMS = "preserveActionParams"; + + // allows a portlet to control render delgation. A value of "ALWAYS_DELEGATE" indicates + // the bridge doesn't render itself, it merely delegates. A value of "NEVER_DELEGATE" + // indicates the bridge never delegates, rather it always overrides and renders. + // A value of "DEFAULT" indicates the bridge will delegate first and only render + // if the delegatee throws an exception/throwable. + public static final String RENDER_POLICY = "renderPolicy"; - public void init(PortletConfig portletConfig) - throws PortletException; - - public void doFacesRequest(ActionRequest request, ActionResponse response) - throws PortletException; - - public void doFacesRequest(RenderRequest request, RenderResponse response) - throws PortletException; - - public void destroy(); - + + // Parameter that can be added to an ActionURL to signify it is a direct link + // and hence shouldn't be encoded by encodeActionURL as an actionURL + public static final String DIRECT_LINK = BRIDGE_PACKAGE_PREFIX + "DirectLink"; + + // Session attribute pushed by bridge into session scope to give one access + // to Application scope + public static final String SESSION_APPLICATION_SCOPE_MAP = BRIDGE_PACKAGE_PREFIX + + "ApplicationScopeMap"; + + // Request attribute pushed by bridge in renderView to indicate it can + // handle a filter putting the AFTER_VIEW_CONTENT in a buffer on the request. + // Allows rendering order to be preserved in jsps + public static final String RENDER_CONTENT_AFTER_VIEW = BRIDGE_PACKAGE_PREFIX + + "RenderContentAfterView"; + + // Request attribute set by servlet filter in request/responseWrapper to + // place the AFTER_VIEW_CONTENT in a buffer on the request. + // Allows filter to transfer such content back to the bridge/renderView so + // if can output in correct order. Should only be done if + // RENDER_CONTENT_AFTER_VIEW request attribute is true. + public static final String AFTER_VIEW_CONTENT = BRIDGE_PACKAGE_PREFIX + + "AfterViewContent"; + + + // Following are names of request attributes a portlet must set before + // calling the Bridge to process a request + public static final String DEFAULT_VIEWID = BRIDGE_PACKAGE_PREFIX + "defaultViewId"; + + // Following are the names of request attributes the Bridge must set before + // acquiring its first FacesContext/FacesContextFactory in each request + public static final String PORTLET_LIFECYCLE_PHASE = BRIDGE_PACKAGE_PREFIX + "phase"; + + public static final String PORTLET_ISNAMESPACED_PROPERTY = "X-JAVAX-PORTLET-IS-NAMESPACED"; + + // The possible JSR168 portlet lifecycle phazses + public static enum PortletPhase{ + ActionPhase, + RenderPhase + } + + public static enum BridgeRenderPolicy { + DEFAULT, + ALWAYS_DELEGATE, + NEVER_DELEGATE + } + + /** + * Called by the portlet. It indicates that the + * bridge is being placed into service. + * + * <p>The portlet calls the <code>init</code> + * method exactly once before invoking other lifecycle methods. Usually, + * done immediately after instantiating the bridge. + * The <code>init</code> method must complete successfully + * before the bridge can receive any requests. + * + * <p>The portlet cannot place the bridge into service + * if the <code>init</code> method Throws a <code>BridgeException</code>. + * + * <p>Initialization context is passed to bridge via <code>PortletContext</code> + * attributes. The following attributes are defined: + * <ul> + * <li><code>javax.portlet.faces.encodeRedirectURL</code>: + * instructs the bridge to call <code>ExternalContext.encodeActionURL()</code> + * before processing the redirect request. This exists because some (newer) versions + * of JSF 1.2 call <code>encodeActionURL</code> before calling <code>redirect</code> + * while others do not. This flag adjusts the behavior of the bridge in accordance + * with the JSF 1.2 implementation it runs with. + * <li><code>javax.portlet.faces.numManagedActionScopes</code>: defines the maximum + * number of actionScopes this bridge preserves at any given time. Value is + * an integer. ActionScopes are managed on a per Bridge class portlet + * context wide basis. As a typical portlet application uses the same + * bridge implementation for all its Faces based portlets, this means that + * all actionScopes are managed in a single bucket.<br> + * For convenience this interface defines the <code>NUM_MANAGED_ACTIONSCOPES</code> + * constant. + * <li><code>javax.faces.lifecycleID</code>: defines the Faces <code>Lifecycle</code> id + * that bridge uses when acquiring the <code>Faces.Lifecycle</code> via + * which it executes the request. As a context wide attribute, all bridge + * instances in this portlet application will use this lifecyle. + * <li><code>javax.portlet.faces.[portlet name].preserveActionParams</code>: + * instructs the bridge to preserve action parameters in the action scope + * and represent them in subsequent renders. Should be used only when binding + * to a Faces implementation that relies on accessing such parameters during + * its render phase. As this is a portlet/bridge instance specific attribute, + * the <code>PortletContext</code>attribute name is qualified by the portlet + * instance name. This allows different portlets within the same portlet + * application to have different settings.<br> + * For convenience this interfaces defines a number of constants that + * simplifies constructing and/or recognizing this name. + * </ul> + * + * + * @param config a <code>PortletConfig</code> object + * containing the portlet's + * configuration and initialization parameters + * + * @exception PortletException if an exception has occurred that + * interferes with the portlet's normal + * operation. + * @exception UnavailableException if the portlet cannot perform the initialization at this time. + * + * + */ + public void init(PortletConfig config) throws BridgeException; + + /** + * Called by the portlet when it wants the bridge to process an action request. + * + * @param request the request object. + * @param response the response object. + * @throws BridgeDefaultViewNotSpecifiedException thrown if the request indicates + * to the Bridge that is should use the default ViewId and the portlet + * hasn't supplied one. + * @throws BridgeException all other internal exceptions are converted to a + * BridgeException. + */ + public void doFacesRequest(ActionRequest request, ActionResponse response) + throws BridgeDefaultViewNotSpecifiedException, BridgeException; + + /** + * Called by the portlet when it wants the bridge to process a render request. + * + * @param request the request object. + * @param response the response object. + * @throws BridgeDefaultViewNotSpecifiedException thrown if the request indicates + * to the Bridge that is should use the default ViewId and the portlet + * hasn't supplied one. + * @throws BridgeException all other internal exceptions are converted to a + * BridgeException. + */ + public void doFacesRequest(RenderRequest request, RenderResponse response) + throws BridgeDefaultViewNotSpecifiedException, BridgeException; + + /** + * Called by the portlet to take the bridge out of service. Once out of + * service, the bridge must be reinitialized before processing any further + * requests. + */ + public void destroy(); + } Added: trunk/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/BridgeDefaultViewNotSpecifiedException.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,19 @@ +package javax.portlet.faces; + +public class BridgeDefaultViewNotSpecifiedException extends BridgeException { + public BridgeDefaultViewNotSpecifiedException() { + super(); + } + + public BridgeDefaultViewNotSpecifiedException(String message) { + super(message); + } + + public BridgeDefaultViewNotSpecifiedException(String message, Throwable cause) { + super(message, cause); + } + + public BridgeDefaultViewNotSpecifiedException(Throwable cause) { + super(cause); + } +} Added: trunk/src/main/java/javax/portlet/faces/BridgeException.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/BridgeException.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/BridgeException.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,21 @@ +package javax.portlet.faces; + +import javax.faces.FacesException; + +public class BridgeException extends FacesException { + public BridgeException() { + super(); + } + + public BridgeException(String message) { + super(message); + } + + public BridgeException(String message, Throwable cause) { + super(message, cause); + } + + public BridgeException(Throwable cause) { + super(cause); + } +} Added: trunk/src/main/java/javax/portlet/faces/BridgeRenderFilter.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/BridgeRenderFilter.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/BridgeRenderFilter.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,206 @@ +package javax.portlet.faces; + +import java.io.ByteArrayOutputStream; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.ByteBuffer; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponseWrapper; + +public class BridgeRenderFilter implements Filter { + + private FilterConfig filterConfig; + + public void destroy() { + filterConfig = null; + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + if(!(request instanceof HttpServletRequest) + && !(response instanceof HttpServletResponse)) { + chain.doFilter(request, response); + return ; + } + + if(Boolean.TRUE.equals(request.getAttribute(Bridge.RENDER_CONTENT_AFTER_VIEW))) { + BridgeRenderResponseWrapper bridgeResponse = new BridgeRenderResponseWrapper( + (HttpServletResponse) response); + chain.doFilter(request, bridgeResponse); + if(bridgeResponse.isBytes()) { + request.setAttribute(Bridge.AFTER_VIEW_CONTENT, + bridgeResponse.getBytes()); + } else { + request.setAttribute(Bridge.AFTER_VIEW_CONTENT, + bridgeResponse.getChars()); + } + } else { + chain.doFilter(request, response); + } + } + + public void init(FilterConfig filterConfig) + throws ServletException { + this.filterConfig = filterConfig; + } + + public FilterConfig getFilterConfig() { + return filterConfig; + } + + public ServletContext getServletContext() { + return filterConfig.getServletContext(); + } + + private class BridgeRenderResponseWrapper extends HttpServletResponseWrapper { + + private ByteArrayWebOutputStream basos; + private PrintWriter pw ; + private CharArrayWriter caw; + private int status = HttpServletResponse.SC_OK; + + public BridgeRenderResponseWrapper(HttpServletResponse response) { + super(response); + } + + @Override + public void sendError(int sc, String msg) throws IOException { + super.sendError(sc, msg); + status = sc; + } + + @Override + public void sendError(int sc) throws IOException { + super.sendError(sc); + status = sc; + } + + @Override + public void setStatus(int sc) { + super.setStatus(sc); + status = sc; + } + + @Override + public void setStatus(int sc, String sm) { + super.setStatus(sc, sm); + status = sc; + } + + + public int getStatus() { + return status; + } + + public boolean isBytes() { + return (null != basos); + } + + public boolean isChars() { + return (null != caw); + } + + public byte[] getBytes() { + byte[] result = null; + if (null != basos) { + result = basos.toByteArray(); + } + return result; + } + + public char[] getChars() { + char[] result = null; + if (null != caw) { + result = caw.toCharArray(); + } + return result; + } + + public String toString() { + String result = null; + if (null != caw) { + result = caw.toString(); + } else if (null != basos) { + result = basos.toString(); + } + return result; + } + + public void resetBuffers() throws IOException { + if (null != caw) { + caw.reset(); + } else if (null != basos) { + basos.resetByteArray(); + } + } + + public ServletOutputStream getOutputStream() throws IOException { + if (pw != null) { + throw new IllegalStateException(); + } + if (null == basos) { + basos = new ByteArrayWebOutputStream(); + } + return basos; + } + + public PrintWriter getWriter() throws IOException { + if (basos != null) { + throw new IllegalStateException(); + } + if (null == pw) { + caw = new CharArrayWriter(1024); + pw = new PrintWriter(caw); + } + + return pw; + } + + } + + private static class ByteArrayWebOutputStream extends ServletOutputStream { + + private ByteBufferOutputStream bbos; + + public ByteArrayWebOutputStream() { + bbos = new ByteBufferOutputStream(1024); + } + + public void resetByteArray() { + bbos.reset(); + } + + public byte[] toByteArray() { + return bbos.toByteArray(); + } + + public void write(int n) { + bbos.write(n); + } + + } + + private static class ByteBufferOutputStream extends ByteArrayOutputStream { + + public ByteBufferOutputStream(int initialCapacity) { + super(initialCapacity); + } + + public ByteBuffer getByteBuffer() { + return ByteBuffer.wrap(buf, 0, count); + } + + } + +} Modified: trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-07-06 09:25:03 UTC (rev 22) +++ trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-08-21 15:07:12 UTC (rev 23) @@ -1,15 +1,23 @@ +/* Copyright (c) 2007, Oracle. All rights reserved. + * Use is subject to license terms. + */ + + + package javax.portlet.faces; +import java.io.BufferedReader; import java.io.IOException; -import java.util.Enumeration; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.logging.Logger; -import javax.faces.FacesException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; + +import java.util.Properties; + import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; -import javax.portlet.Portlet; +import javax.portlet.GenericPortlet; import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import javax.portlet.PortletException; @@ -17,174 +25,319 @@ import javax.portlet.PortletRequest; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; -import javax.portlet.UnavailableException; +import javax.portlet.WindowState; -public class GenericFacesPortlet implements Portlet, PortletConfig { - private static Logger logger = Logger - .getLogger(GenericFacesPortlet.class.getPackage().getName()); - - public static final String LIFECYCLE_ID_ATTR = - "javax.portlet.faces.extension.LIFECYCLE_ID"; - - public static final String BRIDGE_CLASS_ATTR = - "javax.portlet.faces.extension.bridgeClass"; - - public static final String INIT_VIEW = - "javax.portlet.faces.extension.INIT_VIEW"; - - public static final String INIT_EDIT = - "javax.portlet.faces.extension.INIT_EDIT"; - - public static final String INIT_HELP = - "javax.portlet.faces.extension.INIT_HELP"; - - private Bridge bridge; - - private PortletConfig portletConfig; - - public void init(PortletConfig portletConfig) - throws PortletException { - this.portletConfig = portletConfig; - - logger.finest("Initializing portlet: " + getPortletName()); - - String bridgeClassName = portletConfig - .getInitParameter(BRIDGE_CLASS_ATTR); - if(bridgeClassName == null) { - bridgeClassName = getPortletContext() - .getInitParameter(BRIDGE_CLASS_ATTR); - } - if(bridgeClassName == null) { - throw new UnavailableException("Missed parameter: " - + BRIDGE_CLASS_ATTR); - } - - try { - Class bridgeClass = Class.forName(bridgeClassName); - bridge = (Bridge) bridgeClass.newInstance(); - } catch(Exception e) { - throw new UnavailableException(e.getLocalizedMessage()); - } - - bridge.init(portletConfig); - init(); - logger.finest("Portlet '" + getPortletName() + "' initialized."); - } - - public void init() throws PortletException { } - public void processAction(ActionRequest request, ActionResponse response) - throws PortletException, IOException { - logger.entering(GenericFacesPortlet.class.getName(), - "processAction", new Object[]{ request, response }); - - storeViewIdParameter(request); - try { - bridge.doFacesRequest(request, response); - } catch(FacesException e) { - Throwable t = e.getCause(); - if(t == null) { - throw new PortletException(e); - } else { - if(t instanceof IOException) { - throw ((IOException) t); - } - throw new PortletException(t); - } - } - - logger.exiting(GenericFacesPortlet.class.getName(), "processAction"); - } - - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - logger.entering(GenericFacesPortlet.class.getName(), - "render", new Object[]{ request, response }); - - storeViewIdParameter(request); - try { - bridge.doFacesRequest(request, response); - } catch(FacesException e) { - Throwable t = e.getCause(); - if(t == null) { - throw new PortletException(e); - } else { - if(t instanceof IOException) { - throw ((IOException) t); - } - throw new PortletException(t); - } - } - - logger.exiting(GenericFacesPortlet.class.getName(), "render"); - } - - public void destroy() { - bridge.destroy(); - logger.finest("Portlet '" + getPortletName() + "' destroyed."); - - bridge = null; - portletConfig = null; - } +/** + * The <code>GenericFacesPortlet</code> is provided to simplify development of a + * portlet that in whole or part relies on the Faces bridge to process requests. + * If all requests are to be handled by the bridge, <code>GenericFacesPortlet</code> + * is a turnkey implementation. Developers do not need to subclass it. + * However, if there are some situations where the portlet doesn't require + * bridge services then <code>GenericFacesPortlet</code> can be subclassed and overriden.<p> + * Since <code>GenericFacesPortlet</code> subclasses <code>GenericPortlet</code> + * care is taken to all subclasses to override naturally. For example, though + * <code>doDispatch()</code> is overriden, requests are only dispatched to the + * bridge from here if the <code>PortletMode</code> isn't <code>VIEW</code>, + * <code>EDIT</code>, or <code>HELP</code>.<p> + * The <code>GenericFacesPortlet</code> recognizes the following portlet init + * parameters: + * <ul> + * <li><code>javax.portlet.faces.defaultViewId.[<i>mode</i>]</code>: + * specifies on a per mode basis the default viewId the Bridge executes + * when not already encoded in the incoming request. A value must be + * defined for each <code>PortletMode</code> the <code>Bridge</code> is + * expected to process. + * </li> + * </ul> + * The <code>GenericFacesPortlet</code> recognizes the following <code> + * PortletContext</code> init parameters: + * <ul> + * <li><code>javax.portlet.faces.BridgeImplClass</code>: specifies the + * <code>Bridge</code>implementation class used by this portlet. This + * init parameter must be specified or else an exception is thrown. + * </li> + * </ul> + */ +public class GenericFacesPortlet extends GenericPortlet +{ + public final static String BRIDGE_CLASS = Bridge.BRIDGE_PACKAGE_PREFIX + "BridgeClassName"; + public final static String BRIDGE_SERVICE_CLASSPATH = "META-INF/services/javax.portlet.faces.Bridge"; + + private Class mFacesBridgeClass = null; + private Bridge mFacesBridge = null; + + /** + * Initialize generic faces portlet from portlet.xml + */ + public void init(PortletConfig portletConfig) + throws PortletException + { + super.init(portletConfig); + + // Make sure the bridge impl class is defined -- if not then search for it + // using same search rules as Faces + String bridgeClassName = getBridgeClassName(); + + if (bridgeClassName != null) { + try { + mFacesBridgeClass = Class.forName(bridgeClassName); + } catch (ClassNotFoundException cnfe) { + // Do nothing and fall through to null check + } + } + + if (mFacesBridgeClass == null) + { + throw new PortletException("Configuration Error: Initial Parameter '" + + BRIDGE_CLASS + + "' is not defined for portlet: " + + getPortletName()); + } - public String getInitParameter(String name) { - return portletConfig.getInitParameter(name); - } - - public Enumeration getInitParameterNames() { - return portletConfig.getInitParameterNames(); - } - - public PortletConfig getPortletConfig() { - return portletConfig; - } - - public PortletContext getPortletContext() { - return portletConfig.getPortletContext(); - } - - public String getPortletName() { - return portletConfig.getPortletName(); - } - - public ResourceBundle getResourceBundle(Locale locale) { - return portletConfig.getResourceBundle(locale); - } - - protected Bridge getBridge() { - return bridge; - } - - private void storeViewIdParameter(PortletRequest request) - throws PortletException { - PortletMode portletMode = request.getPortletMode(); - - // Check whether the requested mode is allowed - if(!request.isPortletModeAllowed(portletMode)) { - throw new PortletException(portletMode + " is not allowed"); + // Context level attribute for whether to encode redirect URL + String renderPolicy = + this.getPortletConfig().getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.RENDER_POLICY); + if (renderPolicy != null) + this.getPortletContext().setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + + this.getPortletName() + "." + Bridge.RENDER_POLICY, + Bridge.BridgeRenderPolicy.valueOf(renderPolicy)); + String preserveActionParams = + this.getPortletConfig().getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.PRESERVE_ACTION_PARAMS); + if (preserveActionParams != null) + this.getPortletContext().setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + + this.getPortletName() + "." + Bridge.PRESERVE_ACTION_PARAMS, + Boolean.valueOf(preserveActionParams)); + + // Don't instanciate/initialize the bridge yet. Do it on first use + } + + /** + * Release resources + */ + public void destroy() + { + if (mFacesBridge != null) + { + mFacesBridge.destroy(); + mFacesBridge = null; + mFacesBridgeClass = null; } - - String viewId = null; - // Get the view identifier based on the mode. - if(PortletMode.VIEW.equals(portletMode)) { - viewId = getPortletConfig().getInitParameter(INIT_VIEW); - } else if(PortletMode.EDIT.equals(portletMode)) { - viewId = getPortletConfig().getInitParameter(INIT_EDIT); - } else if(PortletMode.HELP.equals(portletMode)) { - viewId = getPortletConfig().getInitParameter(INIT_HELP); - } + } + + /** + * If mode is VIEW, EDIT, or HELP -- defer to the doView, doEdit, doHelp + * so subclasses can override. Otherwise handle mode here if there is a + * defaultViewId mapping for it. + */ + public void doDispatch(RenderRequest request, RenderResponse response) + throws PortletException, IOException + { + // Defer to helper methods for standard modes so subclasses can override + PortletMode mode = request.getPortletMode(); + if (mode == PortletMode.EDIT || + mode == PortletMode.HELP || + mode == PortletMode.VIEW) + { + super.doDispatch(request, response); + } else + { + doDispatchInternal(request, response, request.getPortletMode()); + } + } + + protected void doEdit(RenderRequest request, + RenderResponse response) + throws PortletException, + java.io.IOException + { + doDispatchInternal(request, response, request.getPortletMode()); - if(viewId == null) { - if(PortletMode.VIEW.equals(portletMode)) { - throw new PortletException("Portlet '" + getPortletName() - + "' misses a default view page. "); - } - throw new PortletException("Portlet '" + getPortletName() - + "' misses a default viewId for portlet mode: " + portletMode); + } + + protected void doHelp(RenderRequest request, + RenderResponse response) + throws PortletException, + java.io.IOException + { + doDispatchInternal(request, response, request.getPortletMode()); + + } + + protected void doView(RenderRequest request, + RenderResponse response) + throws PortletException, + java.io.IOException + { + doDispatchInternal(request, response, request.getPortletMode()); + + } + + public void processAction(ActionRequest request, ActionResponse response) + throws PortletException, IOException + { + doBridgeDispatch(request, response, getDefaultViewId(request, request.getPortletMode())); + } + + /** + * Returns the className of the bridge implementation this portlet uses. + * Subclasses override to alter the default behavior. + * Default implementation first checks for a portlet context init parameter: + * javax.portlet.faces.BridgeImplClass. If it doesn't exist then it looks for + * the resource file "/META-INF/services/javax.portlet.faces.Bridge" using the + * current threads classloader and extracts the classname from the first + * line in that file. + * + * @return the class name of the Bridge class the GenericFacesPortlet uses. + * null if it can't be determined. + */ + public String getBridgeClassName() { + String bridgeClassName = + this.getPortletConfig().getPortletContext().getInitParameter(BRIDGE_CLASS); + + if (bridgeClassName == null) { + bridgeClassName = getFromServicesPath(this.getPortletConfig().getPortletContext(), BRIDGE_SERVICE_CLASSPATH); } + return bridgeClassName; + } + + /** + * Returns the defaultViewId to be used for this request. The defaultViewId + * is depends on the PortletMode. + * + * @param request the request object. + * @param mode the mode which to return the defaultViewId for. + * @return the defaultViewId for this mode + */ + public String getDefaultViewId(PortletRequest request, PortletMode mode) + { + return this.getPortletConfig().getInitParameter(Bridge.DEFAULT_VIEWID + "." + + mode.toString()); + } + + private void doDispatchInternal(RenderRequest request, RenderResponse response, PortletMode mode) + throws PortletException, IOException + { + // Only process if there is a default page defined for this mode + String modeDefaultViewId = getDefaultViewId(request, mode); - request.setAttribute("javax.portlet.faces.defaultViewId", viewId); - logger.fine("Default viewId for mode '" + portletMode + "': " + viewId); - } - + if (!(modeDefaultViewId == null)) + { + WindowState state = request.getWindowState(); + if (!state.equals(WindowState.MINIMIZED)) + { + doBridgeDispatch(request, response, modeDefaultViewId); + } + } + else + { + super.doDispatch(request, response); + } + } + + private void doBridgeDispatch(RenderRequest request, RenderResponse response, String defaultViewId) + throws PortletException + { + // initial Bridge if not already active + initBridge(); + // Push information for Bridge into request attributes + setBridgeRequestContext(request, defaultViewId); + try { + mFacesBridge.doFacesRequest(request, response); + } catch (BridgeException e) { + throw new PortletException( + "doBridgeDispatch failed: error from Bridge in executing the request", e); + } + + } + + private void doBridgeDispatch(ActionRequest request, ActionResponse response, String defaultViewId) + throws PortletException + { + // initial Bridge if not already active + initBridge(); + // Push information for Bridge into request attributes + setBridgeRequestContext(request, defaultViewId); + try { + mFacesBridge.doFacesRequest(request, response); + } catch (BridgeException e) { + throw new PortletException( + "doBridgeDispatch failed: error from Bridge in executing the request", e); + } + + } + + private void initBridge() throws PortletException + { + if (mFacesBridge == null) + { + try + { + mFacesBridge = (Bridge) mFacesBridgeClass.newInstance(); + mFacesBridge.init(this.getPortletConfig()); + } catch (Exception e) + { + throw new PortletException( + "doBridgeDisptach: error instantiating the bridge class", e); + } + } + } + + private void setBridgeRequestContext(PortletRequest request, String defaultViewId) { + // Make the defaultViewId available to the Bridge + request.setAttribute(Bridge.DEFAULT_VIEWID, defaultViewId); + } + + private String getFromServicesPath(PortletContext context, String resourceName) { + // Check for a services definition + String result = null; + BufferedReader reader = null; + InputStream stream = null; + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) return null; + + stream = cl.getResourceAsStream(resourceName); + if (stream != null) { + // Deal with systems whose native encoding is possibly + // different from the way that the services entry was created + try { + reader = + new BufferedReader(new InputStreamReader(stream, + "UTF-8")); + } catch (UnsupportedEncodingException e) { + reader = new BufferedReader(new InputStreamReader(stream)); + } + result = reader.readLine(); + if (result != null) + result = result.trim(); + reader.close(); + reader = null; + stream = null; + } + } catch (IOException e) { + } catch (SecurityException e) { + } finally { + if (reader != null) { + try { + reader.close(); + stream = null; + } catch (Throwable t) { + ; + } + reader = null; + } + if (stream != null) { + try { + stream.close(); + } catch (Throwable t) { + ; + } + stream = null; + } + } + return result; + } + + } Added: trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainer.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,23 @@ +/* Copyright (c) 2007, Oracle. All rights reserved. + * Use is subject to license terms. + */ + +package javax.portlet.faces.component; + +import javax.faces.component.NamingContainer; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + + +/** + * <p><strong>PortletNamingContainer</strong> is an interface that must be + * implemented by any UIViewRoot that wants to be used in a Portlet Bridge + * environment. It indicates that this the component (usually a UIViewRoot) + * that implements this <code>NamingContainer</code> incorporates + * the consumer provided portlet namespaceId into the id returned from + * <code>getContainerClientId</code>. This is merely a marker interface + */ + +public interface PortletNamingContainer extends NamingContainer { + +} Added: trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,79 @@ +/* Copyright (c) 2007, Oracle. All rights reserved. + * Use is subject to license terms. + */ + +package javax.portlet.faces.component; + +import java.io.IOException; +import java.io.Serializable; + +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.el.MethodExpression; +import javax.el.ValueExpression; + +import javax.faces.FacesException; +import javax.faces.component.ContextCallback; +import javax.faces.context.FacesContext; +import javax.faces.event.FacesEvent; +import javax.faces.event.PhaseListener; +import javax.faces.component.NamingContainer; +import javax.faces.component.UIComponent; +import javax.faces.component.UIViewRoot; +import javax.faces.context.ExternalContext; +import javax.faces.el.ValueBinding; + +import javax.portlet.PortletRequest; +import javax.portlet.faces.component.PortletNamingContainer; + + +/** + * Bridge ViewRoot that implements NamingContainer which uses the + * ExternalContext.encodeNamespace to introduce the consumer namespace + * into tree components. + */ + +public class PortletNamingContainerUIViewRoot extends UIViewRoot implements PortletNamingContainer, Serializable { + + private static final String SEPARATOR = (new Character(NamingContainer.SEPARATOR_CHAR)).toString(); + + public PortletNamingContainerUIViewRoot() { + super(); + } + + public PortletNamingContainerUIViewRoot(UIViewRoot viewRootToReplace) { + super(); + setViewId(viewRootToReplace.getViewId()); + setLocale(viewRootToReplace.getLocale()); + setRenderKitId(viewRootToReplace.getRenderKitId()); + } + + // Implement the method that satisfies NamingContainer + public static String getContainerClientId(FacesContext context, String additionalId) { + ExternalContext ec = context.getExternalContext(); + String namespace = ec.encodeNamespace(SEPARATOR); + + /* In servlet world encodeNamespace does nothing -- so if we get back + * what we sent in then do not perturn the NamingContainer Id + */ + if (namespace.length() > 1) { + if (additionalId != null) + return namespace + additionalId; + else + return namespace; + } else { + return null; + } + } + + // Implement the method that satisfies NamingContainer + public String getContainerClientId(FacesContext context) { + return PortletNamingContainerUIViewRoot.getContainerClientId( + context, super.getContainerClientId(context)); + } + + +} Added: trunk/src/main/java/javax/portlet/faces/el/PortletELResolver.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/el/PortletELResolver.java (rev 0) +++ trunk/src/main/java/javax/portlet/faces/el/PortletELResolver.java 2007-08-21 15:07:12 UTC (rev 23) @@ -0,0 +1,198 @@ +/* Copyright (c) 2007, Oracle. All rights reserved. + * Use is subject to license terms. + */ + + +package javax.portlet.faces.el; + +import java.beans.FeatureDescriptor; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.el.ELContext; +import javax.el.ELException; +import javax.el.ELResolver; +import javax.el.PropertyNotFoundException; +import javax.el.PropertyNotWritableException; + +import javax.faces.context.FacesContext; +import javax.faces.context.ExternalContext; + +import javax.portlet.PortletConfig; +import javax.portlet.PortletRequest; + +import javax.portlet.faces.Bridge; + + +public class PortletELResolver extends ELResolver { + + // Important preserve index (order) between array and constants + public static final String[] IMPLICIT_OBJECTS = new String[] { + "portletConfig", "sessionApplicationScope", "sessionPortletScope", "portletPreferenceValue", "portletPreferenceValues" }; + + public static final int PORTLET_CONFIG = 0; + public static final int SESSION_APPLICATION_SCOPE = 1; + public static final int SESSION_PORTLET_SCOPE = 2; + public static final int PORTLET_PREFERENCE_VALUE = 3; + public static final int PORTLET_PREFERENCE_VALUES = 4; + + public PortletELResolver() { + } + + public Object getValue(ELContext context, Object base, Object property) + throws ELException { + // variable resolution is a special case of property resolution + // where the base is null. + if (base != null) { + return null; + } + if (property == null) { + throw new PropertyNotFoundException("Null property"); + } + + FacesContext facesContext = + (FacesContext) context.getContext(FacesContext.class); + ExternalContext extCtx = facesContext.getExternalContext(); + + // only process if running in a portlet request + if (!(extCtx.getRequest() instanceof PortletRequest)) { + return null; + } + + int index = Arrays.binarySearch(IMPLICIT_OBJECTS, property); + if (index < 0) { + return null; + } else { + switch (index) { + case PORTLET_CONFIG: + context.setPropertyResolved(true); + return context.getContext(PortletConfig.class); + case SESSION_APPLICATION_SCOPE: + context.setPropertyResolved(true); + return extCtx.getSessionMap().get(Bridge.APPLICATION_SCOPE_MAP); + case SESSION_PORTLET_SCOPE: + context.setPropertyResolved(true); + return extCtx.getSessionMap(); + case PORTLET_PREFERENCE_VALUE: + context.setPropertyResolved(true); + return getPreferencesValueMap(extCtx); + case PORTLET_PREFERENCE_VALUES: + context.setPropertyResolved(true); + return ((PortletRequest)extCtx.getRequest()).getPreferences().getMap(); + default: + return null; + } + } + } + + public void setValue(ELContext context, Object base, Object property, + Object val) throws ELException { + if (base != null) { + return; + } + if (property == null) { + throw new PropertyNotFoundException("Null property"); + } + + int index = Arrays.binarySearch(IMPLICIT_OBJECTS, property); + if (index >= 0) { + throw new PropertyNotWritableException((String)property); + } + } + + public boolean isReadOnly(ELContext context, Object base, Object property) + throws ELException{ + if (base != null) { + return false; + } + if (property == null) { + throw new PropertyNotFoundException("Null property"); + } + + int index = Arrays.binarySearch(IMPLICIT_OBJECTS, property); + if (index >= 0) { + context.setPropertyResolved(true); + return true; + } + return false; + } + + public Class<?> getType(ELContext context, Object base, Object property) + throws ELException { + if (base != null) { + return null; + } + if (property == null) { + throw new PropertyNotFoundException("Null property"); + } + + int index = Arrays.binarySearch(IMPLICIT_OBJECTS, property); + if (index >= 0) { + context.setPropertyResolved(true); + } + return null; + } + + public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { + if (base != null) { + return null; + } + ArrayList<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(14); + list.add(getFeatureDescriptor("portletConfig", "portletConfig", + "portletConfig",false, false, true, Object.class, Boolean.TRUE)); + list.add(getFeatureDescriptor("sessionApplicationScope", "sessionApplicationScope", + "sessionApplicationScope",false, false, true, Map.class, Boolean.TRUE)); + list.add(getFeatureDescriptor("sessionPortletScope", "sessionPortletScope", + "sessionPortletScope",false, false, true, Map.class, Boolean.TRUE)); + list.add(getFeatureDescriptor("portletPreferenceValue", "portletPreferenceValue", + "portletPreferenceValue",false, false, true, Map.class, Boolean.TRUE)); + list.add(getFeatureDescriptor("portletPreferenceValues", "portletPreferenceValues", + "portletPreferenceValues",false, false, true, Map.class, Boolean.TRUE)); + return list.iterator(); + + } + + public Class<?> getCommonPropertyType(ELContext context, Object base) { + if (base != null) { + return null; + } + return String.class; + } + + private FeatureDescriptor getFeatureDescriptor(String name, String + displayName, String desc, boolean expert, boolean hidden, + boolean preferred, Object type, Boolean designTime) { + + FeatureDescriptor fd = new FeatureDescriptor(); + fd.setName(name); + fd.setDisplayName(displayName); + fd.setShortDescription(desc); + fd.setExpert(expert); + fd.setHidden(hidden); + fd.setPreferred(preferred); + fd.setValue(ELResolver.TYPE, type); + fd.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, designTime); + return fd; + } + + private Map getPreferencesValueMap(ExternalContext extCtx) { + PortletRequest portletRequest = (PortletRequest) extCtx.getRequest(); + Enumeration e = portletRequest.getPreferences().getNames(); + Map m = null; + + while (e.hasMoreElements()) { + if (m == null) + m = new HashMap(); + String name = (String) e.nextElement(); + String value = portletRequest.getPreferences().getValue(name, null); + if (value != null) + m.put(name, value); + } + return m; + } + +} Modified: trunk/src/main/java/net/sf/jsf4portlets/BridgeConstants.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/BridgeConstants.java 2007-07-06 09:25:03 UTC (rev 22) +++ trunk/src/main/java/net/sf/jsf4portlets/BridgeConstants.java 2007-08-21 15:07:12 UTC (rev 23) @@ -27,40 +27,10 @@ * */ public final class BridgeConstants { - - // JSR-252 Constants - public static final String AFTER_VIEW_CONTENT = - "javax.faces.AfterViewContent"; - // JSR-301 Constants - /** - * Identifies the PORTLET_SCOPE in the <tt>PortletSession</tt> - */ - public static final String APPLICATION_SCOPE_MAP = - "javax.portlet.faces.ApplicationScopeMap"; - - /** - * Identifies the current bridge phase for request which belongs to - */ - public static final String BRIDGE_PHASE = - "javax.portlet.faces.phase"; - - /** - * Default <tt>viewId</tt> that will be used when the request - * doesn't specifies one. - */ - public static final String DEFAULT_VIEW_ID = - "javax.portlet.faces.defaultViewId"; - /** - * Boolean flag used to mark a URL as an external link - */ - public static final String DIRECT_LINK = - "_javax.portlet.faces.DirectLink"; - - /** * Boolean flag used to know if URL should be * encoded before performing a redirect call. */ @@ -74,11 +44,11 @@ public static final String PRESERVE_ACTION_PARAMS = "javax.portlet.faces.PRESERVE_ACTION_PARAMS"; - public static final String RENDER_AFTER_VIEW_CONTEXT = - "javax.portlet.faces.RenderAfterViewContext"; - // Implementation constants + public static final String FACES_PREFIX = + "net.sf.jsf4portlets."; + /** * Context initialization parameter used to check for * an alternative InjectionProvider instace @@ -100,6 +70,9 @@ public static final String REQUEST_SCOPE = "net.sf.jsf4portlets.REQUEST_SCOPE"; + public static final String REQUEST_SCOPE_MANAGER = + "net.sf.jsf4portlets.REQUEST_SCOPE_MANAGER"; + /** * URL parameter used to pass to the bridge * the viewId that should be processed. Modified: trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-07-06 09:25:03 UTC (rev 22) +++ trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-08-21 15:07:12 UTC (rev 23) @@ -20,20 +20,12 @@ */ package net.sf.jsf4portlets; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; import java.util.ResourceBundle; -import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.faces.FacesException; import javax.faces.FactoryFinder; -import javax.faces.application.FacesMessage; -import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.context.FacesContextFactory; import javax.faces.lifecycle.Lifecycle; @@ -42,19 +34,12 @@ import javax.portlet.ActionResponse; import javax.portlet.PortletConfig; import javax.portlet.PortletContext; -import javax.portlet.PortletException; -import javax.portlet.PortletMode; import javax.portlet.PortletRequest; -import javax.portlet.PortletSession; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.faces.Bridge; -import javax.portlet.faces.GenericFacesPortlet; +import javax.portlet.faces.BridgeException; -import net.sf.jsf4portlets.config.ManagedBeanBean; -import net.sf.jsf4portlets.config.PortletConfiguration; -import net.sf.jsf4portlets.util.Util; - /** * Default JSF Bridge Implementation. * @@ -63,85 +48,30 @@ * */ public class BridgeImpl implements Bridge { + private final Logger logger = Logger.getLogger( BridgeImpl.class.getPackage().getName(), "net.sf.jsf4portlets.LogMessages"); - - private static final String VIEW_ATTR = - "net.sf.jsf4portlets.VIEW"; - private static final String EDIT_ATTR = - "net.sf.jsf4portlets.EDIT"; - - private static final String HELP_ATTR = - "net.sf.jsf4portlets.HELP"; - - private static final String CUSTOM_ATTR = - "net.sf.jsf4portlets.CUSTOM"; - - private static final String PREVIOUS_REQUEST_SCOPE = - "net.sf.jsf4portlets.PREVIOUS_REQUEST_SCOPE"; - - private static final Set<String> TRANSIENT_REQUEST_ATTRS; - - static { - Set<String> attrs = new HashSet<String>(); - attrs.add(BridgeConstants.AFTER_VIEW_CONTENT); - attrs.add(BridgeConstants.BRIDGE_PHASE); - attrs.add(BridgeConstants.DEFAULT_VIEW_ID); - attrs.add(BridgeConstants.ENCODE_REDIRECT_URL); - attrs.add(BridgeConstants.PORTLET_CONFIG); - attrs.add(BridgeConstants.PRESERVE_ACTION_PARAMS); - attrs.add(BridgeConstants.RENDER_AFTER_VIEW_CONTEXT); - attrs.add(BridgeConstants.REQUEST_SCOPE); - attrs.add("javax.portlet.request"); - attrs.add("javax.portlet.response"); - attrs.add("javax.portlet.http_session_id"); - attrs.add("javax.servlet.include.context_path"); - attrs.add("javax.portlet.session_invalid"); - attrs.add("javax.portlet.portletc.httpServletRequest"); - attrs.add("javax.portlet.portletc.httpServletResponse"); - attrs.add("javax.portlet.portletc.portletname"); - TRANSIENT_REQUEST_ATTRS = Collections.unmodifiableSet(attrs); - } - private PortletConfig portletConfig = null; - private boolean encodeRedirectURL = false; - - private boolean preserveActionParams = false; - private FacesContextFactory facesContextFactory = null; private Lifecycle lifecycle = null; + private RequestScopeManager requestScopeManager = null; + public void init(PortletConfig portletConfig) - throws PortletException { + throws BridgeException { this.portletConfig = portletConfig; logger.log(Level.FINEST, "J4P_000001", getPortletName()); - if("true".equals(initParam( - BridgeConstants.ENCODE_REDIRECT_URL))) { - encodeRedirectURL = true; - } - if("true".equals(initParam( - BridgeConstants.PRESERVE_ACTION_PARAMS))) { - preserveActionParams = true; - } - - getPortletContext().setAttribute("javax.portlet.faces." - + getPortletName() + ".ENCODE_REDIRECT_URL", - Boolean.valueOf(encodeRedirectURL)); - getPortletContext().setAttribute("javax.portlet.faces." - + getPortletName() + ".PRESERVE_ACTION_PARAMS", - Boolean.valueOf(preserveActionParams)); - init(); logger.log(Level.FINEST, "J4P_000002", getPortletName()); } - public void init() throws PortletException { } + public void init() throws BridgeException { } public void destroy() { logger.log(Level.FINEST, "J4P_000003", getPortletName()); @@ -152,11 +82,11 @@ } public void doFacesRequest(ActionRequest request, ActionResponse response) - throws PortletException { + throws BridgeException { logger.entering(BridgeImpl.class.getName(), "doFacesRequest", new Object[]{ request, response }); - initRequest(request, BridgePhase.ACTION_PHASE); + initRequest(request, Bridge.PortletPhase.ActionPhase); // Acquire the FacesContext instance for this request ... [truncated message content] |
From: <alo...@us...> - 2007-07-06 09:25:06
|
Revision: 22 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=22&view=rev Author: alonsoft Date: 2007-07-06 02:25:03 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Final solution for: 1748340 Modified Paths: -------------- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java Modified: trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-07-05 22:59:10 UTC (rev 21) +++ trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-07-06 09:25:03 UTC (rev 22) @@ -94,6 +94,14 @@ attrs.add(BridgeConstants.PRESERVE_ACTION_PARAMS); attrs.add(BridgeConstants.RENDER_AFTER_VIEW_CONTEXT); attrs.add(BridgeConstants.REQUEST_SCOPE); + attrs.add("javax.portlet.request"); + attrs.add("javax.portlet.response"); + attrs.add("javax.portlet.http_session_id"); + attrs.add("javax.servlet.include.context_path"); + attrs.add("javax.portlet.session_invalid"); + attrs.add("javax.portlet.portletc.httpServletRequest"); + attrs.add("javax.portlet.portletc.httpServletResponse"); + attrs.add("javax.portlet.portletc.portletname"); TRANSIENT_REQUEST_ATTRS = Collections.unmodifiableSet(attrs); } @@ -196,9 +204,9 @@ } // Acquire the FacesContext instance for this request - FacesContext context = getFacesContextFactory().getFacesContext - (getPortletContext(), - request, response, getLifecycle()); + FacesContext context = getFacesContextFactory() + .getFacesContext(getPortletContext(), + request, response, getLifecycle()); logger.log(Level.FINEST, "J4P_000007", getPortletName()); // Execute the render response phase for this request Modified: trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-07-05 22:59:10 UTC (rev 21) +++ trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-07-06 09:25:03 UTC (rev 22) @@ -83,6 +83,9 @@ public ExternalContextImpl(PortletContext context, PortletRequest request, PortletResponse response) { + if(context == null || request == null || response == null) { + throw new NullPointerException(); + } this.context = context; this.request = request; this.response = response; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-07-05 22:59:13
|
Revision: 21 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=21&view=rev Author: alonsoft Date: 2007-07-05 15:59:10 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Tracker Request: 1748340 Modified Paths: -------------- trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java Modified: trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java =================================================================== --- trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-07-05 19:09:35 UTC (rev 20) +++ trunk/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-07-05 22:59:10 UTC (rev 21) @@ -6,6 +6,7 @@ import java.util.ResourceBundle; import java.util.logging.Logger; +import javax.faces.FacesException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.Portlet; @@ -78,7 +79,19 @@ "processAction", new Object[]{ request, response }); storeViewIdParameter(request); - bridge.doFacesRequest(request, response); + try { + bridge.doFacesRequest(request, response); + } catch(FacesException e) { + Throwable t = e.getCause(); + if(t == null) { + throw new PortletException(e); + } else { + if(t instanceof IOException) { + throw ((IOException) t); + } + throw new PortletException(t); + } + } logger.exiting(GenericFacesPortlet.class.getName(), "processAction"); } @@ -89,7 +102,19 @@ "render", new Object[]{ request, response }); storeViewIdParameter(request); - bridge.doFacesRequest(request, response); + try { + bridge.doFacesRequest(request, response); + } catch(FacesException e) { + Throwable t = e.getCause(); + if(t == null) { + throw new PortletException(e); + } else { + if(t instanceof IOException) { + throw ((IOException) t); + } + throw new PortletException(t); + } + } logger.exiting(GenericFacesPortlet.class.getName(), "render"); } Modified: trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-07-05 19:09:35 UTC (rev 20) +++ trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-07-05 22:59:10 UTC (rev 21) @@ -20,10 +20,13 @@ */ package net.sf.jsf4portlets; +import java.util.Collections; import java.util.Enumeration; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.ResourceBundle; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -79,6 +82,21 @@ private static final String PREVIOUS_REQUEST_SCOPE = "net.sf.jsf4portlets.PREVIOUS_REQUEST_SCOPE"; + private static final Set<String> TRANSIENT_REQUEST_ATTRS; + + static { + Set<String> attrs = new HashSet<String>(); + attrs.add(BridgeConstants.AFTER_VIEW_CONTENT); + attrs.add(BridgeConstants.BRIDGE_PHASE); + attrs.add(BridgeConstants.DEFAULT_VIEW_ID); + attrs.add(BridgeConstants.ENCODE_REDIRECT_URL); + attrs.add(BridgeConstants.PORTLET_CONFIG); + attrs.add(BridgeConstants.PRESERVE_ACTION_PARAMS); + attrs.add(BridgeConstants.RENDER_AFTER_VIEW_CONTEXT); + attrs.add(BridgeConstants.REQUEST_SCOPE); + TRANSIENT_REQUEST_ATTRS = Collections.unmodifiableSet(attrs); + } + private PortletConfig portletConfig = null; private boolean encodeRedirectURL = false; @@ -140,6 +158,7 @@ logger.log(Level.FINEST, "J4P_000005", getPortletName()); try { + restore(context); getLifecycle().execute(context); save(context); logger.log(Level.FINEST, "J4P_000006", getPortletName()); @@ -266,56 +285,92 @@ ExternalContext extContext = context.getExternalContext(); PortletRequest request = (PortletRequest) extContext.getRequest(); - RequestScope scope = getPreviousRequestScope(request); - if(scope == null) { - return; - } - - logger.log(Level.FINER, "J4P_000017"); - Iterator<FacesMessage> messages; - Iterator<String> clientIds = scope.getClientIds(); - while(clientIds.hasNext()) { - String clientId = clientIds.next(); - messages = scope.getMessages(clientId); - while(messages.hasNext()) { - context.addMessage(clientId, messages.next()); + RequestScope scope = null; + BridgePhase phase = (BridgePhase) request.getAttribute( + BridgeConstants.BRIDGE_PHASE); + if(BridgePhase.ACTION_PHASE.equals(phase)) { + scope = new RequestScope(); + } else if(BridgePhase.RENDER_PHASE.equals(phase)) { + scope = getPreviousRequestScope(request); + if(scope == null) { + return; } - } - - logger.log(Level.FINER, "J4P_000018"); - PortletConfiguration config = PortletConfiguration.getInstance(extContext); - Enumeration<String> managedBeanNames = scope.getManagedBeanNames(); - while(managedBeanNames.hasMoreElements()) { - String name = managedBeanNames.nextElement(); - Object bean = scope.getManagedBean(name); - if(bean != null) { - ManagedBeanBean managedBean = config.getManagedBean(name); - assert managedBean != null; - - Map<String, Object> scopeMap = Util.getScopeMap( - extContext, managedBean.getScope()); - if(scopeMap == null) { - logger.log(Level.WARNING, "J4P_000013", managedBean.getScope()); - continue; + + Enumeration<String> attrNames = scope.getAttributeNames(); + while(attrNames.hasMoreElements()) { + String name = attrNames.nextElement(); + Object value = scope.getAttribute(name); + if(value != null) { + request.setAttribute(name, value); } - scopeMap.put(name, bean); } + + logger.log(Level.FINER, "J4P_000017"); + Iterator<FacesMessage> messages; + Iterator<String> clientIds = scope.getClientIds(); + while(clientIds.hasNext()) { + String clientId = clientIds.next(); + messages = scope.getMessages(clientId); + while(messages.hasNext()) { + context.addMessage(clientId, messages.next()); + } + } + + logger.log(Level.FINER, "J4P_000018"); + PortletConfiguration config = PortletConfiguration.getInstance(extContext); + Enumeration<String> managedBeanNames = scope.getManagedBeanNames(); + while(managedBeanNames.hasMoreElements()) { + String name = managedBeanNames.nextElement(); + Object bean = scope.getManagedBean(name); + if(bean != null) { + ManagedBeanBean managedBean = config.getManagedBean(name); + assert managedBean != null; + + Map<String, Object> scopeMap = Util.getScopeMap( + extContext, managedBean.getScope()); + if(scopeMap == null) { + logger.log(Level.WARNING, "J4P_000013", managedBean.getScope()); + continue; + } + scopeMap.put(name, bean); + } + } + + if(scope.getViewRoot() != null) { + context.setViewRoot(scope.getViewRoot()); + } } - if(scope.getViewRoot() != null) { - context.setViewRoot(scope.getViewRoot()); - } request.setAttribute(BridgeConstants.REQUEST_SCOPE, scope); } + @SuppressWarnings("unchecked") protected void save(FacesContext context) { - RequestScope scope = null; ExternalContext extContext = context.getExternalContext(); PortletRequest request = (PortletRequest) extContext.getRequest(); + RequestScope scope = (RequestScope) request.getAttribute( + BridgeConstants.REQUEST_SCOPE); BridgePhase phase = (BridgePhase) request.getAttribute( BridgeConstants.BRIDGE_PHASE); + if(BridgePhase.ACTION_PHASE.equals(phase)) { - scope = new RequestScope(); + PortletConfiguration config = PortletConfiguration.getInstance(extContext); + Enumeration<String> attrNames = request.getAttributeNames(); + while(attrNames.hasMoreElements()) { + String name = attrNames.nextElement(); + // transient attribues are initialized per portlet request + if(TRANSIENT_REQUEST_ATTRS.contains(name)) { + continue; + } + // we don't want to store request managed beans + if(config.getManagedBean(name) != null) { + continue; + } + Object value = request.getAttribute(name); + if(value != null) { + scope.setAttribute(name, value); + } + } logger.log(Level.FINER, "J4P_000014"); Iterator<FacesMessage> messages; @@ -329,7 +384,6 @@ } logger.log(Level.FINER, "J4P_000015"); - PortletConfiguration config = PortletConfiguration.getInstance(extContext); Enumeration<String> managedBeanNames = config.getManagedBeanNames(); while(managedBeanNames.hasMoreElements()) { String name = managedBeanNames.nextElement(); @@ -364,8 +418,6 @@ scope.setViewRoot(context.getViewRoot()); } else if(BridgePhase.RENDER_PHASE.equals(phase)) { - scope = (RequestScope) extContext.getRequestMap().get( - BridgeConstants.REQUEST_SCOPE); if(scope != null) { scope.setViewRoot(null); scope.setViewId(context.getViewRoot().getViewId()); Modified: trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-07-05 19:09:35 UTC (rev 20) +++ trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-07-05 22:59:10 UTC (rev 21) @@ -422,15 +422,20 @@ @Override public String getRequestPathInfo() { String viewId = null; - RequestScope requestScope = Util.getRequestScope(this); - if(requestScope != null) { - viewId = requestScope.getViewId(); + BridgePhase phase = (BridgePhase) request + .getAttribute(BridgeConstants.BRIDGE_PHASE); + if(BridgePhase.RENDER_PHASE.equals(phase)) { + RequestScope requestScope = Util.getRequestScope(this); + if(requestScope != null) { + viewId = requestScope.getViewId(); + } + } else if(BridgePhase.ACTION_PHASE.equals(phase)) { + if(viewId == null) { + viewId = getRequestParameterMap().get( + BridgeConstants.VIEW_ID_PARAMETER); + } } if(viewId == null) { - viewId = getRequestParameterMap().get( - BridgeConstants.VIEW_ID_PARAMETER); - } - if(viewId == null) { viewId = (String) getRequestMap().get( BridgeConstants.DEFAULT_VIEW_ID); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-07-05 19:09:37
|
Revision: 20 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=20&view=rev Author: alonsoft Date: 2007-07-05 12:09:35 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Request attributes issue start point Modified Paths: -------------- trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java trunk/src/main/java/net/sf/jsf4portlets/context/AbstractAttributeMap.java Modified: trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java 2007-06-26 09:22:18 UTC (rev 19) +++ trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java 2007-07-05 19:09:35 UTC (rev 20) @@ -42,6 +42,9 @@ */ public final class RequestScope { + private Map<String, Object> attributes = + new HashMap<String, Object>(); + /** * Stored action parameters */ @@ -67,6 +70,26 @@ private String viewId = null; + public void clearAttributes() { + attributes.clear(); + } + + public Object getAttribute(String name) { + return attributes.get(name); + } + + public Enumeration<String> getAttributeNames() { + return Collections.enumeration(attributes.keySet()); + } + + public void setAttribute(String name, Object value) { + attributes.put(name, value); + } + + public void removeAttribute(String name) { + attributes.remove(name); + } + /** * Obtains a parameter value from the request scope * Modified: trunk/src/main/java/net/sf/jsf4portlets/context/AbstractAttributeMap.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/context/AbstractAttributeMap.java 2007-06-26 09:22:18 UTC (rev 19) +++ trunk/src/main/java/net/sf/jsf4portlets/context/AbstractAttributeMap.java 2007-07-05 19:09:35 UTC (rev 20) @@ -115,7 +115,7 @@ String skey = key(key); T result = getAttribute(skey); removeAttribute(skey); - if(callback != null) { + if(callback != null && result != null) { callback.attributeRemoved(skey, result); } return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-06-26 09:22:19
|
Revision: 19 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=19&view=rev Author: alonsoft Date: 2007-06-26 02:22:18 -0700 (Tue, 26 Jun 2007) Log Message: ----------- Fixed bug #1743406 Modified Paths: -------------- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java trunk/src/main/java/net/sf/jsf4portlets/config/PortletConfiguration.java trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java Modified: trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-06-23 15:40:37 UTC (rev 18) +++ trunk/src/main/java/net/sf/jsf4portlets/BridgeImpl.java 2007-06-26 09:22:18 UTC (rev 19) @@ -368,6 +368,7 @@ BridgeConstants.REQUEST_SCOPE); if(scope != null) { scope.setViewRoot(null); + scope.setViewId(context.getViewRoot().getViewId()); } } Modified: trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java 2007-06-23 15:40:37 UTC (rev 18) +++ trunk/src/main/java/net/sf/jsf4portlets/RequestScope.java 2007-06-26 09:22:18 UTC (rev 19) @@ -65,6 +65,8 @@ */ transient private UIViewRoot viewRoot = null; + private String viewId = null; + /** * Obtains a parameter value from the request scope * @@ -228,4 +230,14 @@ this.viewRoot = viewRoot; } + // Fix for bug #1743406 + + public String getViewId() { + return viewId; + } + + public void setViewId(String viewId) { + this.viewId = viewId; + } + } Modified: trunk/src/main/java/net/sf/jsf4portlets/config/PortletConfiguration.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/config/PortletConfiguration.java 2007-06-23 15:40:37 UTC (rev 18) +++ trunk/src/main/java/net/sf/jsf4portlets/config/PortletConfiguration.java 2007-06-26 09:22:18 UTC (rev 19) @@ -127,17 +127,20 @@ public void contextInitialized(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); - logger.log(Level.INFO, "J4P_000028", - servletContext.getContextPath()); - try { - facesConfig = loadFacesConfig(servletContext); - webappConfig = loadWebXml(servletContext); - parseInitParameters(servletContext); - } catch(Exception e) { - throw new ExceptionInInitializerError(e); + + if(isFacesApp(servletContext)) { + logger.log(Level.INFO, "J4P_000028", + servletContext.getContextPath()); + try { + facesConfig = loadFacesConfig(servletContext); + webappConfig = loadWebXml(servletContext); + parseInitParameters(servletContext); + } catch(Exception e) { + throw new ExceptionInInitializerError(e); + } + + servletContext.setAttribute(INSTANCE_KEY, this); } - - servletContext.setAttribute(INSTANCE_KEY, this); } public void contextDestroyed(ServletContextEvent event) { @@ -161,6 +164,11 @@ return in; } + private boolean isFacesApp(ServletContext servletContext) { + InputStream in = servletContext.getResourceAsStream(FACES_CONFIG_XML); + return (in != null); + } + private FacesConfigBean loadFacesConfig(ServletContext servletContext) throws IOException, SAXException { Digester digester = createDigester(); Modified: trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-06-23 15:40:37 UTC (rev 18) +++ trunk/src/main/java/net/sf/jsf4portlets/context/ExternalContextImpl.java 2007-06-26 09:22:18 UTC (rev 19) @@ -421,8 +421,15 @@ @Override public String getRequestPathInfo() { - String viewId = getRequestParameterMap().get( + String viewId = null; + RequestScope requestScope = Util.getRequestScope(this); + if(requestScope != null) { + viewId = requestScope.getViewId(); + } + if(viewId == null) { + viewId = getRequestParameterMap().get( BridgeConstants.VIEW_ID_PARAMETER); + } if(viewId == null) { viewId = (String) getRequestMap().get( BridgeConstants.DEFAULT_VIEW_ID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-06-23 15:40:41
|
Revision: 18 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=18&view=rev Author: alonsoft Date: 2007-06-23 08:40:37 -0700 (Sat, 23 Jun 2007) Log Message: ----------- Fixed bug 1742057 Modified Paths: -------------- branches/jsf4portlets-1.0-alpha-1_01/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java Modified: branches/jsf4portlets-1.0-alpha-1_01/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java =================================================================== --- branches/jsf4portlets-1.0-alpha-1_01/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java 2007-06-23 13:15:48 UTC (rev 17) +++ branches/jsf4portlets-1.0-alpha-1_01/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java 2007-06-23 15:40:37 UTC (rev 18) @@ -49,8 +49,8 @@ public class ImplicitObjectELResolver extends ELResolver { private static final String[] IMPLICIT_OBJECTS = { - "portletConfig", "sessionPortletScope", - "sessionApplicationScope", "portletPreferences" + "portletConfig", "portletPreferences", + "sessionApplicationScope", "sessionPortletScope", }; @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-06-23 13:16:00
|
Revision: 17 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=17&view=rev Author: alonsoft Date: 2007-06-23 06:15:48 -0700 (Sat, 23 Jun 2007) Log Message: ----------- [maven-scm] copy for branch jsf4portlets-1.0-alpha-1_01 Modified Paths: -------------- branches/jsf4portlets-1.0-alpha-1_01/pom.xml Added Paths: ----------- branches/jsf4portlets-1.0-alpha-1_01/ Copied: branches/jsf4portlets-1.0-alpha-1_01 (from rev 16, tags/jsf4portlets-1.0-alpha-1) Modified: branches/jsf4portlets-1.0-alpha-1_01/pom.xml =================================================================== --- tags/jsf4portlets-1.0-alpha-1/pom.xml 2007-06-07 09:47:21 UTC (rev 16) +++ branches/jsf4portlets-1.0-alpha-1_01/pom.xml 2007-06-23 13:15:48 UTC (rev 17) @@ -3,7 +3,7 @@ <groupId>net.sf.jsf4portlets</groupId> <artifactId>jsf4portlets</artifactId> - <version>1.0-alpha-1</version> + <version>1.0-alpha-1_01</version> <packaging>jar</packaging> @@ -11,9 +11,9 @@ <url>http://jsf4portlets.sf.net/</url> <scm> - <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-1.0-alpha-1</connection> - <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/tags/jsf4portlets-1.0-alpha-1</developerConnection> - <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/tags/jsf4portlets-1.0-alpha-1</url> + <connection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/branches/jsf4portlets-1.0-alpha-1_01</connection> + <developerConnection>scm:svn:https://jsf4portlets.svn.sourceforge.net/svnroot/jsf4portlets/branches/jsf4portlets-1.0-alpha-1_01</developerConnection> + <url>http://jsf4portlets.svn.sourceforge.net/viewvc/jsf4portlets/branches/jsf4portlets-1.0-alpha-1_01</url> </scm> <description> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <alo...@us...> - 2007-06-07 09:47:25
|
Revision: 16 http://jsf4portlets.svn.sourceforge.net/jsf4portlets/?rev=16&view=rev Author: alonsoft Date: 2007-06-07 02:47:21 -0700 (Thu, 07 Jun 2007) Log Message: ----------- Fixed bug 1732654 Modified Paths: -------------- trunk/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java Modified: trunk/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java =================================================================== --- trunk/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java 2007-06-07 00:01:23 UTC (rev 15) +++ trunk/src/main/java/net/sf/jsf4portlets/el/ImplicitObjectELResolver.java 2007-06-07 09:47:21 UTC (rev 16) @@ -113,11 +113,11 @@ FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); ExternalContext extContext = facesContext.getExternalContext(); - PortletExternalContext pec = (PortletExternalContext) extContext; int index = Arrays.binarySearch(IMPLICIT_OBJECTS, property); if(index < 0) { return null; } else { + PortletExternalContext pec = (PortletExternalContext) extContext; switch(index) { case ELConstants.PORTLET_CONFIG: context.setPropertyResolved(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |