Author: rsearls
Date: 2014-05-19 11:55:08 -0400 (Mon, 19 May 2014)
New Revision: 18675
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
Log:
[JBWS-3750] added url path substitution in rewriteSoapAddress
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
---
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-19
14:22:07 UTC (rev 18674)
+++
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-19
15:55:08 UTC (rev 18675)
@@ -47,7 +47,7 @@
* @param serverConfig The current ServerConfig
* @return The rewritten soap:address to be used in the wsdl
*/
- public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String
epAddress, ServerConfig serverConfig) {
+ public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String
epAddress, ServerConfig serverConfig, String contextRoot) {
if (wsdlAddress == null) {
return null;
}
@@ -56,7 +56,7 @@
final String origUriScheme = getUriScheme(wsdlAddress); //will be https if the
user wants a https address in the wsdl
final String newUriScheme = getUriScheme(epAddress); //will be https if the user
set confidential transport for the endpoint
final String uriScheme = (origUriScheme.equals(HTTPS) ||
newUriScheme.equals(HTTPS)) ? HTTPS : HTTP;
- return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, uriScheme,
serverConfig.getWebServicePath());
+ return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, uriScheme,
serverConfig.getWebServicePath(), contextRoot);
}
else
{
@@ -118,7 +118,7 @@
* @param uriScheme The uriScheme to use for rewrite
* @return The obtained address
*/
- private static String rewriteSoapAddress(ServerConfig serverConfig, String
origAddress, String newAddress, String uriScheme, String additionalCcontext)
+ private static String rewriteSoapAddress(ServerConfig serverConfig, String
origAddress, String newAddress, String uriScheme, String additionalCcontext, String
contextRoot)
{
try
{
@@ -147,13 +147,15 @@
sb.append("://");
sb.append(host);
sb.append(port);
- if (additionalCcontext != null) {
- if (!additionalCcontext.startsWith("/")) {
- sb.append("/");
- }
- sb.append(additionalCcontext);
+ // replace original context-root with replacement context
+ if (additionalCcontext != null && additionalCcontext.length() > 0) {
+ String tmpAdditionalCcontext = additionalCcontext.startsWith("/")
? additionalCcontext : "/" + additionalCcontext;
+ String tmpPath = path.replace(contextRoot, tmpAdditionalCcontext);
+ sb.append(tmpPath);
+ } else
+ {
+ sb.append(path);
}
- sb.append(path);
final String urlStr = sb.toString();
ADDRESS_REWRITE_LOGGER.addressRewritten(origAddress, urlStr);
Show replies by date