Skip to content

Commit 76a7aba

Browse files
committed
Fixed instantiations with child context instead of parent context.
1 parent 5620930 commit 76a7aba

15 files changed

Lines changed: 109 additions & 100 deletions

File tree

build/build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@
478478
<path refid="mod-ri-path" />
479479
<pathelement path="${classes}/${mod-ri-id}" />
480480
<fileset dir="${lib}/${lib-logging-id}" includes="*.jar" />
481+
<fileset dir="${lib}/${lib-cglib-id}" includes="*.jar" />
481482
<fileset dir="${lib}/${lib-spring-id}" includes="*.jar" />
482483
</path>
483484

build/libraries.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,7 @@ lib-wrapper-id: ${lib-wrapper-package}_${lib-wrapper-version}
194194
lib-xdb-package: oracle.xdb
195195
lib-xdb-version: 11.1
196196
lib-xdb-id: ${lib-xdb-package}_${lib-xdb-version}
197+
198+
lib-cglib-package: net.sf.cglib
199+
lib-cglib-version: 2.1
200+
lib-cglib-id: ${lib-cglib-package}_${lib-cglib-version}

modules/com.noelios.restlet.ext.servlet_2.5/src/com/noelios/restlet/ext/servlet/ServletWarClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public class ServletWarClient extends Client {
5858
/**
5959
* Constructor.
6060
*
61-
* @param context
62-
* The context.
61+
* @param parentContext
62+
* The parent context.
6363
*/
64-
public ServletWarClient(Context context,
64+
public ServletWarClient(Context parentContext,
6565
javax.servlet.ServletContext servletContext) {
66-
super(context.createChildContext(), (List<Protocol>) null);
66+
super(parentContext.createChildContext(), (List<Protocol>) null);
6767
getProtocols().add(Protocol.WAR);
6868
this.helper = new ServletWarClientHelper(this, servletContext);
6969
}

modules/com.noelios.restlet.ext.xdb_11.1/src/com/noelios/restlet/ext/xdb/XdbServerServlet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ protected HttpServerHelper createServer(HttpServletRequest request) {
226226

227227
if ((component != null) && (application != null)) {
228228
// First, let's create a pseudo server
229-
final Server server = new Server(component.getContext(),
230-
new ArrayList<Protocol>(), this.localAddress,
231-
this.localPort, component);
229+
final Server server = new Server(component.getContext()
230+
.createChildContext(), new ArrayList<Protocol>(),
231+
this.localAddress, this.localPort, component);
232232
server.getProtocols().add(Protocol.HTTP);
233233
result = new HttpServerHelper(server);
234234

modules/org.restlet.example/src/org/restlet/example/jaxrs/ExampleServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static void main(String[] args) throws Exception {
5555

5656
// create JAX-RS runtime environment
5757
final JaxRsApplication application = new JaxRsApplication(comp
58-
.getContext());
58+
.getContext().createChildContext());
5959

6060
// attach ApplicationConfig
6161
application.add(new ExampleAppConfig());

modules/org.restlet.example/src/org/restlet/example/jaxrs/GuardedExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static void main(String[] args) throws Exception {
9494

9595
// create JAX-RS runtime environment
9696
final JaxRsApplication application = new JaxRsApplication(comp
97-
.getContext());
97+
.getContext().createChildContext());
9898

9999
// create a Guard
100100
final Guard guard = new Guard(application.getContext(),

modules/org.restlet.example/src/org/restlet/example/misc/SimpleServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public static void main(String[] args) {
5555
component.getServers().add(Protocol.HTTP, 9876);
5656

5757
// Prepare and attach a test Handler
58-
final Restlet handler = new Restlet(component.getContext()) {
58+
final Restlet handler = new Restlet(component.getContext()
59+
.createChildContext()) {
5960
@Override
6061
public void handle(Request request, Response response) {
6162
if (request.getMethod().equals(Method.PUT)) {

modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringComponent.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ public void setServersList(List<Object> serversInfo) {
152152
} else if (serverInfo instanceof Protocol) {
153153
getServers().add((Protocol) serverInfo);
154154
} else if (serverInfo instanceof Server) {
155-
final Server server = (Server) serverInfo;
156-
server.setContext(getContext());
157-
getServers().add(server);
155+
getServers().add((Server) serverInfo);
158156
} else {
159157
getLogger()
160158
.warning(

modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ private VirtualHost getVirtualHost(Component component) {
636636

637637
if (host == null) {
638638
// A new virtual host needs to be created
639-
host = new VirtualHost(getContext());
639+
host = new VirtualHost(component.getContext().createChildContext());
640640
host.setHostDomain(hostDomain);
641641
host.setHostPort(hostPort);
642642
host.setHostScheme(hostScheme);

modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlComponent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public WadlApplication attach(Reference wadlRef) {
154154
* @return The created WADL application.
155155
*/
156156
public WadlApplication attach(Representation wadl) {
157-
final WadlApplication result = new WadlApplication(getContext(), wadl);
157+
final WadlApplication result = new WadlApplication(getContext()
158+
.createChildContext(), wadl);
158159
result.attachToComponent(this);
159160
return result;
160161
}

0 commit comments

Comments
 (0)