diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-15 05:11:30 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-15 05:11:30 +0000 |
commit | bb2708626f680e4f9f73d03de264b348043390f5 (patch) | |
tree | 77a11d1b6147f47e41db4bf6358472ea546bffec /sca-java-2.x/trunk/modules/common-http | |
parent | 8bfe58abfce3f06fbdb8c08831bcfde771889ff3 (diff) |
Adding a way to store binding context in threadLocal to allow policy handler to access binding context
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1081668 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/common-http')
-rw-r--r-- | sca-java-2.x/trunk/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/ThreadHTTPContext.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/ThreadHTTPContext.java b/sca-java-2.x/trunk/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/ThreadHTTPContext.java new file mode 100644 index 0000000000..fb1206f005 --- /dev/null +++ b/sca-java-2.x/trunk/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/ThreadHTTPContext.java @@ -0,0 +1,42 @@ +/* + * 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.tuscany.sca.common.http; + +public class ThreadHTTPContext { + + private static final ThreadLocal<HTTPContext> CONTEXT = new ThreadLocal<HTTPContext>(); + + private ThreadHTTPContext() { + } + + public static HTTPContext setHTTPContext(HTTPContext context) { + HTTPContext old = CONTEXT.get(); + CONTEXT.set(context); + return old; + } + + public static HTTPContext getHTTPContext() { + return CONTEXT.get(); + } + + public static void removeHTTPContext() { + CONTEXT.remove(); + } +} |