Commit 30b0516f authored by Andrea Aime's avatar Andrea Aime
Browse files

[GEOS-4179] Importer and monitoring REST resources are not thread-safe

parent 8d3fd5ff
......@@ -6,49 +6,49 @@
rest bindings
<bean id="importResource" class="">
<bean id="importResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="importContextFinder" class="">
<constructor-arg value="importResource"/>
<bean id="importTaskResource" class="">
<bean id="importTaskResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="importTaskFinder" class="">
<constructor-arg value="importTaskResource"/>
<bean id="taskTargetResource" class="">
<bean id="taskTargetResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="taskTargetFinder" class="">
<constructor-arg value="taskTargetResource"/>
<bean id="layerResource" class="">
<bean id="layerResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="layerFinder" class="">
<constructor-arg value="layerResource"/>
<bean id="importDataResource" class="">
<bean id="importDataResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="importDataFinder" class="">
<constructor-arg value="importDataResource"/>
<bean id="dirResource" class="">
<bean id="dirResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="dirFinder" class="">
<constructor-arg value="dirResource"/>
<bean id="txResource" class="">
<bean id="txResource" class="" singleton="false">
<constructor-arg ref="importer"/>
<bean id="txFinder" class="">
......@@ -34,14 +34,14 @@
<!-- rest bindings -->
<bean id="requestResource" class="">
<bean id="requestResource" class="" scope="prototype">
<constructor-arg ref="monitor"/>
<bean id="requestResourceFinder" class="">
<constructor-arg value="requestResource"/>
<bean id="owsRequestResource" class="">
<bean id="owsRequestResource" class="" scope="prototype">
<constructor-arg ref="monitor"/>
<bean id="owsRequestResourceFinder" class="">
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -18,13 +18,18 @@ import org.springframework.context.ApplicationContextAware;
* <p>
* The following shows an example of using this class in a spring context:
* <pre>
* <bean id="myResource" class="org.acme.MyResource"/>
* <bean id="myResource" class="org.acme.MyResource" scope="prototype" />
* <bean id="myBeanResourceFinder" class="">
* <constructor-arg ref="myResource"/>
* </bean>
* </pre>
* </p>
* <p>The creation scope of the bean must be "prototype", at each lookup the resource
* will be provided the request and response via its {@link Resource#init(org.restlet.Context, Request, Response)}
* method, making it hold those values in the object fields: a singleton won't thus
* be thread safe
* </p>
* @author David Winslow, OpenGEO
* @author Justin Deoliveira, OpenGEO
......@@ -69,7 +74,7 @@ public class BeanResourceFinder extends Finder implements ApplicationContextAwar
public String getBeanToFind(){
return beanName;
public Resource findTarget(Request request, Response response){
Resource res = (Resource) applicationContext.getBean(getBeanToFind());
res.init(getContext(), request, response);
......@@ -8,8 +8,8 @@
<bean id="exceptionThrowingResource" class=""/>
<bean id="gsUserResource" class=""/>
<bean id="exceptionThrowingResource" class="" singleton="false"/>
<bean id="gsUserResource" class="" singleton="false"/>
<bean id="testMapping" class="">
<property name="routes">
......@@ -545,7 +545,7 @@
<constructor-arg index="1" value="true"/> <!-- force reset instead of reload -->
<bean id="fontFinder" class=""/>
<bean id="fontFinder" class="" singleton="false"/>
<bean id="catalogLocker" class="">
<constructor-arg index="0" ref="configurationLock"/>
......@@ -48,13 +48,13 @@
<bean id="masterPasswordResource" class="">
<bean id="masterPasswordResource" class="" singleton="false">
<bean id="dataAccessControlResource" class=""/>
<bean id="restAccessControlResource" class=""/>
<bean id="serviceAccessControlResource" class=""/>
<bean id="catalogModeResource" class=""/>
<bean id="dataAccessControlResource" class="" singleton="false"/>
<bean id="restAccessControlResource" class="" singleton="false"/>
<bean id="serviceAccessControlResource" class="" singleton="false"/>
<bean id="catalogModeResource" class="" singleton="false"/>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment