Author: adrianc
Date: Thu May 28 16:18:30 2009 New Revision: 779643 URL: http://svn.apache.org/viewvc?rev=779643&view=rev Log: Applied fix from trunk for revision: 779639. Modified: ofbiz/branches/release09.04/ (props changed) ofbiz/branches/release09.04/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Propchange: ofbiz/branches/release09.04/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu May 28 16:18:30 2009 @@ -1 +1 @@ -/ofbiz/trunk:765933,766011,766015,766293,766307,766316,766325,766462,766522,766800,767060,767072,767093,767098-767099,767102,767123,767125,767127,767279,767287,767671,767688,767694,767822,767845,768358,768490,768550,768675,768686,768705,768811,768815,768960,769030,769500,770272,770997,771073,772401,772464-772465,773076,773557,773628,773659,773697,774014,774632,774661,774995,775292,775667,776227,776594,776620,776922,777004,777020,777768,777792,777893,777947,778078,778094,778107,778278,778280,778364,778374,778402,778576,778594,778628,779020 +/ofbiz/trunk:765933,766011,766015,766293,766307,766316,766325,766462,766522,766800,767060,767072,767093,767098-767099,767102,767123,767125,767127,767279,767287,767671,767688,767694,767822,767845,768358,768490,768550,768675,768686,768705,768811,768815,768960,769030,769500,770272,770997,771073,772401,772464-772465,773076,773557,773628,773659,773697,774014,774632,774661,774995,775292,775667,776227,776594,776620,776922,777004,777020,777768,777792,777893,777947,778078,778094,778107,778278,778280,778364,778374,778402,778576,778594,778628,779020,779639 Modified: ofbiz/branches/release09.04/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java?rev=779643&r1=779642&r2=779643&view=diff ============================================================================== --- ofbiz/branches/release09.04/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java (original) +++ ofbiz/branches/release09.04/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java Thu May 28 16:18:30 2009 @@ -22,6 +22,8 @@ import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; + import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,6 +31,7 @@ import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.IOUtils; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.webapp.control.ConfigXMLReader; @@ -81,15 +84,19 @@ cacheName = event.invoke; scriptString = eventCache.get(cacheName); if (scriptString == null) { - synchronized(this) { + synchronized(eventCache) { if (scriptString == null) { - Debug.logInfo("Loading BSF Script from classpath at location: " + event.invoke, module); - scriptStream = cl.getResourceAsStream(event.invoke); - if (scriptStream == null) { - throw new EventHandlerException("Could not find BSF script file at classpath location: " + event.invoke); + if (Debug.verboseOn()) { + Debug.logVerbose("Loading BSF Script at location: " + cacheName, module); } - scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream)); - eventCache.put(cacheName, scriptString); + URL scriptUrl = FlexibleLocation.resolveLocation(cacheName); + if (scriptUrl == null) { + throw new EventHandlerException("BSF script not found at location [" + cacheName + "]"); + } + scriptStream = scriptUrl.openStream(); + scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream)); + scriptStream.close(); + eventCache.put(cacheName, scriptString); } } } @@ -98,13 +105,14 @@ cacheName = context.getServletContextName() + ":" + event.path + event.invoke; scriptString = eventCache.get(cacheName); if (scriptString == null) { - synchronized(this) { + synchronized(eventCache) { if (scriptString == null) { scriptStream = context.getResourceAsStream(event.path + event.invoke); if (scriptStream == null) { throw new EventHandlerException("Could not find BSF script file in webapp context: " + event.path + event.invoke); } scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream)); + scriptStream.close(); eventCache.put(cacheName, scriptString); } } Modified: ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=779643&r1=779642&r2=779643&view=diff ============================================================================== --- ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Thu May 28 16:18:30 2009 @@ -419,7 +419,7 @@ <request-map uri="processPaymentSettings"> <security https="true" auth="false"/> - <event type="bsf" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> + <event type="bsf" invoke="component://ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> <response name="success" type="request" value="reviewOrder"/> <response name="error" type="view" value="paymentinformation"/> </request-map> @@ -505,7 +505,7 @@ <request-map uri="quickAnonAddCreditCardToCart"> <security https="true" auth="false"/> - <event type="bsf" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> + <event type="bsf" invoke="component://ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> <response name="success" type="view" value="quickAnonCcInfo"/> <response name="error" type="view" value="quickAnonCcInfo"/> </request-map> @@ -519,21 +519,21 @@ <request-map uri="quickAnonAddEftAccountToCart"> <security https="true" auth="false"/> - <event type="bsf" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> + <event type="bsf" invoke="component://ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> <response name="success" type="view" value="quickAnonEftInfo"/> <response name="error" type="view" value="quickAnonEftInfo"/> </request-map> <request-map uri="quickAnonEnterExtOffline"> <security https="true" auth="false"/> - <event type="bsf" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> + <event type="bsf" invoke="component://ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> <response name="success" type="view" value="quickAnonOrderReview"/> <response name="error" type="view" value="quickAnonOrderReview"/> </request-map> <request-map uri="quickAnonAddGiftCardToCart"> <security https="true" auth="false"/> - <event type="bsf" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> + <event type="bsf" invoke="component://ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/> <response name="success" type="request" value="quickAnonGcInfo"/> <response name="error" type="view" value="quickAnonGcInfo"/> </request-map> |
Free forum by Nabble | Edit this page |