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 uk...@apache.org on 2007/06/07 11:59:39 UTC
svn commit: r545132 [1/2] - 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/ plut...
Author: ukuester
Date: Thu Jun 7 02:59:35 2007
New Revision: 545132
URL: http://svn.apache.org/viewvc?view=rev&rev=545132
Log:
This patch is for filter and the changes for the new API Revision from 14 to 15.
Added:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/FilterManager.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterChainImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterConfigImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterManagerImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ProcessAction.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/RenderMode.java
Modified:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.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-container/src/main/java/org/apache/pluto/wrappers/ActionResponseWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/FilterMappingDD.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/jaxb/JaxBDescriptorServiceImplTest.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-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/AboutPortlet.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pom.xml
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/pom.xml
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ActionRequest.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/BaseURL.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/CacheControl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/Event.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/GenericPortlet.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/MimeResponse.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortalContext.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletConfig.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletContext.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletMode.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletModeException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletPreferences.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletRequest.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletRequestDispatcher.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletResponse.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletSecurityException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/PortletSession.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ProcessEvent.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ReadOnlyException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/RenderRequest.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/RenderResponse.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ResourceRequest.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ResourceResponse.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ResourceURL.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/StateAwareResponse.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/UnavailableException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ValidatorException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/WindowState.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/WindowStateException.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/ActionRequestWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/ActionResponseWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/EventRequestWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/EventResponseWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/FilterChain.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/RenderRequestWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/RenderResponseWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/ResourceRequestWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/filter/ResourceResponseWrapper.java
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/license.txt
portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/portlet.xml.txt
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -45,6 +46,7 @@
import org.apache.pluto.internal.impl.RenderResponseImpl;
import org.apache.pluto.internal.impl.ResourceRequestImpl;
import org.apache.pluto.internal.impl.ResourceResponseImpl;
+import org.apache.pluto.spi.FilterManager;
/**
* Portlet Invocation Servlet. This servlet recieves cross context requests from
@@ -210,14 +212,19 @@
Constants.PORTLET_RESPONSE);
portletRequest.init(portletContext, request);
+ //Init the classloader for the filter and get the Service for processing the filters.
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ FilterManager filtermanager = (FilterManager) request.getAttribute(
+ "filter-manager");
+
// The requested method is RENDER: call Portlet.render(..)
if (methodId == Constants.METHOD_RENDER) {
RenderRequestImpl renderRequest =
(RenderRequestImpl) portletRequest;
RenderResponseImpl renderResponse =
(RenderResponseImpl) portletResponse;
+ filtermanager.processFilter(renderRequest, renderResponse, loader, portletName, portletContext,"RENDER_PHASE");
portlet.render(renderRequest, renderResponse);
-
}
//The requested method is RESOURCE: call ResourceServingPortlet.serveResource(..)
@@ -298,5 +305,5 @@
else{
resourceServingPortlet = new NullPortlet();
}
- }
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventImpl.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -38,11 +39,15 @@
_value = value;
}
- public QName getName() {
+ public QName getQName() {
return _qname;
}
public Object getValue() {
return _value;
+ }
+
+ public String getName() {
+ return _qname.getLocalPart();
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -82,7 +83,7 @@
Object value = event.getValue();
if (value instanceof XMLStreamReader) {
XMLStreamReader xml = (XMLStreamReader) event.getValue();
- EventDefinitionDD eventDefinitionDD = provider.getEventDefinition(event.getName());
+ EventDefinitionDD eventDefinitionDD = provider.getEventDefinition(event.getQName());
try {
// now test if object is jaxb
@@ -96,7 +97,7 @@
JAXBElement result = unmarshaller.unmarshal(xml,clazz);
- return new EventImpl(event.getName(),result.getValue());
+ return new EventImpl(event.getQName(),result.getValue());
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -120,5 +121,10 @@
public Enumeration getPublicRenderParameterNames() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
+ }
+
+ public String getDefaultEventNamespace() {
+ // TODO Auto-generated method stub
+ return null;
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java Thu Jun 7 02:59:35 2007
@@ -23,7 +23,9 @@
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
@@ -100,16 +102,47 @@
// PortletRequestDispatcher Impl -------------------------------------------
-
- public void include(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+
+ public void include(PortletRequest request, PortletResponse response) throws PortletException, IOException {
+
+ if(ActionRequest.class.isInstance(request)&& ActionResponse.class.isInstance(response)){
+ InternalActionRequest internalRequest = (InternalActionRequest)
+ InternalImplConverter.getInternalRequest(request);
+ InternalActionResponse internalResponse = (InternalActionResponse)
+ InternalImplConverter.getInternalResponse(response);
+ include(internalRequest, internalResponse);
+ }
+ if(RenderRequest.class.isInstance(request)&& RenderResponse.class.isInstance(response)){
+ InternalRenderRequest internalRequest = (InternalRenderRequest)
+ InternalImplConverter.getInternalRequest(request);
+ InternalRenderResponse internalResponse = (InternalRenderResponse)
+ InternalImplConverter.getInternalResponse(response);
+ include(internalRequest, internalResponse);
+ }
+ if(EventRequest.class.isInstance(request)&& EventResponse.class.isInstance(response)){
+ InternalEventRequest internalRequest = (InternalEventRequest)
+ InternalImplConverter.getInternalRequest(request);
+ InternalEventResponse internalResponse = (InternalEventResponse)
+ InternalImplConverter.getInternalResponse(response);
+ include(internalRequest, internalResponse);
+ }
+ if(ResourceRequest.class.isInstance(request)&& ResourceResponse.class.isInstance(response)){
+ InternalResourceRequest internalRequest = (InternalResourceRequest)
+ InternalImplConverter.getInternalRequest(request);
+ InternalResourceResponse internalResponse = (InternalResourceResponse)
+ InternalImplConverter.getInternalResponse(response);
+ include(internalRequest, internalResponse);
+ }
+ }
- InternalRenderRequest internalRequest = (InternalRenderRequest)
- InternalImplConverter.getInternalRequest(request);
- InternalRenderResponse internalResponse = (InternalRenderResponse)
- InternalImplConverter.getInternalResponse(response);
-
- boolean isIncluded = (internalRequest.isIncluded()
+ public void forward(PortletRequest request, PortletResponse response) throws PortletException, IOException, IllegalStateException {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void include(InternalActionRequest internalRequest, InternalActionResponse internalResponse)
+ throws PortletException, IOException {
+ boolean isIncluded = (internalRequest.isIncluded()
|| internalResponse.isIncluded());
try {
internalRequest.setIncluded(true);
@@ -132,99 +165,82 @@
internalResponse.setIncluded(isIncluded);
}
}
-
- public void include(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
- InternalResourceRequest internalRequest = (InternalResourceRequest)
- InternalImplConverter.getInternalRequest(request);
- InternalResourceResponse internalResponse = (InternalResourceResponse)
- InternalImplConverter.getInternalResponse(response);
-
- boolean isIncluded = (internalRequest.isIncluded()
- || internalResponse.isIncluded());
- try {
- internalRequest.setIncluded(true);
- internalRequest.setIncludedQueryString(queryString);
- internalResponse.setIncluded(true);
-
- requestDispatcher.include(
- (HttpServletRequest) internalRequest,
- (HttpServletResponse) internalResponse);
- } catch (IOException ex) {
- throw ex;
- } catch (ServletException ex) {
- if (ex.getRootCause() != null) {
- throw new PortletException(ex.getRootCause());
- } else {
- throw new PortletException(ex);
- }
- } finally {
- internalRequest.setIncluded(isIncluded);
- internalResponse.setIncluded(isIncluded);
- }
- }
+
+ private void include(InternalRenderRequest internalRequest, InternalRenderResponse internalResponse)
+ throws PortletException, IOException {
+ boolean isIncluded = (internalRequest.isIncluded()
+ || internalResponse.isIncluded());
+ try {
+ internalRequest.setIncluded(true);
+ internalRequest.setIncludedQueryString(queryString);
+ internalResponse.setIncluded(true);
- public void include(ActionRequest request, ActionResponse response) throws PortletException, IOException {
- InternalActionRequest internalRequest = (InternalActionRequest)
- InternalImplConverter.getInternalRequest(request);
- InternalActionResponse internalResponse = (InternalActionResponse)
- InternalImplConverter.getInternalResponse(response);
-
- boolean isIncluded = (internalRequest.isIncluded()
- || internalResponse.isIncluded());
- try {
- internalRequest.setIncluded(true);
- internalRequest.setIncludedQueryString(queryString);
- internalResponse.setIncluded(true);
-
- requestDispatcher.include(
- (HttpServletRequest) internalRequest,
- (HttpServletResponse) internalResponse);
- } catch (IOException ex) {
- throw ex;
- } catch (ServletException ex) {
- if (ex.getRootCause() != null) {
- throw new PortletException(ex.getRootCause());
- } else {
- throw new PortletException(ex);
- }
- } finally {
- internalRequest.setIncluded(isIncluded);
- internalResponse.setIncluded(isIncluded);
- }
- }
+ requestDispatcher.include(
+ (HttpServletRequest) internalRequest,
+ (HttpServletResponse) internalResponse);
+ } catch (IOException ex) {
+ throw ex;
+ } catch (ServletException ex) {
+ if (ex.getRootCause() != null) {
+ throw new PortletException(ex.getRootCause());
+ } else {
+ throw new PortletException(ex);
+ }
+ } finally {
+ internalRequest.setIncluded(isIncluded);
+ internalResponse.setIncluded(isIncluded);
+ }
+ }
+
+ private void include(InternalEventRequest internalRequest, InternalEventResponse internalResponse)
+ throws PortletException, IOException {
+ boolean isIncluded = (internalRequest.isIncluded()
+ || internalResponse.isIncluded());
+ try {
+ internalRequest.setIncluded(true);
+ internalRequest.setIncludedQueryString(queryString);
+ internalResponse.setIncluded(true);
- public void include(EventRequest request, EventResponse response) throws PortletException, IOException {
- InternalEventRequest internalRequest = (InternalEventRequest)
- InternalImplConverter.getInternalRequest(request);
- InternalEventResponse internalResponse = (InternalEventResponse)
- InternalImplConverter.getInternalResponse(response);
-
- boolean isIncluded = (internalRequest.isIncluded()
- || internalResponse.isIncluded());
- try {
- internalRequest.setIncluded(true);
- internalRequest.setIncludedQueryString(queryString);
- internalResponse.setIncluded(true);
-
- requestDispatcher.include(
- (HttpServletRequest) internalRequest,
- (HttpServletResponse) internalResponse);
- } catch (IOException ex) {
- throw ex;
- } catch (ServletException ex) {
- if (ex.getRootCause() != null) {
- throw new PortletException(ex.getRootCause());
- } else {
- throw new PortletException(ex);
- }
- } finally {
- internalRequest.setIncluded(isIncluded);
- internalResponse.setIncluded(isIncluded);
- }
- }
+ requestDispatcher.include(
+ (HttpServletRequest) internalRequest,
+ (HttpServletResponse) internalResponse);
+ } catch (IOException ex) {
+ throw ex;
+ } catch (ServletException ex) {
+ if (ex.getRootCause() != null) {
+ throw new PortletException(ex.getRootCause());
+ } else {
+ throw new PortletException(ex);
+ }
+ } finally {
+ internalRequest.setIncluded(isIncluded);
+ internalResponse.setIncluded(isIncluded);
+ }
+ }
+
+ private void include(InternalResourceRequest internalRequest, InternalResourceResponse internalResponse)
+ throws PortletException, IOException {
+ boolean isIncluded = (internalRequest.isIncluded()
+ || internalResponse.isIncluded());
+ try {
+ internalRequest.setIncluded(true);
+ internalRequest.setIncludedQueryString(queryString);
+ internalResponse.setIncluded(true);
- public void forward(ResourceRequest request, ResourceResponse response) throws PortletException, IOException, IllegalStateException {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("This method needs to be implemented.");
- }
+ requestDispatcher.include(
+ (HttpServletRequest) internalRequest,
+ (HttpServletResponse) internalResponse);
+ } catch (IOException ex) {
+ throw ex;
+ } catch (ServletException ex) {
+ if (ex.getRootCause() != null) {
+ throw new PortletException(ex.getRootCause());
+ } else {
+ throw new PortletException(ex);
+ }
+ } finally {
+ internalRequest.setIncluded(isIncluded);
+ internalResponse.setIncluded(isIncluded);
+ }
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -16,6 +17,7 @@
package org.apache.pluto.internal.impl;
import java.util.Enumeration;
+import java.util.Map;
import java.util.Vector;
import javax.portlet.PortletContext;
@@ -277,5 +279,17 @@
public void removeValue(String name) {
this.removeAttribute(name, DEFAULT_SCOPE);
}
+
+
+ public Map<String, String[]> getMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Map<String, String[]> getMap(int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
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?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- 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 Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -402,5 +403,15 @@
public void setNextPossiblePortletModes(Enumeration portletModes) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
+ }
+
+ public void setDefaultNamspacedEvents(Map<String, Object> events) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setEvent(String name, Object value) {
+ // TODO Auto-generated method stub
+
}
}
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/FilterManager.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/FilterManager.java?view=auto&rev=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/FilterManager.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/spi/FilterManager.java Thu Jun 7 02:59:35 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.spi;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+/**
+ * Manage the initialization and doFilter for the filter which are
+ * declareted in the deployment descriptor.
+ * @since 05/29/2007
+ * @version 2.0
+ */
+public interface FilterManager {
+ public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader, String portletName, PortletContext portletContext, String lifecycle);
+}
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?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- 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 Thu Jun 7 02:59:35 2007
@@ -1,9 +1,10 @@
/*
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * 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
*
@@ -84,5 +85,11 @@
* @return the SharedRenderProvider.
*/
public SharedRenderProvider getSharedRenderProvider(HttpServletRequest request);
+
+ /**
+ * Returns the FilterManager, this is used to process the filter.
+ * @return FilterManager
+ */
+ public FilterManager getFilterManager();
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/wrappers/ActionResponseWrapper.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/wrappers/ActionResponseWrapper.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/wrappers/ActionResponseWrapper.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/wrappers/ActionResponseWrapper.java Thu Jun 7 02:59:35 2007
@@ -1,12 +1,13 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 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.
@@ -107,6 +108,16 @@
public void setNextPossiblePortletModes(Enumeration portletModes) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
+ }
+
+ public void setDefaultNamspacedEvents(Map<String, Object> events) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setEvent(String name, Object value) {
+ // TODO Auto-generated method stub
+
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/FilterMappingDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/FilterMappingDD.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/FilterMappingDD.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/FilterMappingDD.java Thu Jun 7 02:59:35 2007
@@ -1,5 +1,8 @@
package org.apache.pluto.descriptors.portlet;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -15,7 +18,8 @@
private String filterName = null;
@XmlElement (name = "portlet-name")
- private String portletName = null;
+ private List<String> portletName = null;
+
public String getFilterName() {
return filterName;
@@ -25,12 +29,11 @@
this.filterName = filterName;
}
- public String getPortletName() {
+ public List<String> getPortletName() {
return portletName;
}
- public void setPortletName(String portletName) {
+ public void setPortletName(List<String> portletName) {
this.portletName = portletName;
}
-
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/jaxb/JaxBDescriptorServiceImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/jaxb/JaxBDescriptorServiceImplTest.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/jaxb/JaxBDescriptorServiceImplTest.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/jaxb/JaxBDescriptorServiceImplTest.java Thu Jun 7 02:59:35 2007
@@ -300,7 +300,7 @@
assertEquals(portletApp286.getEvents().get(0).getJavaClass(), "java-class");
assertEquals(portletApp286.getRender().get(0).getName(), "QName");
assertEquals(portletApp286.getFilter().get(0).getLifecycle(), "lifecycle");
- assertEquals(portletApp286.getFilterMapping().get(0).getPortletName(), "portlet-name");
+ assertEquals(portletApp286.getFilterMapping().get(0).getPortletName().get(0), "portlet-name");
assertEquals(portletApp286.getResourceBundle(), "resource-bundle");
assertEquals(portletApp286.getVersion(), "2.0");
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterChainImpl.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/FilterChainImpl.java?view=auto&rev=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterChainImpl.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterChainImpl.java Thu Jun 7 02:59:35 2007
@@ -0,0 +1,260 @@
+/*
+ * 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.driver.services.container;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+
+/**
+ * A <code>FilterChain</code> is an object provided by the portlet container
+ * to the developer giving a view into the invocation chain of a
+ * filtered request for a portlet. Filters use the <code>FilterChain</code>
+ * to invoke the next filter in the chain, or if the calling filter is the
+ * last filter in the chain, to invoke the portlet at the end of the chain.
+ *@since 29/05/2007
+ *@version 2.0
+ */
+public class FilterChainImpl implements FilterChain {
+
+ private List<PortletFilter> actionFilters = new ArrayList<PortletFilter>();
+ private List<PortletFilter> eventFilters = new ArrayList<PortletFilter>();
+ private List<PortletFilter> renderFilters = new ArrayList<PortletFilter>();
+ private List<PortletFilter> resourceFilters = new ArrayList<PortletFilter>();
+ private String appName = "";
+ ClassLoader loader;
+ String portletName;
+ PortletContext portletContext;
+
+ /**
+ * The class capsulate the PortletFilter and the parameter for the
+ * init and doFilter from FilterChain.
+ */
+ class PortletFilter{
+
+ FilterConfigImpl filterConfig;
+ ActionFilter actionFilter;
+ EventFilter eventFilter;
+ RenderFilter renderFilter;
+ ResourceFilter resourceFilter;
+ List<String> portletNames;
+ String className = null;
+ Class clazz = null;
+
+ public PortletFilter(String className, FilterConfigImpl filterConfig,List<String> portletNames){
+ this.className = className;
+ this.filterConfig = filterConfig;
+ this.portletNames = portletNames;
+ }
+
+ public void addPortletNames(List<String> portletnames){
+ for (String string : portletnames) {
+ this.portletNames.add(string);
+ }
+ }
+
+ /**
+ * Tests if the filter-mapping contains with the portlet-name.
+ * @param portletName Name of the portlet.
+ * @return true if contains, false else.
+ */
+ public boolean isFilterForPortlet(String portletName){
+ // TODO: update for wildcards
+ return this.portletNames.contains(portletName);
+ }
+
+ /**
+ * Returns the filter class with the given path.
+ * @return Filterclass
+ * @throws ClassNotFoundException if Class not found
+ */
+ private Class getFilterClass() throws ClassNotFoundException{
+ if (clazz == null){
+ clazz = loader.loadClass(className);
+ }
+ return clazz;
+ }
+ private FilterConfigImpl getFilterConfig(){
+ return filterConfig;
+ }
+ }
+
+ public FilterChainImpl(String appName){
+ this.appName = appName;
+ }
+
+ /**
+ * The filterData has do be set before call doFilter.
+ * @param loader Classloader of the appl.
+ * @param portletName
+ * @param portletContext
+ */
+ public void setFilterData(ClassLoader loader, String portletName, PortletContext portletContext){
+ this.loader = loader;
+ this.portletName = portletName;
+ this.portletContext = portletContext;
+ }
+
+ /**
+ * Adds the filter to the filterChain
+ * @param className Path to the filter
+ * @param filterConfig
+ * @param portletNames
+ * @param lifecycle
+ */
+ public void addFilter(String className, FilterConfigImpl filterConfig, List<String> portletNames, String lifecycle){
+ PortletFilter portletFilter = new PortletFilter(className, filterConfig, portletNames);
+ if (lifecycle.equals(FilterManagerImpl.ACTION_PHASE)){
+ actionFilters.add(portletFilter);
+ }
+ else if (lifecycle.equals(FilterManagerImpl.EVENT_PHASE)){
+ eventFilters.add(portletFilter);
+ }
+
+ else if (lifecycle.equals(FilterManagerImpl.RENDER_PHASE)){
+ renderFilters.add(portletFilter);
+ }
+ else if (lifecycle.equals(FilterManagerImpl.RESOURCE_PHASE)){
+ resourceFilters.add(portletFilter);
+ }
+ }
+
+ public void doFilter(ActionRequest request, ActionResponse response) throws IOException, PortletException {
+ if (actionFilters!= null){
+ for (PortletFilter filter2 : actionFilters) {
+ if (filter2.isFilterForPortlet(portletName)){
+ ActionFilter actionfilter;
+ try {
+ filter2.getFilterConfig().setPortletContext(portletContext);
+ actionfilter = (ActionFilter) filter2.getFilterClass().newInstance();
+ actionfilter.init(filter2.getFilterConfig());
+ actionfilter.doFilter(request, response, this);
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ public void doFilter(EventRequest request, EventResponse response) throws IOException, PortletException {
+ if (eventFilters!= null){
+ for (PortletFilter filter2 : eventFilters) {
+ if (filter2.isFilterForPortlet(portletName)){
+ EventFilter eventfilter;
+ try {
+ filter2.getFilterConfig().setPortletContext(portletContext);
+ eventfilter = (EventFilter) filter2.getFilterClass().newInstance();
+ eventfilter.init(filter2.getFilterConfig());
+ eventfilter.doFilter(request, response, this);
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ public void doFilter(RenderRequest request, RenderResponse response) throws IOException, PortletException {
+ if (renderFilters!= null){
+ for (PortletFilter filter2 : renderFilters) {
+ if (filter2.isFilterForPortlet(portletName)){
+ RenderFilter renderfilter;
+ try {
+ filter2.getFilterConfig().setPortletContext(portletContext);
+ renderfilter = (RenderFilter) filter2.getFilterClass().newInstance();
+ renderfilter.init(filter2.getFilterConfig());
+ renderfilter.doFilter(request, response, this);
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ public void doFilter(ResourceRequest request, ResourceResponse response) throws IOException, PortletException {
+ if (resourceFilters!= null){
+ for (PortletFilter filter2 : resourceFilters) {
+ if (filter2.isFilterForPortlet(portletName)){
+ ResourceFilter resourcefilter;
+ try {
+ filter2.getFilterConfig().setPortletContext(portletContext);
+ resourcefilter = (ResourceFilter) filter2.getFilterClass().newInstance();
+ resourcefilter.init(filter2.getFilterConfig());
+ resourcefilter.doFilter(request, response, this);
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the application name.
+ * @return application name
+ */
+ public String getAppName() {
+ return appName;
+ }
+
+}
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterConfigImpl.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/FilterConfigImpl.java?view=auto&rev=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterConfigImpl.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterConfigImpl.java Thu Jun 7 02:59:35 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.driver.services.container;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.portlet.PortletContext;
+import javax.portlet.filter.FilterConfig;
+
+import org.apache.pluto.descriptors.common.InitParamDD;
+
+/**
+ *
+ *@since 29/05/2007
+ *@version 2.0
+ */
+public class FilterConfigImpl implements FilterConfig {
+
+ private String filterName = null;
+ private List<InitParamDD> initParameters = null;
+ private PortletContext portletContext = null;
+ public FilterConfigImpl(String filterName, List<InitParamDD> initParameters){
+ this.filterName = filterName;
+ this.initParameters = initParameters;
+ }
+ public String getFilterName() {
+ return filterName;
+ }
+
+ public String getInitParameter(String name) {
+ for (InitParamDD initParameter2 : initParameters) {
+ if (initParameter2.getParamName().equals(name)){
+ return initParameter2.getParamValue();
+ }
+ }
+ return null;
+ }
+
+ public Enumeration getInitParameterNames() {
+ Hashtable<String,String> enum1 = new Hashtable<String, String>();
+ return enum1.elements();
+ }
+
+ public PortletContext getPortletContext() {
+ return portletContext;
+ }
+
+ public void setPortletContext(PortletContext portletContext){
+ this.portletContext = portletContext;
+ }
+}
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterManagerImpl.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/FilterManagerImpl.java?view=auto&rev=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterManagerImpl.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/FilterManagerImpl.java Thu Jun 7 02:59:35 2007
@@ -0,0 +1,155 @@
+/*
+ * 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.driver.services.container;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.filter.FilterChain;
+
+import org.apache.pluto.descriptors.portlet.FilterDD;
+import org.apache.pluto.descriptors.portlet.FilterMappingDD;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.spi.FilterManager;
+
+/**
+ * Manage the initialization and doFilter {@link FilterChainImpl} for the filter which are
+ * declareted in the deployment descriptor.
+ * @since 05/29/2007
+ * @version 2.0
+ */
+public class FilterManagerImpl implements FilterManager{
+ protected static final String ACTION_PHASE = "ACTION_PHASE";
+ protected static final String EVENT_PHASE = "EVENT_PHASE";
+ protected static final String RENDER_PHASE = "RENDER_PHASE";
+ protected static final String RESOURCE_PHASE = "RESOURCE_PHASE";
+ static List<FilterChainImpl> filterApps = new ArrayList<FilterChainImpl>();
+ private static FilterManagerImpl filterManager = new FilterManagerImpl();
+ ClassLoader loader = null;
+
+
+ public static FilterManager getFilterManager(){
+ return filterManager;
+ }
+
+ /**
+ * The processFilter initialize the rest you need and invoke doFilter from FilterChain.
+ * @param req request for doFilter in the filterChain
+ * @param res response for doFilter in the filterChain
+ * @param loader Classloader for the filter
+ * @param portletName current portletName
+ * @param portletContext current portletcontext
+ * @param lifecycle must be ACTION_PHASE, EVENT_PHASE, RENDER_PHASE or RESOURCE_PHASE
+ */
+ public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader, String portletName, PortletContext portletContext, String lifecycle){
+ //search for the filter in the portlet app
+ String appName = req.getContextPath();
+ //iterate over the applications.
+ for (FilterChainImpl filterChain2 : filterApps) {
+ if (filterChain2.getAppName().equals(appName)){
+ //initialize the rest of the needed data
+ filterChain2.setFilterData(loader, portletName, portletContext);
+ try {
+ if (lifecycle.equals(ACTION_PHASE)){
+ filterChain2.doFilter((ActionRequest)req, (ActionResponse)res);
+ }
+ else if (lifecycle.equals(EVENT_PHASE)){
+ filterChain2.doFilter((EventRequest)req, (EventResponse)res);
+ }
+ else if (lifecycle.equals(RENDER_PHASE)){
+ filterChain2.doFilter((RenderRequest)req, (RenderResponse)res);
+ }
+ else if (lifecycle.equals(RESOURCE_PHASE)){
+ filterChain2.doFilter((ResourceRequest)req, (ResourceResponse)res);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (PortletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ break;
+ }
+ }
+ }
+
+ /**
+ * Adds the Applications for the filter.
+ * @param portletAppDD PortletAppDD for iterate over all filter in the map.
+ * @param ContextPath needed for the FilterConfig
+ * @return
+ */
+ public static boolean addFilterApp(PortletAppDD portletAppDD, String ContextPath){
+
+ for(FilterChainImpl filterChain: filterApps){
+ if (filterChain.getAppName().equals(ContextPath))
+ return false;
+ }
+ FilterChainImpl filterChain = new FilterChainImpl(ContextPath);
+ filterApps.add(filterChain);
+ List<FilterMappingDD> filterMappingDD = portletAppDD.getFilterMapping();
+ List<FilterDD> filterDD = portletAppDD.getFilter();
+ if (filterDD!=null){
+ for (FilterDD filterDD2 : filterDD) {
+// if (filterDD2.getLifecycle().equals(ACTION_PHASE)){
+ if (filterMappingDD!=null)
+ for (FilterMappingDD filterMappingDD2 : filterMappingDD) {
+ if (filterMappingDD2.getFilterName().equals(filterDD2.getFilterName())){
+ //insert FilterChain activation
+ FilterConfigImpl filterConfig = new FilterConfigImpl(filterDD2.getFilterName(),
+ filterDD2.getInitParam());
+ filterChain.addFilter(filterDD2.getFilterClass(), filterConfig, filterMappingDD2.getPortletName(), filterDD2.getLifecycle());
+ }
+ }
+// }
+ }
+ }
+ return true;
+ }
+
+ /**
+ *
+ * @param ContextPath
+ */
+ public static void removeFilterApp(String ContextPath){
+ // TODO must be updated, when SupportedModesServiceImpl is done
+ }
+
+ /**
+ *
+ *
+ */
+ public static void removeAllFilterApps(){
+ // TODO must be updated, when SupportedModesServiceImpl is done
+ filterApps = null;
+ }
+}
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?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- 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 Thu Jun 7 02:59:35 2007
@@ -25,6 +25,7 @@
import org.apache.pluto.driver.AttributeKeys;
import org.apache.pluto.driver.core.ResourceURLProviderImpl;
import org.apache.pluto.spi.EventProvider;
+import org.apache.pluto.spi.FilterManager;
import org.apache.pluto.spi.PortalCallbackService;
import org.apache.pluto.spi.PortletURLProvider;
import org.apache.pluto.spi.ResourceURLProvider;
@@ -106,6 +107,15 @@
public SharedRenderProvider getSharedRenderProvider(HttpServletRequest request) {
return SharedRenderProviderImpl.getSharedRenderProviderImpl();
+ }
+
+
+ /**
+ * Returns the FilterManager, this is used to process the filter.
+ * @return FilterManager
+ */
+ public FilterManager getFilterManager() {
+ return FilterManagerImpl.getFilterManager();
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.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/PortletWindowThread.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletWindowThread.java Thu Jun 7 02:59:35 2007
@@ -64,7 +64,7 @@
HttpServletResponse res = eventProvider.getResponse();
try {
synchronized (this) {
- eventContainer.fireEvent(req, res, portletWindow, events.get(0).getName(),
+ eventContainer.fireEvent(req, res, portletWindow, events.get(0).getQName(),
eventProvider.getSavedEvents().getNumber(events.get(0)));
//wait();
Thread.sleep(1);
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.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/impl/resource/SupportedModesServiceImpl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java Thu Jun 7 02:59:35 2007
@@ -34,6 +34,7 @@
import org.apache.pluto.descriptors.portlet.SupportsDD;
import org.apache.pluto.driver.AttributeKeys;
import org.apache.pluto.driver.config.DriverConfigurationException;
+import org.apache.pluto.driver.services.container.FilterManagerImpl;
import org.apache.pluto.driver.services.portal.PortletApplicationConfig;
import org.apache.pluto.driver.services.portal.PortletRegistryService;
import org.apache.pluto.driver.services.portal.PortletWindowConfig;
@@ -125,6 +126,7 @@
portletRegistry = null;
portletApps = null;
propertySvc = null;
+ FilterManagerImpl.removeAllFilterApps();
LOG.debug("Supported Modes Service destroyed.");
}
@@ -206,7 +208,8 @@
LOG.warn(e);
continue;
}
-
+ //init the portletapplication filter
+ FilterManagerImpl.addFilterApp(portletAppDD, app.getContextPath());
// for each portletAppDD, retrieve the portletDD and the supported modes
Iterator portlets = portletAppDD.getPortlets().iterator();
while (portlets.hasNext()) {
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java Thu Jun 7 02:59:35 2007
@@ -1,9 +1,10 @@
/*
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * 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
*
@@ -120,6 +121,10 @@
PortletWindowConfig resourceWindowConfig = null;
PortletWindowConfig actionWindowConfig = null;
+ request.setAttribute("filter-manager",
+ container.getRequiredContainerServices().
+ getPortalCallbackService().
+ getFilterManager());
if (resourceWindowId != null){
resourceWindowConfig = getDriverConfiguration()
.getPortletWindowConfig(resourceWindowId);
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/AboutPortlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/AboutPortlet.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/AboutPortlet.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/AboutPortlet.java Thu Jun 7 02:59:35 2007
@@ -67,7 +67,5 @@
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
- }
-
-
+ }
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pom.xml?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pom.xml (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pom.xml Thu Jun 7 02:59:35 2007
@@ -237,7 +237,7 @@
-->
<properties>
- <portlet-api.version>2.0-r14</portlet-api.version>
+ <portlet-api.version>2.0-r15</portlet-api.version>
<servlet-api.version>2.4</servlet-api.version>
<jsp-api.version>2.0</jsp-api.version>
<jstl.version>1.1.2</jstl.version>
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/pom.xml?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/pom.xml (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/pom.xml Thu Jun 7 02:59:35 2007
@@ -33,7 +33,7 @@
<groupId>javax.portlet</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>portlet-api</artifactId>
- <version>2.0-r14</version>
+ <version>2.0-r15</version>
<packaging>jar</packaging>
<name>Portlet 2.0 API</name>
<description>The Java Portlet API version 2.0 developed by the Java Community Process JSR-286 Expert Group.</description>
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ActionRequest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ActionRequest.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ActionRequest.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/ActionRequest.java Thu Jun 7 02:59:35 2007
@@ -44,4 +44,9 @@
*/
public interface ActionRequest extends ClientDataRequest
{
+ /**
+ * Predefined action name for usage with the
+ * <code>@ProcessAction</code> annotation.
+ */
+ public static final String ACTION_NAME = "javax.portlet.action";
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/BaseURL.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/BaseURL.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/BaseURL.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/BaseURL.java Thu Jun 7 02:59:35 2007
@@ -27,7 +27,6 @@
/**
* Copyright 2006 IBM Corporation.
*/
-
package javax.portlet;
/**
@@ -113,7 +112,7 @@
* the values is not a String array.
*/
- public void setParameters(java.util.Map parameters);
+ public void setParameters(java.util.Map<String, String[]> parameters);
/**
@@ -173,7 +172,7 @@
* String array (<code>String[]</code>).
*/
- public java.util.Map getParameterMap();
+ public java.util.Map<String, String[]> getParameterMap();
/**
* Writes the portlet URL to the output stream using the provided writer.
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/CacheControl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/CacheControl.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/CacheControl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/CacheControl.java Thu Jun 7 02:59:35 2007
@@ -24,9 +24,10 @@
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
-/**
- * Copyright 2006 IBM Corporation.
- */
+/*
+ * Copyright 2006 IBM Corporation.
+ *
+ */
package javax.portlet;
/**
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/Event.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/Event.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/Event.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/Event.java Thu Jun 7 02:59:35 2007
@@ -33,7 +33,9 @@
* The <code>Event</code> interface represents an event that the portlet has received
* in the event processing phase.
* <p>
- * The <code>Event</code> interface encapsulates the event name and event payload.
+ * The <code>Event</code> interface encapsulates the event name and event payload,
+ * it does not represent the event object itself.
+ * <p>
* The portlet must define the events it is able to receive in the portlet deployment
* descriptor with the <code>supported-processing-event</code>.
*
@@ -43,12 +45,19 @@
public interface Event {
/**
- * Get the event name.
+ * Get the event QName.
*
- * @return the name of the event, never <code>null</code>.
+ * @return the QName of the event, never <code>null</code>.
*/
- javax.xml.namespace.QName getName();
-
+ javax.xml.namespace.QName getQName();
+
+ /**
+ * Get the local part of the event name.
+ *
+ * @return the local part of the event, never <code>null</code>.
+ */
+ java.lang.String getName();
+
/**
* Get the event payload.
*
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/GenericPortlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/GenericPortlet.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/GenericPortlet.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/GenericPortlet.java Thu Jun 7 02:59:35 2007
@@ -25,8 +25,8 @@
* DO NOT add / change / or delete method signatures!
*/
/**
- * Copyright 2006 IBM Corporation.
- */
+ * Copyright 2006 IBM Corporation.
+ */
package javax.portlet;
@@ -34,6 +34,8 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.namespace.QName;
@@ -70,6 +72,10 @@
private transient PortletConfig config;
+ private transient Map<String, Method> processActionHandlingMethodsMap = new HashMap<String, Method>();
+ private transient Map<String, Method> processEventHandlingMethodsMap = new HashMap<String, Method>();
+ private transient Map<String, Method> renderModeHandlingMethodsMap = new HashMap<String, Method>();
+
/**
* Does nothing.
*/
@@ -110,6 +116,26 @@
*/
public void init(PortletConfig config) throws PortletException {
this.config = config;
+ // cache annotated methods
+ Method[] methods = this.getClass().getMethods();
+ for (Method method : methods) {
+ Annotation[] annotations = method.getAnnotations();
+ for (Annotation annotation : annotations) {
+ if (annotation.equals(ProcessAction.class)) {
+ processActionHandlingMethodsMap.put(((ProcessAction)annotation).name(), method);
+ } else if (annotation.equals(ProcessEvent.class)) {
+ if (((ProcessEvent)annotation).qname() != null)
+ processEventHandlingMethodsMap.put(((ProcessEvent)annotation).qname(), method);
+ else {
+ QName qn = new QName(config.getDefaultEventNamespace(), ((ProcessEvent)annotation).name());
+ processEventHandlingMethodsMap.put(qn.toString(), method);
+ }
+ } else if (annotation.equals(RenderMode.class)) {
+ renderModeHandlingMethodsMap.put(((RenderMode)annotation).name().toLowerCase(), method);
+ }
+ }
+ }
+
this.init();
}
@@ -158,7 +184,19 @@
* if the streaming causes an I/O problem
*/
public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, java.io.IOException {
+ throws PortletException, java.io.IOException {
+ String action = request.getParameter(ActionRequest.ACTION_NAME);
+ try {
+ // check if action is cached in init
+ if ( processActionHandlingMethodsMap.containsKey(action) )
+ processActionHandlingMethodsMap.get(action).invoke(this, request, response);
+ // check if action is present as annotation
+ invokeProcessActionAnnotatedMethod(request, response, action);
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+
+ // if no action processing method was found throw exc
throw new PortletException("processAction method not implemented");
}
@@ -197,7 +235,7 @@
if (request.getAttribute(RenderRequest.RENDER_PART) != null) { // streaming portal calling
if (request.getAttribute(RenderRequest.RENDER_PART).equals(RenderRequest.RENDER_HEADERS) ) {
doHeaders(request, response);
- Enumeration nextModes = getNextPossiblePortletModes(request);
+ Enumeration<PortletMode> nextModes = getNextPossiblePortletModes(request);
if (nextModes != null)
response.setNextPossiblePortletModes(nextModes);
response.setTitle(getTitle(request));
@@ -240,19 +278,25 @@
}
/**
- * The default implementation of this method routes the render request to a
- * set of helper methods depending on the current portlet mode the portlet
- * is currently in. These methods are:
- * <ul>
- * <li><code>doView</code> for handling <code>view</code> requests
- * <li><code>doEdit</code> for handling <code>edit</code> requests
- * <li><code>doHelp</code> for handling <code>help</code> requests
- * </ul>
+ * The default implementation of this method routes the render request to:
+ * <ol>
+ * <li>method annotated with <code>@RenderMode</name> and the name of the
+ * portlet mode</li>
+ * <li>a set of helper methods depending on the current portlet mode the portlet
+ * is currently in. These methods are:
+ * <ul>
+ * <li><code>doView</code> for handling <code>view</code> requests
+ * <li><code>doEdit</code> for handling <code>edit</code> requests
+ * <li><code>doHelp</code> for handling <code>help</code> requests
+ * </ul>
+ * </li>
+ * </ul>
* <P>
* If the window state of this portlet is <code>minimized</code>, this
* method does not invoke any of the portlet mode rendering methods.
* <p>
- * For handling custom portlet modes the portlet should override this
+ * For handling custom portlet modes the portlet should either use the
+ * <code>@RenderMode</name> annotation or override this
* method.
*
* @param request
@@ -281,6 +325,18 @@
if (!state.equals(WindowState.MINIMIZED)) {
PortletMode mode = request.getPortletMode();
+ // first look if there are methods annotated for
+ // handling the rendering of this mode
+ try {
+ // check if mode is cached in init
+ if ( renderModeHandlingMethodsMap.containsKey(mode) )
+ renderModeHandlingMethodsMap.get(mode).invoke(this, request, response);
+ // check if mode is present as annotation
+ invokeRenderModeAnnotatedMethod(request, response, mode);
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ // if not, try the default doXYZ methods
if (mode.equals(PortletMode.VIEW)) {
doView(request, response);
} else if (mode.equals(PortletMode.EDIT)) {
@@ -459,7 +515,7 @@
* an empty Enumeration if the portlet has no initialization
* parameters.
*/
- public java.util.Enumeration getInitParameterNames() {
+ public java.util.Enumeration<String> getInitParameterNames() {
return config.getInitParameterNames();
}
@@ -500,23 +556,17 @@
*/
public void processEvent(EventRequest request, EventResponse response)
throws PortletException, IOException {
- Method[] methods = this.getClass().getMethods();
- QName eventName = request.getEvent().getName();
- final String targetMethodAnnotation = "@javax.portlet.ProcessEvent(name="
- + eventName + ")";
- for (Method method : methods) {
- Annotation[] annotations = method.getAnnotations();
- for (Annotation annotation : annotations) {
- if (annotation.toString().equals(targetMethodAnnotation)) {
- try {
- method.invoke(this, request, response);
- return;
- } catch (Exception e) {
- throw new PortletException(e);
- }
- }
- }
+ QName eventName = request.getEvent().getQName();
+ try {
+ // check if event is cached in init
+ if ( processEventHandlingMethodsMap.containsKey(eventName) )
+ processEventHandlingMethodsMap.get(eventName).invoke(this, request, response);
+ // check if event is present as annotation
+ invokeProcessEventAnnotatedMethod(request, response, eventName.toString());
+ } catch (Exception e) {
+ throw new PortletException(e);
}
+
// if no event processing method was found just keep render params
response.setRenderParameters(request);
}
@@ -547,15 +597,114 @@
*
* @since 2.0
*/
- protected java.util.Enumeration getNextPossiblePortletModes(RenderRequest request) {
+ protected java.util.Enumeration<PortletMode> getNextPossiblePortletModes(RenderRequest request) {
return null;
}
+
/**
- * will be added in a new revision of the spec
- * (chrisra)
+ * Returns the names of the public render parameters supported by the portlet
+ * as an <code>Enumeration</code> of String objects, or an empty <code>Enumeration</code> if the
+ * portlet has no public render parameters.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the public
+ * render parameters, or an empty <code>Enumeration</code> if the
+ * portlet does not define any public render parameters.
+ *
+ * @see javax.portlet.PortletConfig#getPublicRenderParameterNames()
*/
- public Enumeration getPublicRenderParameterNames() {
+ public Enumeration<String> getPublicRenderParameterNames() {
+ return config.getPublicRenderParameterNames();
+ }
+
+ /**
+ * Will be added in the next draft of the spec.
+ * Torsten Dettborn
+ */
+ public String getDefaultEventNamespace() {
return null;
+ }
+
+ private void invokeProcessActionAnnotatedMethod(ActionRequest request, ActionResponse response, String action)
+ throws PortletException
+ {
+ Method[] methods = this.getClass().getMethods();
+ for (Method method : methods) {
+ Annotation[] annotations = method.getAnnotations();
+ for (Annotation annotation : annotations) {
+ if (annotation.equals(ProcessAction.class)) {
+ if (((ProcessAction)annotation).name().equals(action)) {
+ processActionHandlingMethodsMap.put(((ProcessAction)annotation).name(), method);
+ try {
+ method.invoke(this, request, response);
+ return;
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ private void invokeProcessEventAnnotatedMethod(EventRequest request, EventResponse response, String event)
+ throws PortletException
+ {
+ Method[] methods = this.getClass().getMethods();
+ for (Method method : methods) {
+ Annotation[] annotations = method.getAnnotations();
+ for (Annotation annotation : annotations) {
+ if (annotation.equals(ProcessEvent.class)) {
+ if (((ProcessEvent)annotation).qname() != null) {
+ if (((ProcessEvent)annotation).qname().equals(event)) {
+ processEventHandlingMethodsMap.put(((ProcessEvent)annotation).qname(), method);
+ try {
+ method.invoke(this, request, response);
+ return;
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ }
+ } else {
+ QName qn = new QName(config.getDefaultEventNamespace(), ((ProcessEvent)annotation).name());
+ if (qn.toString().equals(event)) {
+ processEventHandlingMethodsMap.put(qn.toString(), method);
+ try {
+ method.invoke(this, request, response);
+ return;
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+ private void invokeRenderModeAnnotatedMethod(RenderRequest request, RenderResponse response, PortletMode mode)
+ throws PortletException
+ {
+ Method[] methods = this.getClass().getMethods();
+ for (Method method : methods) {
+ Annotation[] annotations = method.getAnnotations();
+ for (Annotation annotation : annotations) {
+ if (annotation.equals(RenderMode.class)) {
+ if (((RenderMode)annotation).name().toLowerCase().equals(mode.toString())) {
+ renderModeHandlingMethodsMap.put(((RenderMode)annotation).name().toLowerCase(), method);
+ try {
+ method.invoke(this, request, response);
+ return;
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ }
+ }
+ }
+ }
+
}
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/MimeResponse.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/MimeResponse.java?view=diff&rev=545132&r1=545131&r2=545132
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/MimeResponse.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/portlet2-api/src/main/java/javax/portlet/MimeResponse.java Thu Jun 7 02:59:35 2007
@@ -24,11 +24,18 @@
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
-/**
- * Copyright 2006 IBM Corporation.
- */
+/*
+ * Copyright 2006 IBM Corporation.
+ *
+ */
package javax.portlet;
+/**
+ * The <CODE>MimeResponse</CODE> defines the base interface to assist a
+ * portlet in returing MIME content.
+ *
+ * @since 2.0
+ */
public interface MimeResponse extends PortletResponse {
/**