svn commit: r1201770 - /struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java
Author: lukaszlenart Date: Mon Nov 14 16:12:55 2011 New Revision: 1201770 URL: http://svn.apache.org/viewvc?rev=1201770&view=rev Log: WW-3702 - adds optional flag to enable/disable internal cache to prevent memory leaks Modified: struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java Modified: struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java?rev=1201770&r1=1201769&r2=1201770&view=diff == --- struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java (original) +++ struts/struts2/branches/new_conversion/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java Mon Nov 14 16:12:55 2011 @@ -20,6 +20,7 @@ package org.apache.struts2.cdi; import com.opensymphony.xwork2.ObjectFactory; +import com.opensymphony.xwork2.inject.Inject; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; @@ -54,6 +55,8 @@ public class CdiObjectFactory extends Ob Map, InjectionTarget> injectionTargetCache = new ConcurrentHashMap, InjectionTarget>(); +private boolean useInternalCache = false; + public CdiObjectFactory() { super(); LOG.info("Initializing Struts2 CDI integration..."); @@ -119,11 +122,15 @@ public class CdiObjectFactory extends Ob * @return if found in cache, an existing instance. A new instance otherwise. */ protected InjectionTarget getInjectionTarget(Class clazz) { -InjectionTarget result; -result = injectionTargetCache.get(clazz); +InjectionTarget result = null; +if (useInternalCache) { +result = injectionTargetCache.get(clazz); +} if (result == null) { result = beanManager.createInjectionTarget(beanManager.createAnnotatedType(clazz)); -injectionTargetCache.put(clazz, result); +if (useInternalCache) { +injectionTargetCache.put(clazz, result); +} } return result; @@ -139,4 +146,15 @@ public class CdiObjectFactory extends Ob protected CreationalContext buildNonContextualCreationalContext(BeanManager beanManager) { return beanManager != null ? beanManager.createCreationalContext(null) : null; } + +/** + * Disables use of internal cache for InjectionTargets + * + * @param useInternalCache + */ +@Inject(value = "struts.cdi.useInternalCache", required = false) +public void setUseInternalCache(String useInternalCache) { +this.useInternalCache = "true".equalsIgnoreCase(useInternalCache); +} + }
svn commit: r1201876 - in /struts/struts2/trunk/apps/portlet/src/main: java/org/apache/struts2/portlet/example/eventing/ resources/ webapp/WEB-INF/ webapp/WEB-INF/eventing/
Author: jogep Date: Mon Nov 14 20:24:57 2011 New Revision: 1201876 URL: http://svn.apache.org/viewvc?rev=1201876&view=rev Log: WW-3707: Extend the Portlet Showcase with an Portlet Event Example Added: struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java struts/struts2/trunk/apps/portlet/src/main/resources/struts-eventing.xml struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/eventing/ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/eventing/index.jsp struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/eventing/process.jsp Modified: struts/struts2/trunk/apps/portlet/src/main/resources/struts.xml struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml Added: struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java?rev=1201876&view=auto == --- struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java (added) +++ struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/ProcessAction.java Mon Nov 14 20:24:57 2011 @@ -0,0 +1,61 @@ +/* + * 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.struts2.portlet.example.eventing; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.portlet.interceptor.PortletRequestAware; +import org.apache.struts2.portlet.interceptor.PortletResponseAware; + +import javax.portlet.EventRequest; +import javax.portlet.EventResponse; +import javax.portlet.PortletRequest; +import javax.portlet.PortletResponse; + +public class ProcessAction extends ActionSupport implements PortletRequestAware, PortletResponseAware { + +private PortletRequest request; +private PortletResponse response; +private String name; + +public String execute() throws Exception { + +if (request instanceof EventRequest) { +EventRequest req = (EventRequest) request; +EventResponse res = (EventResponse) response; +res.setRenderParameter("eventName", (String) req.getEvent().getValue()); +return "forward"; +} else { +name = request.getParameter("eventName"); +} + +return SUCCESS; +} + +public void setPortletRequest(PortletRequest request) { +this.request = request; +} + +public void setPortletResponse(PortletResponse response) { +this.response = response; +} + +public String getName() { +return this.name; +} +} Added: struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java?rev=1201876&view=auto == --- struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java (added) +++ struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/eventing/PublishAction.java Mon Nov 14 20:24:57 2011 @@ -0,0 +1,52 @@ +/* + * 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
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache ActiveMQ (https://cwiki.apache.org/confluence/display/ACTIVEMQ) Pages - Building edited by gliesian (10:54 AM) https://cwiki.apache.org/confluence/display/ACTIVEMQ/Building Apache Bigtop (incubating) (https://cwiki.apache.org/confluence/display/BIGTOP) Pages - How to install Hadoop distribution from Bigtop created by rvs (12:27 PM) https://cwiki.apache.org/confluence/display/BIGTOP/How+to+install+Hadoop+distribution+from+Bigtop Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL) Pages - MDC logging edited by davsclaus (01:47 PM) https://cwiki.apache.org/confluence/display/CAMEL/MDC+logging Release Guide edited by davsclaus (10:49 AM) https://cwiki.apache.org/confluence/display/CAMEL/Release+Guide Building edited by gliesian (10:36 AM) https://cwiki.apache.org/confluence/display/CAMEL/Building Camel 2.9.0 Release edited by davsclaus (04:05 AM) https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.9.0+Release Apache CXF (https://cwiki.apache.org/confluence/display/CXF) Pages - Building edited by gliesian (10:54 AM) https://cwiki.apache.org/confluence/display/CXF/Building Custom CXF Transport edited by ashakirin (08:17 AM) https://cwiki.apache.org/confluence/display/CXF/Custom+CXF+Transport Apache CXF Documentation (https://cwiki.apache.org/confluence/display/CXF20DOC) Pages - JAX-RS edited by sergey_beryozkin (11:52 AM) https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS JAX-RS OAuth edited by sergey_beryozkin (05:36 AM) https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+OAuth Apache Giraph (Incubating) (https://cwiki.apache.org/confluence/display/GIRAPH) Pages - Committer notes edited by hyunsik (01:47 AM) https://cwiki.apache.org/confluence/display/GIRAPH/Committer+notes Apache Geronimo Project Management (https://cwiki.apache.org/confluence/display/GMOxPMGT) Pages - Geronimo 3.0-beta Release Status edited by rwonly (10:15 PM) https://cwiki.apache.org/confluence/display/GMOxPMGT/Geronimo+3.0-beta+Release+Status Apache Geronimo (https://cwiki.apache.org/confluence/display/GMOxSITE) Pages - Apache Geronimo v3.0-beta-1 Release edited by rwonly (01:04 AM) https://cwiki.apache.org/confluence/display/GMOxSITE/Apache+Geronimo+v3.0-beta-1+Release Apache Hive (https://cwiki.apache.org/confluence/display/Hive) Pages - PoweredBy edited by cwsteinbach (09:28 PM) https://cwiki.apache.org/confluence/display/Hive/PoweredBy Presentations edited by cwsteinbach (04:59 PM) https://cwiki.apache.org/confluence/display/Hive/Presentations Apache Mahout (https://cwiki.apache.org/confluence/display/MAHOUT) Pages - How To Contribute edited by lancenorskog (01:08 AM) https://cwiki.apache.org/confluence/display/MAHOUT/How+To+Contribute Apache ActiveMQ NMS (https://cwiki.apache.org/confluence/display/NMS) Pages - Download edited by tabish121 (11:13 AM) https://cwiki.apache.org/confluence/display/NMS/Download Apache.NMS.Stomp v1.5.2 created by tabish121 (11:05 AM) https://cwiki.apache.org/confluence/display/NMS/Apache.NMS.Stomp+v1.5.2 Stomp Downloads edited by tabish121 (10:58 AM) https://cwiki.apache.org/confluence/display/NMS/Stomp+Downloads Apache.NMS.ActiveMQ v1.5.2 created by tabish121 (09:01 AM) https://cwiki.apache.org/confluence/display/NMS/Apache.NMS.ActiveMQ+v1.5.2 ActiveMQ Downloads edited by tabish121 (08:56 AM) https://cwiki.apache.org/confluence/display/NMS/ActiveMQ+Downloads Apache OpenOffice.org Community (https://cwiki.apache.org/confluence/display/OOOUSERS) Pages - IP_Clearance Impact edited by jsc (08:54 AM) https://cwiki.apache.org/confluence/display/OOOUSERS/IP_Clearance+Impact IP_Clearance edited by jsc (08:50 AM) https://cwiki.apache.org/confluence/display/OOOUSERS/IP_Clearance OpenJPA (https://cwiki.apache.org/confluence/display/openjpa) Pages - Index edited by mtylenda (02:51 PM) https: