-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix loading Resources/server.wsdd from a 'jar framework' (used to con…
…figure web services)
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...eworks/Core/ERExtensions/Sources/com/webobjects/appserver/_private/WOWebServicePatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.webobjects.appserver._private; | ||
|
||
import java.io.InputStream; | ||
|
||
import org.apache.axis.server.AxisServer; | ||
import org.apache.axis.utils.XMLUtils; | ||
import org.w3c.dom.Document; | ||
|
||
import com.webobjects.appserver.WOApplication; | ||
import com.webobjects.appserver.WOWSDDRegistrar; | ||
import com.webobjects.foundation.NSLog; | ||
import com.webobjects.webservices.support.WOXMLProvider; | ||
|
||
/** | ||
* Fixes a bug in WOWebService that causes the "Resources/server.wsdd" file (for configuration Axis) | ||
* to fail to be loaded if contained inside a "jar framework" rather than a regular framework. | ||
* | ||
* @author johnthuss | ||
* | ||
*/ | ||
public class WOWebServicePatch { | ||
|
||
/* | ||
* Re-implemented to support loading the server.wsdd file from a jar framework as well. | ||
*/ | ||
static Document getDeploymentDocument() { | ||
Document document = null; | ||
InputStream stream = WOApplication.application().resourceManager().inputStreamForResourceNamed("server.wsdd", null, null); | ||
if (stream != null) { | ||
try { | ||
document = XMLUtils.newDocument(stream); | ||
} catch (Exception e) { | ||
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupWebServices)) { | ||
NSLog.debug.appendln("Couldn't parse .wsdd file"); | ||
NSLog.debug.appendln(e); | ||
} | ||
} | ||
} | ||
if (document == null) { | ||
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupWebServices)) | ||
NSLog.debug.appendln("Couldn't " + ((stream == null) ? "find" : "parse") + " .wsdd file. Using empty default."); | ||
document = WOWSDDRegistrar._getEmptyDeployment(); | ||
} | ||
return document; | ||
} | ||
|
||
/* | ||
* Same functionality as WOWebService, except it calls our version of getDeploymentDocument(). | ||
*/ | ||
public static void initServer() { | ||
if (WOWebService.engine == null) { | ||
if (WOApplication.application().resourceManager().inputStreamForResourceNamed("server.wsdd", null, null) == null) | ||
return; // nothing necessary to do - the default .wsdd will be loaded correctly by WO. | ||
|
||
try { | ||
WOWebService.provider = new WOXMLProvider(getDeploymentDocument()); | ||
WOWebService.engine = new AxisServer(WOWebService.provider); | ||
} catch (Exception ex) { | ||
NSLog.err.appendln("Error trying to deploy Axis engine " + ex); | ||
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelCritical, NSLog.DebugGroupWebServices | NSLog.DebugGroupWebObjects)) | ||
NSLog.err.appendln(ex); | ||
System.exit(1); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters