You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by de...@apache.org on 2007/09/14 13:06:40 UTC
svn commit: r575619 - in /portals/pluto/branches/1.1-286-COMPATIBILITY:
pluto-container/src/main/java/org/apache/pluto/core/
pluto-container/src/main/java/org/apache/pluto/internal/impl/
pluto-container/src/main/java/org/apache/pluto/spi/ pluto-portal-...
Author: dettborn
Date: Fri Sep 14 04:06:38 2007
New Revision: 575619
URL: http://svn.apache.org/viewvc?rev=575619&view=rev
Log:
Committed patchs:
response.patch from JIRA 432 (http://issues.apache.org/jira/browse/PLUTO-432),
eventing.provided_jaxb_proposal2.120907_rev574692.patch from JIRA 267 (http://issues.apache.org/jira/browse/PLUTO-267) and
taglib_091407.patch from JIRA 433 (http://issues.apache.org/jira/browse/PLUTO-433).
Thank you Tuomas and Kay
Added:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PropertyTag.java
Modified:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/PortalCallbackService.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet-el.tld
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet.tld
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Fri Sep 14 04:06:38 2007
@@ -252,7 +252,7 @@
saveChangedParameters(actionRequest, actionResponse, portletURLProvider);
EventProvider provider = this.getRequiredContainerServices().getPortalCallbackService().
- getEventProvider(request,response, this);
+ getEventProvider(request,portletWindow);
provider.fireEvents(this);
// After processing action, send a redirect URL for rendering.
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java Fri Sep 14 04:06:38 2007
@@ -48,9 +48,6 @@
private static final StringManager EXCEPTIONS = StringManager.getManager(
MimeResponseImpl.class.getPackage().getName());
- /** The current content type. */
- private String currentContentType = null;
-
public MimeResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
@@ -59,6 +56,7 @@
super(container, internalPortletWindow, servletRequest,
servletResponse);
+
}
@Override
@@ -66,15 +64,6 @@
getHttpServletResponse().flushBuffer();
}
- @Override
- public int getBufferSize() {
- if (super.isForwarded() || super.isIncluded()){
- return 0;
- }
- else
- return 0;
- }
-
public CacheControl getCacheControl() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
@@ -86,11 +75,6 @@
}
@Override
- public String getContentType() {
- return getHttpServletResponse().getContentType();
- }
-
- @Override
public Locale getLocale() {
return getHttpServletResponse().getLocale();
}
@@ -100,7 +84,7 @@
* @see #getWriter()
*/
public OutputStream getPortletOutputStream() throws IOException {
- if (currentContentType == null) {
+ if (getContentType() == null) {
String message = EXCEPTIONS.getString("error.contenttype.null");
if (LOG.isWarnEnabled()) {
LOG.warn("Current content type is not set.");
@@ -116,7 +100,7 @@
*/
@Override
public PrintWriter getWriter() throws IOException, IllegalStateException {
- if (currentContentType == null) {
+ if (getContentType() == null) {
String message = EXCEPTIONS.getString("error.contenttype.null");
if (LOG.isWarnEnabled()) {
LOG.warn("Current content type is not set.");
@@ -146,25 +130,6 @@
getHttpServletResponse().setBufferSize(size);
}
- @Override
- public void setContentType(String contentType)
- throws IllegalArgumentException {
-
- if (super.isIncluded()){
- //no operation
- }
- else{
- ArgumentUtility.validateNotNull("contentType", contentType);
- String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
- if (!isValidContentType(mimeType)) {
- throw new IllegalArgumentException("Specified content type '"
- + mimeType + "' is not supported.");
- }
- getHttpServletResponse().setContentType(mimeType);
- this.currentContentType = mimeType;
- }
- }
-
// access to a limited set of HttpServletResponse methods ------------------
@Override
@@ -291,7 +256,7 @@
* @param contentType the content type to check.
* @return true if the content type is valid, false otherwise.
*/
- private boolean isValidContentType(String contentType) {
+ protected boolean isValidContentType(String contentType) {
boolean valid = false;
PortletDD portletDD = getInternalPortletWindow().getPortletEntity()
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java Fri Sep 14 04:06:38 2007
@@ -28,6 +28,8 @@
import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.InternalRenderResponse;
import org.apache.pluto.spi.PortalCallbackService;
+import org.apache.pluto.util.ArgumentUtility;
+import org.apache.pluto.util.StringUtils;
/**
* Implementation of the <code>javax.portlet.RenderResponse</code> interface.
@@ -37,6 +39,8 @@
*/
public class RenderResponseImpl extends MimeResponseImpl
implements RenderResponse, InternalRenderResponse {
+
+ private String contenType = null;
public RenderResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
@@ -44,7 +48,6 @@
HttpServletResponse servletResponse) {
super(container, internalPortletWindow, servletRequest, servletResponse);
}
-
public void setTitle(String title) {
PortalCallbackService callback = getContainer()
@@ -88,4 +91,32 @@
super.setLocale(arg0);
}
+ @Override
+ public int getBufferSize() {
+ return 0;
+ }
+
+ @Override
+ public void setContentType(String contentType)
+ throws IllegalArgumentException {
+
+ if (super.isIncluded()){
+ //no operation
+ }
+ else{
+ ArgumentUtility.validateNotNull("contentType", contentType);
+ String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
+ if (!isValidContentType(mimeType)) {
+ throw new IllegalArgumentException("Specified content type '"
+ + mimeType + "' is not supported.");
+ }
+ getHttpServletResponse().setContentType(mimeType);
+ this.contenType = contentType;
+ }
+ }
+
+ @Override
+ public String getContentType() {
+ return contenType;
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java Fri Sep 14 04:06:38 2007
@@ -25,6 +25,8 @@
import org.apache.pluto.PortletContainer;
import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.InternalResourceResponse;
+import org.apache.pluto.util.ArgumentUtility;
+import org.apache.pluto.util.StringUtils;
public class ResourceResponseImpl extends MimeResponseImpl
implements ResourceResponse, InternalResourceResponse {
@@ -65,4 +67,35 @@
super.setLocale(arg0);
}
+ @Override
+ public int getBufferSize() {
+ if (super.isForwarded() || super.isIncluded()){
+ return 0;
+ }
+ else
+ return getHttpServletResponse().getBufferSize();
+ }
+
+ @Override
+ public void setContentType(String contentType)
+ throws IllegalArgumentException {
+
+ if (super.isIncluded()){
+ //no operation
+ }
+ else{
+ ArgumentUtility.validateNotNull("contentType", contentType);
+ String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
+ if (!isValidContentType(mimeType)) {
+ throw new IllegalArgumentException("Specified content type '"
+ + mimeType + "' is not supported.");
+ }
+ getHttpServletResponse().setContentType(mimeType);
+ }
+ }
+
+ @Override
+ public String getContentType() {
+ return getHttpServletResponse().getContentType();
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java Fri Sep 14 04:06:38 2007
@@ -43,8 +43,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.descriptors.portlet.EventDefinitionDD;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
import org.apache.pluto.descriptors.portlet.PortletDD;
import org.apache.pluto.descriptors.portlet.SupportsDD;
import org.apache.pluto.internal.InternalPortletWindow;
@@ -97,15 +95,9 @@
}
EventProvider provider = callback.getEventProvider(
- getHttpServletRequest(),getHttpServletResponse(), getContainer());
-
- if (isDeclaredAsPublishingEvent(qname)) {
-
- if (value != null && !isValueInstanceOfDefinedClass(qname,value))
- throw new IllegalArgumentException("Payload has not the right class");
-
- provider.registerToFireEvent(qname, value);
- }
+ getHttpServletRequest(),getInternalPortletWindow());
+
+ provider.registerToFireEvent(qname, value);
}
/* (non-Javadoc)
@@ -605,62 +597,4 @@
return super.isCommitted();
}
-
-// Not in API anymore
-// public void setDefaultNamspacedEvents(Map<String, Object> events) {
-// String defaultEventNamespace = getDefaultEventNamespace();
-// Set<String> keys = events.keySet();
-// for (String key : keys) {
-// setEvent((new QName(defaultEventNamespace, key)),(Serializable) events.get(key));
-// }
-// }
-
- // ****** private methods ******
-
- private boolean isDeclaredAsPublishingEvent(QName qname) {
- List<QName> events = getInternalPortletWindow().getPortletEntity()
- .getPortletDefinition().getPublishingEvents();
- if (events != null) {
- String contextPath = getInternalPortletWindow().getContextPath();
- try {
- PortletAppDD portletAppDD = getContainer().getPortletApplicationDescriptor(contextPath);
- String defaultNamespace = portletAppDD.getDefaultNamespace();
- if (defaultNamespace == null) {
- defaultNamespace = XMLConstants.NULL_NS_URI;
- }
- for (QName name : events) {
- String namespaceURI = name.getNamespaceURI();
- if (XMLConstants.NULL_NS_URI.equals(namespaceURI)) {
- name = new QName(defaultNamespace, name.getLocalPart());
- }
- if (qname.equals(name)) {
- return true;
- }
- }
- } catch (PortletContainerException e) {
- LOG.error(e);
- }
- }
- return false;
- }
-
- private boolean isValueInstanceOfDefinedClass(QName qname, Serializable value){
- PortletAppDD portletAppDD = null;
- try {
- portletAppDD =
- getContainer().getPortletApplicationDescriptor(getInternalPortletWindow().getContextPath());
- if (portletAppDD.getEvents() != null) {
- for (EventDefinitionDD event : portletAppDD.getEvents()) {
- if (event.getName().toString().equals(qname.toString())){
- return value.getClass().getName().equals(event.getJavaClass());
- }
- }
- }
- } catch (PortletContainerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- // event not declared
- return true;
- }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/PortalCallbackService.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/PortalCallbackService.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/PortalCallbackService.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/PortalCallbackService.java Fri Sep 14 04:06:38 2007
@@ -20,9 +20,7 @@
import javax.portlet.BaseURL;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletWindow;
/**
@@ -78,7 +76,7 @@
String value);
public EventProvider getEventProvider(HttpServletRequest request,
- HttpServletResponse response, PortletContainer container);
+ PortletWindow portletWindow);
public EventProvider getEventProvider();
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventProviderImpl.java Fri Sep 14 04:06:38 2007
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,6 +30,7 @@
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -52,15 +52,16 @@
import org.apache.pluto.driver.AttributeKeys;
import org.apache.pluto.driver.config.DriverConfiguration;
import org.apache.pluto.driver.core.PortletWindowImpl;
-import org.apache.pluto.driver.services.portal.PageConfig;
+import org.apache.pluto.driver.core.PortalRequestContext;
import org.apache.pluto.driver.services.portal.PortletApplicationConfig;
import org.apache.pluto.driver.services.portal.PortletWindowConfig;
import org.apache.pluto.driver.url.PortalURL;
import org.apache.pluto.driver.url.impl.PortalURLParserImpl;
+import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.impl.EventImpl;
import org.apache.pluto.spi.EventProvider;
-public class EventProviderImpl implements org.apache.pluto.spi.EventProvider {
+public class EventProviderImpl implements org.apache.pluto.spi.EventProvider, Cloneable {
private static final int DEFAULT_MAPSIZE = 10;
@@ -72,6 +73,7 @@
private HttpServletRequest request;
private HttpServletResponse response;
private PortletContainer container;
+ private PortletWindow portletWindow;
ThreadGroup threadGroup = new ThreadGroup("FireEventThreads");
@@ -87,16 +89,24 @@
* @return The corresponding EventProvierImpl instance
*/
public static EventProviderImpl getEventProviderImpl(HttpServletRequest request,
- HttpServletResponse response, PortletContainer container) {
- EventProviderImpl event = (EventProviderImpl) request.getAttribute(Constants.PROVIDER);
- if (event == null) {
- event = new EventProviderImpl();
- event.request = request;
- event.response = response;
- event.container = container;
- request.setAttribute(Constants.PROVIDER, event);
+ PortletWindow portletWindow) {
+ EventProviderImpl eventProvider = (EventProviderImpl) request.getAttribute(Constants.PROVIDER);
+ if (eventProvider == null) {
+ eventProvider = new EventProviderImpl();
+ eventProvider.request = request;
+ PortalRequestContext context = PortalRequestContext.getContext(request);
+ eventProvider.response = context.getResponse();
+ ServletContext servletContext = context.getServletContext();
+ eventProvider.container = (PortletContainer) servletContext.getAttribute(AttributeKeys.PORTLET_CONTAINER);
+ request.setAttribute(Constants.PROVIDER, eventProvider);
}
- return event;
+ try {
+ eventProvider = (EventProviderImpl) eventProvider.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new IllegalStateException(e);
+ }
+ eventProvider.portletWindow = portletWindow;
+ return eventProvider;
}
/**
@@ -124,45 +134,50 @@
*/
public void registerToFireEvent(QName qname, Serializable value)
throws IllegalArgumentException {
+ if (isDeclaredAsPublishingEvent(qname)) {
- try {
-
- if (value == null) {
- savedEvents.addEvent(new EventImpl(qname,value));
- } else if (!(value instanceof Serializable)) {
- throw new IllegalArgumentException("Object payload must implement Serializable");
- }
- else {
-
- Class clazz = value.getClass();
-
- JAXBContext jc = JAXBContext.newInstance(clazz);
-
- Marshaller marshaller = jc.createMarshaller();
-
- Writer out = new StringWriter();
-
- JAXBElement<Serializable> element = new JAXBElement<Serializable>(qname,clazz,value);
- marshaller.marshal(element, out);
-// marshaller.marshal(value, out);
-
- if (out != null) {
- savedEvents.addEvent(new EventImpl(qname,(Serializable) out.toString()));
- } else {
+ if (value != null && !isValueInstanceOfDefinedClass(qname,value))
+ throw new IllegalArgumentException("Payload has not the right class");
+
+ try {
+
+ if (value == null) {
savedEvents.addEvent(new EventImpl(qname,value));
+ } else if (!(value instanceof Serializable)) {
+ throw new IllegalArgumentException("Object payload must implement Serializable");
}
+ else {
+
+ Class clazz = value.getClass();
+
+ JAXBContext jc = JAXBContext.newInstance(clazz);
+
+ Marshaller marshaller = jc.createMarshaller();
+
+ Writer out = new StringWriter();
+
+ JAXBElement<Serializable> element = new JAXBElement<Serializable>(qname,clazz,value);
+ marshaller.marshal(element, out);
+ // marshaller.marshal(value, out);
+
+ if (out != null) {
+ savedEvents.addEvent(new EventImpl(qname,(Serializable) out.toString()));
+ } else {
+ savedEvents.addEvent(new EventImpl(qname,value));
+ }
+ }
+ } catch (JAXBException e) {
+ // maybe there is no valid jaxb binding
+ // TODO wsrp:eventHandlingFailed
+ LOG.error("Event handling failed", e);
+ } catch (FactoryConfigurationError e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ // } catch (ClassNotFoundException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
}
- } catch (JAXBException e) {
- // maybe there is no valid jaxb binding
- // TODO wsrp:eventHandlingFailed
- LOG.error("Event handling failed", e);
- } catch (FactoryConfigurationError e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-// } catch (ClassNotFoundException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
- }
+ }
}
/**
@@ -396,6 +411,54 @@
*/
public EventList getSavedEvents(){
return savedEvents;
+ }
+
+ private boolean isDeclaredAsPublishingEvent(QName qname) {
+ ServletContext servletContext = PortalRequestContext.getContext(request).getServletContext();
+ InternalPortletWindow internalPortletWindow = new org.apache.pluto.internal.impl.PortletWindowImpl(servletContext, this.portletWindow);
+ List<QName> events = internalPortletWindow.getPortletEntity()
+ .getPortletDefinition().getPublishingEvents();
+ if (events != null) {
+ String contextPath = portletWindow.getContextPath();
+ try {
+ PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(contextPath);
+ String defaultNamespace = portletAppDD.getDefaultNamespace();
+ if (defaultNamespace == null) {
+ defaultNamespace = XMLConstants.NULL_NS_URI;
+ }
+ for (QName name : events) {
+ String namespaceURI = name.getNamespaceURI();
+ if (XMLConstants.NULL_NS_URI.equals(namespaceURI)) {
+ name = new QName(defaultNamespace, name.getLocalPart());
+ }
+ if (qname.equals(name)) {
+ return true;
+ }
+ }
+ } catch (PortletContainerException e) {
+ LOG.error(qname, e);
+ }
+ }
+ return false;
+ }
+
+ private boolean isValueInstanceOfDefinedClass(QName qname, Serializable value){
+ PortletAppDD portletAppDD = null;
+ try {
+ portletAppDD =
+ container.getPortletApplicationDescriptor(portletWindow.getContextPath());
+ if (portletAppDD.getEvents() != null) {
+ for (EventDefinitionDD event : portletAppDD.getEvents()) {
+ if (event.getName().toString().equals(qname.toString())){
+ return value.getClass().getName().equals(event.getJavaClass());
+ }
+ }
+ }
+ } catch (PortletContainerException e) {
+ LOG.error(qname, e);
+ }
+ // event not declared
+ return true;
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java Fri Sep 14 04:06:38 2007
@@ -20,11 +20,8 @@
import java.util.Collections;
import java.util.Map;
-import javax.portlet.BaseURL;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletWindow;
import org.apache.pluto.driver.AttributeKeys;
import org.apache.pluto.driver.core.ResourceURLProviderImpl;
@@ -100,9 +97,8 @@
}
public EventProvider getEventProvider(
- HttpServletRequest request,HttpServletResponse response,
- PortletContainer container) {
- return EventProviderImpl.getEventProviderImpl(request,response, container);
+ HttpServletRequest request, PortletWindow portletWindow) {
+ return EventProviderImpl.getEventProviderImpl(request, portletWindow);
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java Fri Sep 14 04:06:38 2007
@@ -35,16 +35,18 @@
* points to the current Portlet and triggers an action request with the
* supplied parameters.
*
- * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
* @version 2.0
*/
public class ActionURLTag extends PortletURLTag {
+
+ private static final long serialVersionUID = 286L;
/**
- * Creates an actionURL
+ * Creates an action PortletURL
* @param portletResponse PortletResponse
* @return PortletURL
*/
+ @Override
protected PortletURL createPortletUrl(PortletResponse portletResponse)
{
return portletResponse.createActionURL();
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java Fri Sep 14 04:06:38 2007
@@ -16,7 +16,11 @@
*/
package org.apache.pluto.tags;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
@@ -30,7 +34,6 @@
/**
* Abstract supporting class for actionURL tag, renderURL tag and resourceURL tag.
*
- * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
* @version 2.0
*
*/
@@ -48,7 +51,7 @@
if (var != null) {
vi = new VariableInfo[1];
vi[0] =
- new VariableInfo(var, "java.lang.String", true,
+ new VariableInfo(var, "java.lang.String", true,
VariableInfo.AT_BEGIN);
}
return vi;
@@ -56,41 +59,43 @@
}
- protected String secure;
+ //--------------------------------------------------------------------------
+
+ protected String secure = null;
protected Boolean secureBoolean;
- protected String var;
+ protected String var = null;
//TODO: not the default value (should be true)
- protected Boolean escapeXml=false;
+ protected Boolean escapeXml = false;
- protected Map<String,List<String>> parameters=new HashMap<String,List<String>> ();
+ protected Map<String,List<String>> parametersMap = new HashMap<String,List<String>> ();
+ protected Map<String, List<String>> propertiesMap = new HashMap<String,List<String>> ();
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return int
- */
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
+ */
+ @Override
public abstract int doStartTag() throws JspException;
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return int
- */
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
+ */
+ @Override
public abstract int doEndTag() throws JspException;
- /**
- * Releases state of the tag handler.
- * @return void
- */
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#release()
+ */
//Called at the end of the lifecycle.
- public void release()
- {
+ @Override
+ public void release(){
super.release();
- parameters=null;
- secureBoolean=null;
+ parametersMap = null;
+ secureBoolean = null;
}
@@ -167,41 +172,93 @@
* @param value String
* @return void
*/
- public void addParameter(String key,String value)
- {
- /*if (escapeXml)
- {
- value=escapeXml(value);
- }*/
- List<String> values;
- if(parameters.containsKey(key))
- {
- values=(List<String>)parameters.get(key);//get old value list
+ protected void addParameter(String key,String value) {
+ if(key == null){
+ throw new NullPointerException();
+ }
+
+ if((value == null) || (value.length() == 0)){//remove parameter
+ if(parametersMap.containsKey(key)){
+ parametersMap.remove(key);
+ }
}
- else
- {
- values=new ArrayList<String>();// create new value list
+ else{//add value
+ List<String> valueList = null;
+
+ if(parametersMap.containsKey(key)){
+ valueList = parametersMap.get(key);//get old value list
+ }
+ else{
+ valueList = new ArrayList<String>();// create new value list
+ }
+
+ valueList.add(value);
+
+ parametersMap.put(key, valueList);
}
- values.add(value);
- parameters.put(key, values);
+ }
+
+ /**
+ * Adds a key,value pair to the property map.
+ * @param key String
+ * @param value String
+ * @return void
+ */
+ protected void addProperty(String key,String value) {
+ if(key == null){
+ throw new NullPointerException();
+ }
+
+ List<String> valueList = null;
+
+ if(propertiesMap.containsKey(key)){
+ valueList = propertiesMap.get(key);//get old value list
+ }
+ else{
+ valueList = new ArrayList<String>();// create new value list
+ }
+
+ valueList.add(value);
+
+ propertiesMap.put(key, valueList);
+
}
/**
- * Copies parameters from map to url.
+ * Copies the parameters from map to the BaseURL.
* @param url BaseURL
* @return void
*/
- protected void setUrlParameters(BaseURL url)
- {
- Set<String> keys=parameters.keySet();
- Iterator i=keys.iterator();
- while(i.hasNext())
- {
- String key=(String) i.next();
- List<String> values=parameters.get(key);
- String[] valarr=values.toArray(new String[0]);
- url.setParameter(key, valarr);
+ protected void setUrlParameters(BaseURL url) {
+ Set<String> keySet = parametersMap.keySet();
+
+
+ for(String key : keySet){
+
+ List<String> valueList = parametersMap.get(key);
+
+ String[] valueArray = valueList.toArray(new String[0]);
+
+ url.setParameter(key, valueArray);
+ }
+ }
+
+ /**
+ * Copies the properties from map to the BaseURL.
+ * @param url BaseURL
+ * @return void
+ */
+ protected void setUrlProperties(BaseURL url) {
+ Set<String> keySet = propertiesMap.keySet();
+
+ for(String key : keySet){
+
+ List<String> valueList = propertiesMap.get(key);
+
+ for(String value:valueList){
+ url.addProperty(key, value);
+ }
}
}
@@ -224,7 +281,7 @@
/**
* Checks if string is empty.
- * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * This method is a copy from <code>org.apache.commons.lang.StringUtils</code> class.
* @param str String
* @return boolean
*/
@@ -235,7 +292,7 @@
/**
* Replaces String repl with String with in String text.
- * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * This method is a copy from <code>org.apache.commons.lang.StringUtils</code> class.
* @param text - the String where to replace
* @param repl - the sub-String what to replace
* @param with - the sub-String what to replace repl with
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java Fri Sep 14 04:06:38 2007
@@ -16,6 +16,8 @@
*/
package org.apache.pluto.tags;
+import java.util.Map;
+
import javax.portlet.*;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
@@ -28,22 +30,38 @@
* A tag handler for the <CODE>defineObjects</CODE> tag. Creates the
* following variables to be used in the JSP:
* <UL>
- * <LI><CODE>{@link RenderRequest} renderRequest</CODE>, when included from within the <CODE>render</CODE> method
- * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>, when included from within the <CODE>serveResource</CODE> method
- * <LI><CODE>{@link ActionRequest} actionRequest</CODE>, when included from within the <CODE>processAction</CODE> method
- * <LI><CODE>{@link EventRequest} eventRequest</CODE>, when included from within the <CODE>processEvent</CODE> method
- * <LI><CODE>{@link RenderResponse} renderResponse</CODE>, when included from within the <CODE>render</CODE> method
- * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>, when included from within the <CODE>serveResource</CODE> method
- * <LI><CODE>{@link ActionResponse} actionResponse</CODE>, when included from within the <CODE>processAction</CODE> method
- * <LI><CODE>{@link EventResponse} eventResponse</CODE>, when included from within the <CODE>processEvent</CODE> method
+ * <LI><CODE>{@link RenderRequest} renderRequest</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionRequest} actionRequest</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventRequest} eventRequest</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link RenderResponse} renderResponse</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionResponse} actionResponse</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventResponse} eventResponse</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
* <LI><CODE>{@link PortletConfig} portletConfig</CODE>
- * <LI><CODE>{@link PortletSession} portletSession</CODE>
- * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>
+ * <LI><CODE>{@link PortletSession} portletSession</CODE>, providing access to the portletSession,
+ * does not create a new session, only returns an existing session
+ * <LI><CODE>{@link Map<String, String[]>} portletSessionScope</CODE>, providing access to the
+ * portletSession attributes as a Map.
+ * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>, providing access to
+ * the portlet preferences
+ * <LI> <CODE>{@link Map<String, String[]>} portletPreferencesValues</CODE>, providing access to the
+ * portlet preferences as a Map
* </UL>
*
* @version 2.0
*/
public class DefineObjectsTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
/**
* Helper method.
@@ -69,12 +87,11 @@
* Helper method.
* <p>
* Sets render and request attribute with the names described in the
- * JSR 286 - PLT 25.1 (defineObjects Tag).
+ * JSR 286 - PLT 26.1 (defineObjects Tag).
* @param request PortletRequest
* @param response PortletResponse
- * @return void
*/
- private void setReqRes(PortletRequest request,PortletResponse response )
+ private void setRequestAndResponseAttribute(PortletRequest request,PortletResponse response )
{
//check where request and response where included from
if(request instanceof RenderRequest)
@@ -115,12 +132,20 @@
PortletConfig portletConfig = (PortletConfig) pageContext.getRequest()
.getAttribute(Constants.PORTLET_CONFIG);
- PortletSession portletSession=request.getPortletSession();
+ PortletSession portletSession=request.getPortletSession(false);
+ Map<String, Object> portletSessionScope = null;
+ if(portletSession != null){
+ portletSessionScope = (Map<String, Object>)portletSession.getMap();
+ }
PortletPreferences portletPreferences = request.getPreferences();
+ Map<String, String[]> portletPreferencesValues = null;
+ if(portletPreferences != null){
+ portletPreferencesValues = portletPreferences.getMap();
+ }
// set attributes render and request
- setReqRes(request,response);
+ setRequestAndResponseAttribute(request,response);
// set attribute portletConfig
setAttribute(portletConfig,"portletConfig");
@@ -128,8 +153,14 @@
// set attribute portletSession
setAttribute(portletSession,"portletSession");
+ //set attribute portletSession
+ setAttribute(portletSessionScope,"portletSessionScope");
+
// set attribute portletPreferences
- setAttribute(portletPreferences,"portletPreferences");
+ setAttribute(portletPreferences,"portletPreferences");
+
+ // set attribute portletPreferences
+ setAttribute(portletPreferencesValues,"portletPreferencesValues");
return SKIP_BODY;
}
@@ -174,14 +205,23 @@
"javax.portlet.PortletConfig",
true,
VariableInfo.AT_BEGIN),
- new VariableInfo("portletPreferences",
+ new VariableInfo("portletSession",
+ "javax.portlet.PortletSession",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletSessionScope",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferences",
"javax.portlet.PortletPreferences",
true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletSession",
- "javax.portlet.PortletSession",
- true,
- VariableInfo.AT_BEGIN)
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferencesValues",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+
};
return info;
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java Fri Sep 14 04:06:38 2007
@@ -30,6 +30,8 @@
* for the current portlet <BR>This tag has no attributes
*/
public class NamespaceTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
/* (non-Javadoc)
* @see javax.servlet.jsp.tagext.Tag#doStartTag()
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java Fri Sep 14 04:06:38 2007
@@ -32,14 +32,16 @@
* @version 2.0
*/
public class ParamTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
private String name;
private String value;
- /**
- * Processes the <CODE>param</CODE> tag.
- * @return <CODE>SKIP_BODY</CODE>
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
*/
+ @Override
public int doStartTag() throws JspException {
BaseURLTag urlTag = (BaseURLTag)
findAncestorWithClass(this, BaseURLTag.class);
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java Fri Sep 14 04:06:38 2007
@@ -20,7 +20,6 @@
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Map;
@@ -50,15 +49,15 @@
* TagExtraInfo class for PortletURLTag.
*/
public static class TEI extends BaseURLTag.TEI {
- public final static Hashtable definedWindowStates = getDefinedWindowStates();
- public final static Hashtable portletModes = getDefinedPortletModes();
+ public final static Hashtable<String,Object> definedWindowStates = getDefinedWindowStates();
+ public final static Hashtable<String,Object> portletModes = getDefinedPortletModes();
/**
* Provides a list of all static PortletMode available in the
* specifications by using introspection
* @return Hashtable
*/
- private static Hashtable getDefinedPortletModes() {
+ private static Hashtable<String,Object> getDefinedPortletModes() {
Hashtable<String,Object> portletModes = new Hashtable<String,Object>();
Field[] f = PortletMode.class.getDeclaredFields();
@@ -82,7 +81,7 @@
* specifications by using introspection
* @return Hashtable
*/
- private static Hashtable getDefinedWindowStates() {
+ private static Hashtable<String,Object> getDefinedWindowStates() {
Hashtable<String,Object> definedWindowStates = new Hashtable<String,Object>();
Field[] f = WindowState.class.getDeclaredFields();
@@ -103,37 +102,38 @@
}
- protected String portletMode;
- protected String windowState;
- protected Boolean copyCurrentRenderParameters=false;
- protected PortletURL url;
+ //------------------------------------------------------------------------------------------------------------------
+ protected String portletMode = null;
+ protected String windowState = null;
+ protected Boolean copyCurrentRenderParameters = false;
+ protected PortletURL url = null;
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return EVAL_BODY_INCLUDE
- */
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doStartTag()
+ */
+ @Override
public int doStartTag() throws JspException {
//parameters= new HashMap<String,List<String>> ();
- if(copyCurrentRenderParameters)
- {
+ if(copyCurrentRenderParameters){
doCopyCurrentRenderParameters();
}
if (var != null) {
pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
}
- PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
- .getAttribute(Constants.PORTLET_RESPONSE);
+
+ PortletResponse portletResponse =
+ (PortletResponse) pageContext.getRequest().getAttribute(Constants.PORTLET_RESPONSE);
if (portletResponse != null) {
setUrl(createPortletUrl(portletResponse));
- if (portletMode != null) {
+ if (portletMode != null) {//set portlet mode
try {
PortletMode mode = (PortletMode)
TEI.portletModes.get(portletMode.toUpperCase());
@@ -141,29 +141,34 @@
if (mode == null) {
mode = new PortletMode(portletMode);// support for custom portlet modes PLUTO-258
}
+
url.setPortletMode(mode);
- } catch (PortletModeException e) {
- throw new JspException(e);
+
+ } catch (PortletModeException e) {
+ throw new JspException(e);
}
}
- if (windowState != null) {
- try {
+ if (windowState != null) {//set window state
+ try {
WindowState state = (WindowState)
TEI.definedWindowStates.get(windowState.toUpperCase());
+
if (state == null) {
state = new WindowState(windowState);//support for custom window states PLUTO-258
}
+
url.setWindowState(state);
- } catch (WindowStateException e) {
+
+ } catch (WindowStateException e) {
throw new JspException(e);
}
}
- if (secure != null) {
- try {
+ if (secure != null) {//set secure boolean
+ try {
url.setSecure(getSecureBoolean());
- } catch (PortletSecurityException e) {
+ } catch (PortletSecurityException e) {
throw new JspException(e);
}
}
@@ -172,26 +177,25 @@
}
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return EVAL_PAGE
- */
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doEndTag()
+ */
+ @Override
public int doEndTag() throws JspException{
- setUrlParameters(url);
+ setUrlParameters(url);
+ setUrlProperties(url);
-
- HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+ HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
// properly encoding urls to allow non-cookie enabled sessions - PLUTO-252
- String urlString=response.encodeURL(url.toString());
+ String urlString = response.encodeURL(url.toString());
if(escapeXml){
- urlString=doEscapeXml(urlString);
+ urlString = doEscapeXml(urlString);
}
if (var == null) {
- try {
+ try {
JspWriter writer = pageContext.getOut();
writer.print(urlString);
} catch (IOException ioe) {
@@ -204,7 +208,8 @@
PageContext.PAGE_SCOPE);
}
- parameters.clear();//cleanup
+ propertiesMap.clear();
+ parametersMap.clear();//cleanup
return EVAL_PAGE;
}
@@ -290,26 +295,26 @@
* Copies the current render parameters to the parameter map.
* @return void
*/
- protected void doCopyCurrentRenderParameters()
- {
- PortletRequest request = (PortletRequest) pageContext.getRequest()
- .getAttribute(Constants.PORTLET_REQUEST);
- if(request!=null)
- {
- Map<String,String[]> renderParamsMap=request.getParameterMap();
- Set<String> keys=renderParamsMap.keySet();
- Iterator i=keys.iterator();
- while(i.hasNext())
- {
- String key=(String) i.next();
- String[] values=renderParamsMap.get(key);
- List<String> valuesList=new ArrayList<String>();
- int index=0;
- while(index<values.length){
- valuesList.add(values[index]);
- index++;
- }
- parameters.put(key,valuesList);
+ protected void doCopyCurrentRenderParameters(){
+ PortletRequest request =
+ (PortletRequest) pageContext.getRequest().getAttribute(Constants.PORTLET_REQUEST);
+
+ if(request != null){
+ Map<String,String[]> renderParamsMap = request.getPrivateParameterMap();
+
+ Set<String> keySet = renderParamsMap.keySet();
+
+ for(String key : keySet){
+
+ String[] values = renderParamsMap.get(key);
+
+ List<String> valueList = new ArrayList<String>();
+
+ for(int index = 0; index < values.length; ++index){
+ valueList.add(values[index]);
+ }
+
+ parametersMap.put(key,valueList);
}
}
}
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PropertyTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PropertyTag.java?rev=575619&view=auto
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PropertyTag.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/PropertyTag.java Fri Sep 14 04:06:38 2007
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+
+/**
+ * A tag handler for the <CODE>property</CODE> tag. Defines a propery that
+ * can be added to a <CODE>actionURL</CODE>, a <CODE>resourceURL</CODE> or a <CODE>renderURL</CODE>
+ * <BR>The following attributes are mandatory:
+ * <UL>
+ * <LI><CODE>name</CODE>
+ * <LI><CODE>value</CODE>
+ * </UL>
+ *
+ * @version 2.0
+ */
+public class PropertyTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
+
+ private String name;
+ private String value;
+
+ /**
+ * Processes the <CODE>param</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ BaseURLTag urlTag = (BaseURLTag)
+ findAncestorWithClass(this, BaseURLTag.class);
+
+ if (urlTag == null) {
+ throw new JspException(
+ "the 'param' Tag must have actionURL, renderURL or resourceURL as a parent");
+ }
+
+ urlTag.addProperty(getName(), getValue());
+
+ return SKIP_BODY;
+ }
+
+ /**
+ * Returns the name.
+ * @return String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value.
+ * @return String
+ */
+ public String getValue() throws JspException {
+ if (value == null) {
+ value = "";
+ }
+ return value;
+ }
+
+ /**
+ * Sets the name.
+ * @param name The name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the value.
+ * @param value The value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java Fri Sep 14 04:06:38 2007
@@ -29,13 +29,15 @@
* @version 2.0
*/
public class RenderURLTag extends PortletURLTag {
-
+
+ private static final long serialVersionUID = 286L;
/**
- * Creates a renderURL
+ * Creates a render PortletURL
* @param portletResponse PortletResponse
* @return PortletURL
*/
+ @Override
protected PortletURL createPortletUrl(PortletResponse portletResponse)
{
return portletResponse.createRenderURL();
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java Fri Sep 14 04:06:38 2007
@@ -18,12 +18,10 @@
import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import javax.portlet.BaseURL;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSecurityException;
+import javax.portlet.ResourceURL;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
@@ -40,67 +38,105 @@
*/
public class ResourceURLTag extends BaseURLTag {
+
+ private static final long serialVersionUID = 286L;
- protected BaseURL url;
+ private ResourceURL url = null;
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return EVAL_BODY_INCLUDE
- */
+ private String id = null;
+ private String cachability = null;
+
+
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doStartTag()
+ */
+ @Override
public int doStartTag() throws JspException {
- parameters= new HashMap<String,List<String>> ();
+
if (var != null) {
pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
}
+
PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
.getAttribute(Constants.PORTLET_RESPONSE);
if (portletResponse != null) {
- setUrl(portletResponse.createResourceURL());
+
+ url = portletResponse.createResourceURL();
+
if (secure != null) {
+
try {
+
url.setSecure(getSecureBoolean());
+
} catch (PortletSecurityException e) {
+
throw new JspException(e);
+
}
}
}
return EVAL_BODY_INCLUDE;
}
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return EVAL_PAGE
- */
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doEndTag()
+ */
+ @Override
public int doEndTag() throws JspException{
setUrlParameters(url);
+ setUrlProperties(url);
+
+ if(id != null){
+ url.setResourceID(id);
+ }
+
+ if(cachability != null){
+ try{
+ url.setCacheability(cachability);
+ }
+ catch(IllegalArgumentException e){
+ throw new JspException(e);
+ }
+ catch(IllegalStateException e){
+ throw new JspException(e);
+ }
+ }
- HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+ HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
- String urlString=response.encodeURL(url.toString());
+ String urlString = response.encodeURL(url.toString());
- if(escapeXml)
- {
- urlString=doEscapeXml(urlString);
+ if(escapeXml){
+
+ urlString = doEscapeXml(urlString);
}
if (var == null) {
try {
+
JspWriter writer = pageContext.getOut();
writer.print(urlString);
+
} catch (IOException ioe) {
+
throw new JspException(
"resourceURL Tag Exception: cannot write to the output writer.");
}
+
} else {
+
pageContext.setAttribute(var, urlString,
PageContext.PAGE_SCOPE);
+
}
- parameters.clear();//cleanup
+ propertiesMap.clear();
+ parametersMap.clear();//cleanup
return EVAL_PAGE;
}
@@ -109,7 +145,7 @@
* Gets the url property.
* @return BaseURL
*/
- public BaseURL getUrl() {
+ public ResourceURL getUrl() {
return url;
}
@@ -118,7 +154,38 @@
* @param url BaseUrl - The url to set.
* @return void
*/
- public void setUrl(BaseURL url) {
+ public void setUrl(ResourceURL url) {
this.url = url;
}
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @return the cachability
+ */
+ public String getCachability() {
+ return cachability;
+ }
+
+
+ /**
+ * @param cachability the cachability to set
+ */
+ public void setCachability(String cachability) {
+ this.cachability = cachability;
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java Fri Sep 14 04:06:38 2007
@@ -21,6 +21,8 @@
public class ParamTag extends org.apache.pluto.tags.ParamTag {
+
+ private static final long serialVersionUID=286L;
public String getValue() throws JspException {
String string = super.getValue();
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet-el.tld
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet-el.tld?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet-el.tld (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet-el.tld Fri Sep 14 04:06:38 2007
@@ -46,6 +46,21 @@
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
+ <tag>
+ <name>property</name>
+ <tagclass>org.apache.pluto.tags.PropertyTag</tagclass>
+ <bodycontent>empty</bodycontent>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
<tag>
<name>actionURL</name>
<tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
@@ -137,7 +152,17 @@
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
- </attribute>
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
</tag>
<tag>
<name>namespace</name>
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet.tld
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet.tld?rev=575619&r1=575618&r2=575619&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet.tld (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-taglib/src/main/resources/META-INF/portlet.tld Fri Sep 14 04:06:38 2007
@@ -47,6 +47,21 @@
</attribute>
</tag>
<tag>
+ <name>property</name>
+ <tagclass>org.apache.pluto.tags.PropertyTag</tagclass>
+ <bodycontent>empty</bodycontent>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
<name>actionURL</name>
<tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
<teiclass>org.apache.pluto.tags.PortletURLTag$TEI</teiclass>
@@ -137,7 +152,17 @@
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
- </attribute>
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
</tag>
<tag>
<name>namespace</name>