You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/04/16 18:15:51 UTC
svn commit: r529306 [1/2] - in /webservices/axis2/trunk/java/modules/kernel:
src/org/apache/axis2/deployment/
src/org/apache/axis2/deployment/repository/util/
src/org/apache/axis2/deployment/util/ src/org/apache/axis2/description/
src/org/apache/axis2/...
Author: dims
Date: Mon Apr 16 09:15:48 2007
New Revision: 529306
URL: http://svn.apache.org/viewvc?view=rev&rev=529306
Log:
merge from 1.2 branch
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SynchronousMailListener.java
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperationFactory.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailToInfo.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Counter.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Mon Apr 16 09:15:48 2007
@@ -384,8 +384,7 @@
while (handlers.hasNext()) {
OMElement omElement = (OMElement) handlers.next();
- HandlerDescription handler = processHandler(omElement, axisConfig, phaseName);
-// HandlerDescription handler = processHandler(omElement, axisConfig);
+ HandlerDescription handler = processHandler(omElement, axisConfig);
handler.getRules().setPhaseName(phaseName);
Utils.loadHandler(axisConfig.getSystemClassLoader(), handler);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java Mon Apr 16 09:15:48 2007
@@ -29,6 +29,9 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.List;
+import java.util.HashMap;
+
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -37,36 +40,22 @@
private URL[] urls = null;
// List of jar files inside the jars in the original url
- private ArrayList embedded_jars;
+ private List embedded_jars;
+
+ private HashMap loadedClass = new HashMap();
/**
* DeploymentClassLoader is extended from URLClassLoader. The constructor
- * does not override the super constructor, but does additional steps like find out
+ * does not override the super constructor, but takes in an addition list of
* jar files inside /lib directory.
*
* @param urls <code>URL</code>s
* @param parent parent classloader <code>ClassLoader</code>
*/
- public DeploymentClassLoader(URL[] urls, ClassLoader parent, boolean antiJARLocking) {
- super(Utils.getURLsForAllJars(urls[0]), parent);
- }
-
- /**
- * Experimental!! Is not hooked up yet.
- *
- * @param urls
- * @param parent
- */
- public DeploymentClassLoader(URL[] urls, ClassLoader parent) {
+ public DeploymentClassLoader(URL[] urls, List embedded_jars, ClassLoader parent) {
super(urls, parent);
this.urls = urls;
- /**
- * though the URL array can contain one or more urls , we only consider the
- * first one, since this classLoader is only for Axis2 and the classloader
- * is created by Deployment, we definitely know that there will be only one url in
- * the URL array list
- */
- embedded_jars = Utils.findLibJars(urls[0]);
+ this.embedded_jars = embedded_jars;
}
/**
@@ -103,6 +92,7 @@
return clazz;
}
+
/**
* Finds the resource with the specified name on the URL search path.
*
@@ -266,7 +256,7 @@
} catch (IOException e) {
throw new RuntimeException(e);
}
- } else
- return super.getResourceAsStream(name);
+ }
+ return null;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Mon Apr 16 09:15:48 2007
@@ -19,6 +19,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
@@ -210,10 +211,12 @@
String fileUrl = (String) fileIterator.next();
if (fileUrl.endsWith(".mar")) {
URL moduleurl = new URL(moduleDir, fileUrl);
- DeploymentClassLoader deploymentClassLoader =
- new DeploymentClassLoader(
+ ClassLoader deploymentClassLoader =
+ Utils.createClassLoader(
new URL[]{moduleurl},
- axisConfig.getModuleClassLoader(), false);
+ axisConfig.getModuleClassLoader(),
+ true,
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
AxisModule module = new AxisModule();
module.setModuleClassLoader(deploymentClassLoader);
module.setParent(axisConfig);
@@ -258,8 +261,11 @@
String serviceName) throws DeploymentException {
try {
serviceGroup.setServiceGroupName(serviceName);
- DeploymentClassLoader serviceClassLoader = new DeploymentClassLoader(
- new URL[]{servicesURL}, axisConfig.getServiceClassLoader(), false);
+ ClassLoader serviceClassLoader = Utils.createClassLoader(
+ new URL[]{servicesURL},
+ axisConfig.getServiceClassLoader(),
+ true,
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
String metainf = "meta-inf";
serviceGroup.setServiceGroupClassLoader(serviceClassLoader);
//processing wsdl.list
@@ -902,7 +908,7 @@
axismodule = new AxisModule();
ArchiveReader archiveReader = new ArchiveReader();
- currentDeploymentFile.setClassLoader(false, config.getModuleClassLoader());
+ currentDeploymentFile.setClassLoader(false, config.getModuleClassLoader(), null);
axismodule.setModuleClassLoader(currentDeploymentFile.getClassLoader());
archiveReader.readModuleArchive(currentDeploymentFile, axismodule,
false, config);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Mon Apr 16 09:15:48 2007
@@ -1,6 +1,7 @@
package org.apache.axis2.deployment;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
@@ -12,6 +13,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.File;
import java.net.MalformedURLException;
/*
@@ -35,6 +37,7 @@
public class ModuleDeployer implements Deployer {
private static final Log log = LogFactory.getLog(ModuleDeployer.class);
+ private ConfigurationContext configCtx;
private AxisConfiguration axisConfig;
@@ -47,6 +50,7 @@
//To initialize the deployer
public void init(ConfigurationContext configCtx) {
+ this.configCtx = configCtx;
this.axisConfig = configCtx.getAxisConfiguration();
}
//Will process the file and add that to axisConfig
@@ -55,14 +59,15 @@
ArchiveReader archiveReader = new ArchiveReader();
String moduleStatus = "";
StringWriter errorWriter = new StringWriter();
- boolean explodedDir = deploymentFileData.getFile().isDirectory();
+ boolean isDirectory = deploymentFileData.getFile().isDirectory();
try {
- deploymentFileData.setClassLoader(explodedDir,
- axisConfig.getModuleClassLoader());
+ deploymentFileData.setClassLoader(isDirectory,
+ axisConfig.getModuleClassLoader(),
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
AxisModule metaData = new AxisModule();
metaData.setModuleClassLoader(deploymentFileData.getClassLoader());
metaData.setParent(axisConfig);
- archiveReader.readModuleArchive(deploymentFileData, metaData, explodedDir,
+ archiveReader.readModuleArchive(deploymentFileData, metaData, isDirectory,
axisConfig);
metaData.setFileName(deploymentFileData.getFile().toURL());
DeploymentEngine.addNewModule(metaData, axisConfig);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Mon Apr 16 09:15:48 2007
@@ -10,6 +10,7 @@
import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.util.Loader;
import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.Constants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.java2wsdl.AnnotationConstants;
@@ -68,10 +69,12 @@
File file = deploymentFileData.getFile();
if (file != null) {
File parentFile = file.getParentFile();
- DeploymentClassLoader classLoader =
- new DeploymentClassLoader(new URL[]{parentFile.toURL()},
- configCtx
- .getAxisConfiguration().getSystemClassLoader(),false);
+ ClassLoader classLoader =
+ Utils.createClassLoader(new URL[]{parentFile.toURL()},
+ configCtx.getAxisConfiguration().getSystemClassLoader(),
+ true,
+ (File)configCtx.getAxisConfiguration()
+ .getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
Thread.currentThread().setContextClassLoader(classLoader);
String className = file.getName();
className = className.replaceAll(".class", "");
@@ -166,9 +169,11 @@
ArrayList axisServiceList = new ArrayList();
for (int i = 0; i < classList.size(); i++) {
String className = (String) classList.get(i);
- DeploymentClassLoader classLoader = new DeploymentClassLoader(
+ ClassLoader classLoader = Utils.createClassLoader(
new URL[]{deploymentFileData.getFile().toURL()},
- configCtx.getAxisConfiguration().getSystemClassLoader(),false);
+ configCtx.getAxisConfiguration().getSystemClassLoader(),
+ true,
+ (File)configCtx.getAxisConfiguration().getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
Thread.currentThread().setContextClassLoader(classLoader);
className = className.replaceAll(".class", "");
className = className.replaceAll("/", ".");
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Mon Apr 16 09:15:48 2007
@@ -88,6 +88,8 @@
if (!"".equals(serviceNameatt.getAttributeValue().trim())) {
AxisService wsdlService = (AxisService) wsdlServiceMap.get(serviceNameatt.getAttributeValue());
if(wsdlService!=null){
+ wsdlService.setClassLoader(service.getClassLoader());
+ wsdlService.setParent(service.getParent());
service = wsdlService;
service.setWsdlFound(true);
service.setCustomWsdl(true);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java Mon Apr 16 09:15:48 2007
@@ -1,6 +1,7 @@
package org.apache.axis2.deployment;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
@@ -14,6 +15,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -50,14 +52,15 @@
//Will process the file and add that to axisConfig
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
- boolean explodedDir = deploymentFileData.getFile().isDirectory();
+ boolean isDirectory = deploymentFileData.getFile().isDirectory();
ArchiveReader archiveReader;
StringWriter errorWriter = new StringWriter();
archiveReader = new ArchiveReader();
String serviceStatus = "";
try {
- deploymentFileData.setClassLoader(explodedDir,
- axisConfig.getServiceClassLoader());
+ deploymentFileData.setClassLoader(isDirectory,
+ axisConfig.getServiceClassLoader(),
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
HashMap wsdlservice = archiveReader.processWSDLs(deploymentFileData);
if (wsdlservice != null && wsdlservice.size() > 0) {
Iterator services = wsdlservice.values().iterator();
@@ -75,7 +78,7 @@
deploymentFileData.getClassLoader());
ArrayList serviceList = archiveReader.processServiceGroup(
deploymentFileData.getAbsolutePath(), deploymentFileData,
- sericeGroup, explodedDir, wsdlservice,
+ sericeGroup, isDirectory, wsdlservice,
configCtx);
DeploymentEngine.addServiceGroup(sericeGroup,
serviceList,
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java Mon Apr 16 09:15:48 2007
@@ -1,6 +1,7 @@
package org.apache.axis2.deployment;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.description.AxisServiceGroup;
@@ -92,7 +93,6 @@
try {
this.config = servletConfig;
InputStream axis2Stream = null;
-
try {
if (axis2Stream == null) {
@@ -135,6 +135,15 @@
}
axisConfig = populateAxisConfiguration(axis2Stream);
+ Parameter param = new Parameter();
+ param.setName(Constants.Configuration.ARTIFACTS_TEMP_DIR);
+ param.setValue(config.getServletContext().getAttribute("javax.servlet.context.tempdir"));
+ try {
+ axisConfig.addParameter(param);
+ } catch (AxisFault axisFault) {
+ log.error(axisFault);
+ }
+
// when the module is an unpacked war file,
// we can set the web location path in the deployment engine.
// This will let us
@@ -150,17 +159,6 @@
log.error(e.getMessage(), e);
} catch (IOException e) {
log.error(e.getMessage(), e);
- } finally {
- try {
- Parameter enableHttp = new Parameter("enableHTTP", "true");
- if (axisConfig != null) {
- axisConfig.addParameter(enableHttp);
- } else {
- log.error("axisConfig was null after initialization");
- }
- } catch (AxisFault axisFault) {
- log.info(axisFault.getMessage());
- }
}
}
@@ -312,6 +310,7 @@
public void setConfigContext(ConfigurationContext configContext) {
super.setConfigContext(configContext);
+
// setting ServletContext into configctx
configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT,
config.getServletContext());
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Mon Apr 16 09:15:48 2007
@@ -333,7 +333,6 @@
new ByteArrayInputStream(
out.toByteArray()),
entry.getName());
- service.setClassLoader(file.getClassLoader());
if (service != null) {
servicesMap.put(service.getName(), service);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java Mon Apr 16 09:15:48 2007
@@ -108,25 +108,24 @@
this.classLoader = classLoader;
}
- public void setClassLoader(boolean extractArchive, ClassLoader parent) throws AxisFault {
- if (!extractArchive) {
-
- if (file != null) {
+ public void setClassLoader(boolean isDirectory, ClassLoader parent, File file) throws AxisFault {
+ if (!isDirectory) {
+ if (this.file != null) {
URL[] urlsToLoadFrom;
try {
- if (!file.exists()) {
+ if (!this.file.exists()) {
throw new AxisFault(Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND,
- file.getAbsolutePath()));
+ this.file.getAbsolutePath()));
}
- urlsToLoadFrom = new URL[]{file.toURL()};
- classLoader = new DeploymentClassLoader(urlsToLoadFrom, parent,false);
+ urlsToLoadFrom = new URL[]{this.file.toURL()};
+ classLoader = Utils.createClassLoader(urlsToLoadFrom, parent, true, file);
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
} else {
- if (file != null) {
- classLoader = Utils.getClassLoader(parent, file);
+ if (this.file != null) {
+ classLoader = Utils.getClassLoader(parent, this.file);
}
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Mon Apr 16 09:15:48 2007
@@ -8,6 +8,7 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.DeploymentConstants;
import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.DeploymentClassLoader;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
import org.apache.axis2.description.AxisMessage;
@@ -46,6 +47,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -53,6 +55,7 @@
import java.util.LinkedList;
import java.util.Stack;
import java.util.StringTokenizer;
+import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -117,14 +120,22 @@
}
}
- public static URL[] getURLsForAllJars(URL url) {
+ public static URL[] getURLsForAllJars(URL url, File tmpDir) {
try {
ArrayList array = new ArrayList();
-// String urlString = url.toString();
+ String urlString = url.toString();
InputStream in = url.openStream();
+ String fileName = url.getFile();
+ int index = fileName.lastIndexOf('/');
+ if(index != -1) {
+ fileName = fileName.substring(index+1);
+ }
+ File f = createTempFile(fileName, in, tmpDir);
+ in.close();
ZipInputStream zin;
- array.add(url);
- zin = new ZipInputStream(in);
+ FileInputStream fin = new FileInputStream(f);
+ array.add(f.toURL());
+ zin = new ZipInputStream(fin);
ZipEntry entry;
String entryName;
@@ -137,22 +148,33 @@
if ((entryName != null) && entryName.toLowerCase().startsWith("lib/")
&& entryName.toLowerCase().endsWith(".jar")) {
String suffix = entryName.substring(4);
- File f = createTempFile(suffix, zin);
+ f = createTempFile(suffix, zin, tmpDir);
array.add(f.toURL());
}
}
zin.close();
+ if (fin != null) {
+ fin.close();
+ }
return (URL[]) array.toArray(new URL[array.size()]);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
- public static File createTempFile(String suffix, InputStream in) throws IOException {
+ public static File createTempFile(String suffix, InputStream in, File tmpDir) throws IOException {
byte data[] = new byte[2048];
int count;
+ File f;
+ if(tmpDir == null) {
new File(System.getProperty("java.io.tmpdir")).mkdirs();
- File f = File.createTempFile("axis2", suffix);
+ f = File.createTempFile("axis2", suffix);
+ } else {
+ f = File.createTempFile("axis2", suffix, tmpDir);
+ }
+ if(log.isDebugEnabled()) {
+ log.info("Created temporary file : " + f.getAbsolutePath());
+ }
f.deleteOnExit();
FileOutputStream out = new FileOutputStream(f);
while ((count = in.read(data, 0, 2048)) != -1) {
@@ -463,14 +485,17 @@
}
InputStream fin = moduleClassLoader.getResourceAsStream("aars/" + servicename);
if (fin == null) {
- throw new AxisFault("No service archiev found : " + servicename);
+ throw new AxisFault("No service archive found : " + servicename);
}
- File inputFile = Utils.createTempFile(servicename, fin);
+ File inputFile = Utils.createTempFile(servicename,
+ fin,
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
DeploymentFileData filedata = new DeploymentFileData(inputFile,
DeploymentConstants.TYPE_SERVICE);
filedata.setClassLoader(false,
- moduleClassLoader);
+ moduleClassLoader,
+ (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
HashMap wsdlservice = archiveReader.processWSDLs(filedata);
if (wsdlservice != null && wsdlservice.size() > 0) {
Iterator servicesitr = wsdlservice.values().iterator();
@@ -596,7 +621,7 @@
* Searches for jar files inside /lib dirctory. If there are any, the
* names of those jar files will be added to the array list
*/
- public static ArrayList findLibJars(URL url) {
+ public static List findLibJars(URL url) {
ArrayList embedded_jars = new ArrayList();
try {
ZipInputStream zin = new ZipInputStream(url.openStream());
@@ -631,5 +656,16 @@
excludeList.add("startUp");
excludeList.add("destroy");
excludeList.add("shutDown");
+ }
+
+ public static ClassLoader createClassLoader(URL[] urls, ClassLoader serviceClassLoader,
+ boolean extractJars, File tmpDir) {
+ if(extractJars) {
+ URL[] urls1 = Utils.getURLsForAllJars(urls[0], tmpDir);
+ return new DeploymentClassLoader(urls1, null, serviceClassLoader);
+ } else {
+ List embedded_jars = Utils.findLibJars(urls[0]);
+ return new DeploymentClassLoader(urls, embedded_jars, serviceClassLoader);
+ }
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java Mon Apr 16 09:15:48 2007
@@ -19,6 +19,8 @@
package org.apache.axis2.description;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.util.WSDLSerializationUtil;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axiom.om.OMElement;
@@ -115,7 +117,7 @@
* @return The generated binding element
*/
public OMElement toWSDL20(OMNamespace tns, OMNamespace wsoap, OMNamespace whttp,
- String interfaceName, Map nameSpaceMap) {
+ String interfaceName, Map nameSpaceMap, String addressingFlag) {
String property;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement bindingElement;
@@ -125,7 +127,8 @@
bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null,
tns.getPrefix() + ":" + interfaceName));
- if (WSDL2Constants.URI_WSDL2_SOAP.equals(type)) {
+ if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) ||
+ Constants.URI_SOAP12_HTTP.equals(type)) {
// SOAP Binding specific properties
property = (String) options.get(WSDL2Constants.ATTR_WSOAP_VERSION);
if (property != null) {
@@ -153,6 +156,9 @@
if (soapModules != null && soapModules.size() > 0) {
WSDLSerializationUtil.addSOAPModuleElements(omFactory, soapModules, wsoap, bindingElement);
}
+
+ WSDLSerializationUtil.addWSAddressingToBinding(addressingFlag, omFactory, bindingElement);
+
} else if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) {
// HTTP Binding specific properties
property = (String) options.get(WSDL2Constants.ATTR_WHTTP_METHOD);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java Mon Apr 16 09:15:48 2007
@@ -19,6 +19,7 @@
package org.apache.axis2.description;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.util.WSDLSerializationUtil;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.engine.AxisConfiguration;
@@ -124,7 +125,8 @@
null, tns.getPrefix() + ":" +
this.name.getLocalPart()));
- if (WSDL2Constants.URI_WSDL2_SOAP.equals(type)) {
+ if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) ||
+ Constants.URI_SOAP12_HTTP.equals(type)) {
// SOAP Binding specific properties
property = (String) this.options.get(WSDL2Constants.ATTR_WSOAP_ACTION);
if (property != null) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java Mon Apr 16 09:15:48 2007
@@ -112,13 +112,13 @@
}
- public OMElement toWSDL20(OMNamespace tns, OMNamespace whttp) {
+ public OMElement toWSDL20(OMNamespace tns, OMNamespace whttp, String epr) {
String property;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement endpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, null);
endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, this.getName()));
endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + getBinding().getName().getLocalPart()));
- endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, getEndpointURL()));
+ endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr));
property = (String) this.options.get(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_TYPE);
if (property != null) {
endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_AUTHENTICATION_TYPE, whttp, property));
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java Mon Apr 16 09:15:48 2007
@@ -664,6 +664,7 @@
if (inMessage != null) {
OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME, null);
inMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
+ WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, getInputAction());
axisOperationElement.addChild(inMessageElement);
}
@@ -672,6 +673,7 @@
if (outMessage != null) {
OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME, null);
outMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
+ WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, getOutputAction());
axisOperationElement.addChild(outMessageElement);
}
@@ -688,6 +690,7 @@
faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME, null);
}
faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + faultMessage.getName()));
+ WSDLSerializationUtil.addWSAWActionAttribute(faultElement, getFaultAction(faultMessage.getName()));
axisOperationElement.addChild(faultElement);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperationFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperationFactory.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperationFactory.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperationFactory.java Mon Apr 16 09:15:48 2007
@@ -106,10 +106,12 @@
WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI) ||
WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)) {
abOpdesc = new OutInAxisOperation();
+ abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY);
} else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI) ||
WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI) ||
WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)) {
abOpdesc = new InOnlyAxisOperation();
+ abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY);
} else {
throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI));
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Mon Apr 16 09:15:48 2007
@@ -1021,12 +1021,9 @@
private void printWSDLError(OutputStream out) throws AxisFault {
try {
String wsdlntfound = "<error>" +
- "<description>Unable to generate WSDL for this service</description>" +
- "<reason>If you wish Axis2 to automatically generate the WSDL, then please use one of the RPC message " +
- "receivers for the service(s)/operation(s) in services.xml. If you have added a custom WSDL in the " +
- "META-INF directory, then please make sure that the name of the service in services.xml " +
- "(/serviceGroup/service/@name) is the same as in the " +
- "custom wsdl's service name (/wsdl:definitions/wsdl:service/@name). </reason>" +
+ "<description>Unable to generate WSDL 1.1 for this service</description>" +
+ "<reason>If you wish Axis2 to automatically generate the WSDL 1.1, then please +" +
+ "set useOriginalwsdl as false in your services.xml</reason>" +
"</error>";
out.write(wsdlntfound.getBytes());
out.flush();
@@ -1038,30 +1035,9 @@
//WSDL 2.0
public void printWSDL2(OutputStream out) throws AxisFault {
- if (isUseUserWSDL()) {
- Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
- if (wsld4jdefinition != null) {
- try {
- String error = "<error>" +
- "<description>Unable to showtwo will WSDL for this service</description>" +
- "<reason>WSDL 2.0 document is to be shown. But we do not support WSDL 2.0" +
- "serialization yet.</reason>" +
- "</error>";
- out.write(error.getBytes());
- out.flush();
- out.close();
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
- }
- } else {
- printWSDLError(out);
- }
- } else {
- setWsdlFound(true);
- //pick the endpointName and take it as the epr for the WSDL
+ // Woden has not implemented the serializer yet, so all we can do it serialize the axisService
getWSDL2(out, new String[]{this.endpointName});
}
- }
public void printWSDL2(OutputStream out,
String requestIP,
@@ -1545,7 +1521,6 @@
new WSDL11ToAxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName);
serviceBuilder.setServerSide(false);
AxisService axisService = serviceBuilder.populateService();
-
AxisEndpoint axisEndpoint = (AxisEndpoint) axisService.getEndpoints()
.get(axisService.getEndpointName());
options.setTo(new EndpointReference(axisEndpoint.getEndpointURL()));
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java Mon Apr 16 09:15:48 2007
@@ -78,8 +78,6 @@
private String servicePath;
- private boolean generateHttp = false;
-
private HashMap policiesInDefinitions;
private ExternalPolicySerializer serializer;
@@ -185,18 +183,8 @@
generatePortType(fac, ele);
generateSOAP11Binding(fac, ele);
generateSOAP12Binding(fac, ele);
- // generateHttp
- if (axisService.getParent() != null) {
- AxisDescription axisdesc = axisService.getParent().getParent();
- Parameter parameter = axisdesc.getParameter("enableHTTP");
- if (parameter != null) {
- Object value = parameter.getValue();
- if ("true".equals(value.toString())) {
- generateHttp = true;
- generatePostBinding(fac, ele);
- }
- }
- }
+ generateHTTPBinding(fac, ele);
+
generateService(fac, ele);
addPoliciesToDefinitionElement(policiesInDefinitions.values()
.iterator(), definition);
@@ -361,7 +349,7 @@
+ ":" + inaxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
inaxisMessage.getPolicyInclude(), input, fac);
- addWSAWActionAttribute(input, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(input, axisOperation
.getInputAction());
operation.addChild(input);
}
@@ -385,7 +373,7 @@
+ ":" + outAxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
outAxisMessage.getPolicyInclude(), output, fac);
- addWSAWActionAttribute(output, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(output, axisOperation
.getOutputAction());
operation.addChild(output);
}
@@ -403,7 +391,7 @@
+ ":" + faultyMessage.getName(), null);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(),
null);
- addWSAWActionAttribute(fault, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(fault, axisOperation
.getFaultAction(faultyMessage.getName()));
// TODO add policies for fault messages
operation.addChild(fault);
@@ -426,13 +414,9 @@
addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
.getPolicyInclude(), service, fac);
-
- if (generateHttp) {
generateHTTPPorts(fac, service);
}
- }
-
private void generateSOAP11Ports(OMFactory fac, OMElement service)
throws Exception {
for (int i = 0; i < serviceEndpointURLs.length; i++) {
@@ -453,7 +437,7 @@
port.addAttribute(ATTRIBUTE_NAME, name, null);
port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ axisService.getName() + BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
soap);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
@@ -506,7 +490,7 @@
port.addAttribute(ATTRIBUTE_NAME, name, null);
port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
soap12);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
@@ -542,7 +526,7 @@
AddressingConstants.ADDRESSING_OPTIONAL)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -550,7 +534,7 @@
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -676,7 +660,7 @@
AddressingConstants.ADDRESSING_OPTIONAL)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -684,7 +668,7 @@
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -782,7 +766,7 @@
}
}
- private void generatePostBinding(OMFactory fac, OMElement defintions)
+ private void generateHTTPBinding(OMFactory fac, OMElement defintions)
throws Exception {
OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
defintions.addChild(binding);
@@ -889,14 +873,6 @@
}
}
- private void addExtensionElement(OMFactory fac, OMElement element,
- String name, String att1Name, String att1Value,
- OMNamespace soapNameSpace) {
- OMElement extElement = fac.createOMElement(name, soapNameSpace);
- element.addChild(extElement);
- extElement.addAttribute(att1Name, att1Value, null);
- }
-
private void setDefinitionElement(OMElement defintion) {
this.definition = defintion;
}
@@ -916,15 +892,6 @@
extElement.addAttribute("message", WSDLSerializationUtil.getPrefix(targetNamespace, axisService.getNameSpacesMap()) + ":"
+ header.getMessage().getLocalPart(), null);
}
- }
-
- private void addWSAWActionAttribute(OMElement element, String action) {
- if (action == null || action.length() == 0) {
- return;
- }
- OMNamespace namespace = element.declareNamespace(
- AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- element.addAttribute("Action", action, namespace);
}
private void addPolicyAsExtElement(int type, PolicyInclude policyInclude,
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java Mon Apr 16 09:15:48 2007
@@ -142,15 +142,20 @@
// generate default endpoint elements.
Map endpointMap = axisService.getEndpoints();
if (endpointMap != null && endpointMap.size() > 0) {
+ String[] eprs = axisService.getEPRs();
+ if (eprs == null) {
+ eprs = new String[]{axisService.getName()};
+ }
OMElement serviceElement = getServiceElement(tns, omFactory, interfaceName);
Iterator iterator = endpointMap.values().iterator();
while (iterator.hasNext()) {
AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next();
- serviceElement.addChild(axisEndpoint.toWSDL20(tns, whttp));
+ serviceElement.addChild(axisEndpoint.toWSDL20(tns, whttp, eprs[0]));
descriptionElement.addChild(axisEndpoint.getBinding().toWSDL20(tns, wsoap, whttp,
interfaceName,
- axisService.getNameSpacesMap()));
+ axisService.getNameSpacesMap(),
+ axisService.getWSAddressingFlag()));
}
descriptionElement.addChild(serviceElement);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Mon Apr 16 09:15:48 2007
@@ -337,7 +337,7 @@
// Options object reused above so soapAction needs to be removed so
// that soapAction+wsa:Action on response don't conflict
- responseMessageContext.setSoapAction("");
+ responseMessageContext.setSoapAction(null);
if (responseMessageContext.getEnvelope() == null) {
// If request is REST we assume the responseMessageContext is REST, so
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Mon Apr 16 09:15:48 2007
@@ -2,6 +2,9 @@
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.namespace.Constants;
import org.apache.axis2.transport.http.util.RESTUtil;
@@ -88,6 +91,10 @@
protected Description description;
private String wsdlURI;
+
+ // FIXME @author Chathura THis shoud be a URI. Find whats used by
+ // woden.
+ private static String RPC = "rpc";
protected String interfaceName;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java Mon Apr 16 09:15:48 2007
@@ -67,6 +67,10 @@
*/
public void signalResponseReady();
+ /**
+ * This will tell the transport to end a current wait by raising the given fault.
+ * @param fault The fault to be raised.
+ */
public void signalFaultReady(AxisFault fault);
/**
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Mon Apr 16 09:15:48 2007
@@ -113,6 +113,18 @@
} else {
type = contentType;
}
+ // Some services send REST responces as text/xml. We should convert it to
+ // application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder.
+ if (HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) {
+ if (msgContext.isServerSide()) {
+ if (msgContext.getSoapAction() == null) {
+ type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
+ }
+ } else if (msgContext.isDoingREST() && !JavaUtils.isTrueExplicitly(
+ msgContext.getProperty(Constants.Configuration.SOAP_RESPONSE_MEP))) {
+ type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
+ }
+ }
Builder builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
if (builder != null) {
documentElement = builder.processDocument(inStream, contentType, msgContext);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Mon Apr 16 09:15:48 2007
@@ -198,7 +198,6 @@
client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
config.setProxy(proxyHostName, proxyPort);
- config.setHost(proxyHostName);
}
/**
@@ -244,7 +243,6 @@
//the HashMap is stored in the outgoing message.
msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
}
-
}
String sessionCookie = null;
@@ -315,7 +313,7 @@
MessageContext msgCtx,
URL targetURL)
throws AxisFault {
- boolean isHostProxy = isProxyListed(msgCtx); // list the proxy
+ boolean isProxyListed = isProxyListed(msgCtx); // list the proxy
boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
@@ -334,17 +332,16 @@
// to see the host is a proxy and in the proxy list - available in axis2.xml
HostConfiguration config = new HostConfiguration();
+ // setting the real host configuration
+ config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
+
if (isAuthenticationEnabled) {
- // premtive authentication Basic or NTLM
- this.setAuthenticationInfo(client, msgCtx, config, targetURL);
+ // Basic, Digest, NTLM and custom authentications.
+ this.setAuthenticationInfo(client, msgCtx, config);
}
-
// proxy configuration
- if (!isHostProxy) {
- config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
- } else {
- this.configProxyAuthentication(client, proxyOutSetting, config,
- msgCtx);
+ if (isProxyListed) {
+ this.configProxyAuthentication(client, proxyOutSetting, config, msgCtx);
}
return config;
@@ -360,11 +357,7 @@
*/
protected void setAuthenticationInfo(HttpClient agent,
MessageContext msgCtx,
- HostConfiguration config,
- URL targetURL) throws AxisFault {
- config.setHost(targetURL.getHost(), targetURL.getPort(),
- targetURL.getProtocol());
-
+ HostConfiguration config) throws AxisFault {
HttpTransportProperties.Authenticator authenticator;
Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
if (obj != null) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java Mon Apr 16 09:15:48 2007
@@ -48,6 +48,7 @@
}
public void init(ServletConfig config) throws ServletException {
+ super.init(config);
ServletContext servletContext = config.getServletContext();
this.configContext =
(ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Mon Apr 16 09:15:48 2007
@@ -400,6 +400,7 @@
* @throws ServletException
*/
public void init(ServletConfig config) throws ServletException {
+ super.init(config);
try {
this.servletConfig = config;
configContext = initConfigContext(config);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java Mon Apr 16 09:15:48 2007
@@ -225,6 +225,10 @@
}
}
+ /**
+ * @deprecated org.apache.axis2.transport.http.HttpTransportProperties.MailProperties has been
+ * deprecated and user are encourage the use of java.util.Properties instead.
+ */
public static class MailProperties {
final Properties mailProperties = new Properties();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java Mon Apr 16 09:15:48 2007
@@ -202,13 +202,18 @@
int separator = httpLocation.indexOf('{');
try {
- if (separator > 0) {
+ if (separator > -1) {
replacedQuery = URIEncoderDecoder.quoteIllegal(
URLTemplatingUtil.applyURITemplating(messageContext, httpLocation, detach),
WSDL2Constants.LEGAL_CHARACTERS_IN_URL);
}
- URI targetURI = new URI(targetURL.toString() + "/");
+ URI targetURI;
+ if (replacedQuery.charAt(0) == '?') {
+ targetURI = new URI(targetURL.toString());
+ } else {
+ targetURI = new URI(targetURL.toString() + "/");
+ }
URI appendedURI = targetURI.resolve(replacedQuery);
targetURL = appendedURI.toURL();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java Mon Apr 16 09:15:48 2007
@@ -33,7 +33,7 @@
public final static String STORE_PROTOCOL = "mail.store.protocol";
- public final static String RAPLY_TO = "transport.mail.replyToAddress";
+ public final static String REPLY_TO = "transport.mail.replyToAddress";
public final static String LISTENER_INTERVAL = "transport.listener.interval";
@@ -75,4 +75,9 @@
public static final String MAIL_SMTP = "_MAIL_SMTP_";
public static final String MAIL_POP3 = "_MAIL_POP3_";
+
+ public static final String X_SERVICE_PATH = "X-Service-Path";
+ public static final String MAIL_SYNC = "_MAIL_SYNC_";
+ public static final String IN_REPLY_TO = "In-Reply-To";
+ public static final String MAILTO = "mailto";
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java Mon Apr 16 09:15:48 2007
@@ -22,6 +22,7 @@
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.MessageContext;
import org.apache.commons.logging.Log;
@@ -55,6 +56,7 @@
private OutputStream outputStream;
private String inReplyTo;
private EndpointReference from;
+ private OMOutputFormat format;
protected static Log log = LogFactory.getLog(EMailSender.class);
@@ -89,7 +91,7 @@
this.passwordAuthentication = passwordAuthentication;
}
- public void send(MailToInfo mailToInfo, OMOutputFormat format)
+ public void send()
throws AxisFault {
try {
@@ -103,6 +105,7 @@
EndpointReference epr = null;
+ MailToInfo mailToInfo = null;
if (messageContext.getTo() != null && !messageContext.getTo().hasAnonymousAddress()) {
epr = messageContext.getTo();
@@ -110,13 +113,15 @@
if (epr != null) {
if (!epr.hasNoneAddress()) {
+ mailToInfo = new MailToInfo(epr);
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(mailToInfo.getEmailAddress()));
} else {
if (from != null) {
+ mailToInfo = new MailToInfo(from);
msg.addRecipient(Message.RecipientType.TO,
- new InternetAddress(from.getAddress()));
+ new InternetAddress(mailToInfo.getEmailAddress()));
} else {
String error = EMailSender.class.getName() + "Couldn't countinue due to" +
" FROM addressing is NULL";
@@ -126,10 +131,10 @@
}
} else {
// replyto : from : or reply-path;
- if (messageContext.isServerSide()) {
if (from != null) {
+ mailToInfo = new MailToInfo(from);
msg.addRecipient(Message.RecipientType.TO,
- new InternetAddress(from.getAddress()));
+ new InternetAddress(mailToInfo.getEmailAddress()));
} else {
String error = EMailSender.class.getName() + "Couldn't countinue due to" +
" FROM addressing is NULL and EPR is NULL";
@@ -138,20 +143,22 @@
}
}
- }
msg.setSubject("__ Axis2/Java Mail Message __");
if (mailToInfo.isxServicePath()) {
- msg.setHeader("X-Service-Path", "\"" + mailToInfo.getContentDescription() + "\"");
+ msg.setHeader(Constants.X_SERVICE_PATH,
+ "\"" + mailToInfo.getContentDescription() + "\"");
}
if (inReplyTo != null) {
- msg.setHeader("In-Reply-To", inReplyTo);
+ msg.setHeader(Constants.IN_REPLY_TO, inReplyTo);
}
createMailMimeMessage(msg, mailToInfo, format);
Transport.send(msg);
+
+ sendReceive(messageContext, msg.getMessageID());
} catch (AddressException e) {
throw AxisFault.makeFault(e);
} catch (MessagingException e) {
@@ -215,5 +222,22 @@
public void setFrom(EndpointReference from) {
this.from = from;
+ }
+
+ public void setFormat(OMOutputFormat format) {
+ this.format = format;
+ }
+
+ private void sendReceive(MessageContext msgContext, String msgId) throws AxisFault {
+ Object obj = msgContext.getProperty(Constants.MAIL_SYNC);
+ if (obj == null) {
+ return;
+ }
+
+ Options options = msgContext.getOptions();
+
+ SynchronousMailListener listener =
+ new SynchronousMailListener(options.getTimeOutInMilliSeconds());
+ listener.sendReceive(msgContext, msgId);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailToInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailToInfo.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailToInfo.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailToInfo.java Mon Apr 16 09:15:48 2007
@@ -14,6 +14,8 @@
* limitations under the License.
*/
package org.apache.axis2.transport.mail;
+
+import org.apache.axis2.addressing.EndpointReference;
/*
*
*/
@@ -22,7 +24,36 @@
private String emailAddress;
private String contentDescription;
private boolean xServicePath;
- private String fromAddress;
+
+ public MailToInfo(String eprAddress) {
+ //URl validation according to rfc : http://www.ietf.org/rfc/rfc2368.txt
+
+ int mailToIndex = eprAddress.indexOf(Constants.MAILTO+":");
+ if (mailToIndex > -1) {
+ eprAddress = eprAddress.substring(mailToIndex + 7);
+ }
+ int index = eprAddress.indexOf('?');
+
+ if (index > -1) {
+ emailAddress = eprAddress.substring(0, index);
+ } else {
+ emailAddress = eprAddress;
+ }
+
+ if (eprAddress.indexOf(Constants.X_SERVICE_PATH) > -1) {
+ index = eprAddress.indexOf('=');
+ if (index > -1) {
+ xServicePath = true;
+ contentDescription = eprAddress.substring(index + 1);
+ }
+ } else {
+ contentDescription = eprAddress.substring(index + 1);
+
+ }
+ }
+ public MailToInfo(EndpointReference epr) {
+ this(epr.getAddress());
+ }
public String getEmailAddress() {
return emailAddress;
@@ -48,11 +79,4 @@
this.xServicePath = xServicePath;
}
- public String getFromAddress() {
- return fromAddress;
- }
-
- public void setFromAddress(String fromAddress) {
- this.fromAddress = fromAddress;
- }
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java?view=diff&rev=529306&r1=529305&r2=529306
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java Mon Apr 16 09:15:48 2007
@@ -115,10 +115,6 @@
private PasswordAuthentication passwordAuthentication;
private ByteArrayOutputStream byteArrayOutputStream;
- // assosiation with OMOutputFormat
- private final OMOutputFormat format = new OMOutputFormat();
-
- private final MailToInfo mailToInfo = new MailToInfo();
private final static String NAME = "MailTransportSender";
@@ -152,9 +148,6 @@
if (paramKey.equals(Constants.SMTP_USER_PASSWORD)) {
password = paramValue;
}
- if (paramKey.equals(Constants.RAPLY_TO)) {
- mailToInfo.setFromAddress(paramValue);
- }
}
passwordAuthentication = new PasswordAuthentication(username, password);
@@ -164,7 +157,7 @@
public void cleanup(MessageContext msgContext) throws AxisFault {
}
- private void runtimeMailParameterSetting(MessageContext msgContext) {
+ private void mailProperties(MessageContext msgContext) {
Object obj = msgContext.getProperty(Constants.MAIL_SMTP);
if (obj != null) {
// Overide the axis2.xml cofiguration setting
@@ -176,6 +169,10 @@
String username = (String) smtpProperties.get(Constants.SMTP_USER);
String passwd = props.getPassword();
passwordAuthentication = new PasswordAuthentication(username, passwd);
+ } else if (obj instanceof java.util.Properties) {
+ smtpProperties.clear();
+ java.util.Properties props = (java.util.Properties) obj;
+ smtpProperties.putAll(props);
}
}
@@ -184,7 +181,7 @@
public void sendMimeMessage(MessageContext msgContext) throws AxisFault {
try {
// Override with runtime settings
- runtimeMailParameterSetting(msgContext);
+ mailProperties(msgContext);
EMailSender sender = new EMailSender();
sender.setOutputStream(byteArrayOutputStream);
@@ -197,14 +194,13 @@
(String) msgContext.getProperty(
org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING);
if (charSet == null) {
- charSet =
- MessageContext.DEFAULT_CHAR_SET_ENCODING;// Since we are deleaing only SOAP and XML messages here
+ charSet = MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
- format.setSOAP11(msgContext.isSOAP11());
- format.setCharSetEncoding(charSet);
- parseMailToAddress(msgContext.getTo());
+ OMOutputFormat format = new OMOutputFormat();
+ format.setSOAP11(msgContext.isSOAP11());
+ format.setCharSetEncoding(charSet);
// Check if msg is 'In-Reply-To' received message
OutTransportInfo transportInfo = (OutTransportInfo) msgContext
.getProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO);
@@ -216,50 +212,15 @@
sender.setInReplyTo(mailTransportInfo.getInReplyTo());
sender.setFrom(mailTransportInfo.getFrom());
}
+ sender.setFormat(format);
- sender.send(mailToInfo, format);
+ sender.send();
} catch (IOException e) {
throw AxisFault.makeFault(e);
}
}
- private void parseMailToAddress(EndpointReference epr) {
- String eprAddress = epr.getAddress();
- //TODO URl validation according to rfc : http://www.ietf.org/rfc/rfc2368.txt
-
- int mailToIndex = eprAddress.indexOf("mailto:");
- if (mailToIndex > -1) {
- eprAddress = eprAddress.substring(mailToIndex + 7);
- }
- int index = eprAddress.indexOf('?');
- String contentDescription = "";
- String email;
- boolean xServicePath = false;
-
-
- if (index > -1) {
- email = eprAddress.substring(0, index);
- } else {
- email = eprAddress;
- }
-
- if (eprAddress.indexOf("x-service-path".toLowerCase()) > -1) {
- index = eprAddress.indexOf('=');
- if (index > -1) {
- xServicePath = true;
- contentDescription = eprAddress.substring(index + 1);
- }
- } else {
- contentDescription = eprAddress.substring(index + 1);
-
- }
- mailToInfo.setContentDescription(contentDescription);
- mailToInfo.setEmailAddress(email);
- mailToInfo.setxServicePath(xServicePath);
-
- }
-
public void writeMimeMessage(MessageContext msgContext, OutputStream out) throws AxisFault {
try {
OMOutputFormat format = new OMOutputFormat();
@@ -279,8 +240,6 @@
}
/**
- * TODO
- *
* @param msgContext
* @return
* @throws AxisFault
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org