Permalink
Browse files

Reuse the DeploymentConfiguration

git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1397423 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 9b46e57 commit 5236ae3d8aedda99199c18b7236b1ab3d7cd5643 @raymondfeng raymondfeng committed Oct 12, 2012
@@ -132,6 +132,11 @@ public void init() throws ServletException {
public DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFoundException, InstantiationException,
IllegalAccessException, IOException {
+ DeploymentConfiguration config =
+ (DeploymentConfiguration)getServletContext().getAttribute(DeploymentConfiguration.class.getName());
+ if (config != null) {
+ return config;
+ }
// setup proper classLoader to work on OSGi environment
ClassLoader cl =
@@ -141,9 +146,9 @@ public DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFound
"/META-INF/wink-alternate-shortcuts.properties",
"/META-INF/server/wink-providers");
- DeploymentConfiguration config = null;
try {
config = super.getDeploymentConfiguration();
+ getServletContext().setAttribute(DeploymentConfiguration.class.getName(), config);
} finally {
if (cl != null) {
// return previous classLoader
@@ -155,19 +160,19 @@ public DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFound
config.setFilterConfig(new FilterConfig() {
public ServletContext getServletContext() {
- return getServletContext();
+ return TuscanyRESTServlet.this.getServletContext();
}
public Enumeration getInitParameterNames() {
- return getInitParameterNames();
+ return TuscanyRESTServlet.this.getInitParameterNames();
}
- public String getInitParameter(String arg0) {
- return getInitParameter(arg0);
+ public String getInitParameter(String p) {
+ return TuscanyRESTServlet.this.getInitParameter(p);
}
public String getFilterName() {
- return getServletName();
+ return TuscanyRESTServlet.this.getServletName();
}
});

0 comments on commit 5236ae3

Please sign in to comment.