You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/17 22:34:13 UTC
svn commit: r1818518 [24/30] - in /axis/axis2/java/core/branches/AXIS2-4091:
./ apidocs/ databinding-tests/ etc/ legal/ modules/adb-codegen/
modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/ modu...
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojo.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojo.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojo.java Sun Dec 17 22:34:08 2017
@@ -19,48 +19,20 @@
package org.apache.axis2.maven2.wsdl2code;
-import org.apache.axis2.util.CommandLineOption;
-import org.apache.axis2.util.CommandLineOptionConstants;
-import org.apache.axis2.util.CommandLineOptionParser;
-import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
-import org.apache.axis2.wsdl.codegen.CodeGenerationException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-
import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
+import org.apache.maven.project.MavenProject;
/**
- * @description A Mojo for generating Java sources from a WSDL.
+ * Generates source code from a WSDL.
+ *
* @goal wsdl2code
* @phase generate-sources
- * @requiresDependencyResolution test
+ * @deprecated This goal is identical to axis2-wsdl2code:generate-sources; either switch to that
+ * goal or use the new axis2-wsdl2code:generate-test-sources goal if you need to
+ * generate code for use in unit tests only.
*/
-public class WSDL2CodeMojo extends AbstractMojo {
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @read-only
- * @required
- */
- private MavenProject project;
-
- /**
- * The WSDL file, which is being read.
- *
- * @parameter expression="${axis2.wsdl2code.wsdlFile}" default-value="src/main/resources/service.wsdl"
- */
- private String wsdlFile;
-
+public class WSDL2CodeMojo extends GenerateSourcesMojo {
/**
* The output directory, where the generated sources are being created.
*
@@ -68,597 +40,13 @@ public class WSDL2CodeMojo extends Abstr
*/
private File outputDirectory;
- /**
- * Package name of the generated sources; will be used to create a package structure below the
- * output directory.
- *
- * @parameter expression="${axis2.wsdl2code.package}" *
- */
- private String packageName;
-
- /**
- * The programming language of the generated sources.
- *
- * @parameter expression="${axis2.wsdl2code.language}" default-value="java"
- */
- private String language;
-
- /**
- * The databinding framework, which is being used.
- *
- * @parameter expression="${axis2.wsdl2code.databindingName}" default-value="adb"
- */
- private String databindingName;
-
- /**
- * The binding file for JiBX databinding.
- *
- * @parameter expression="${axis2.wsdl2code.jibxBindingFile}"
- */
- private String jibxBindingFile;
-
- /**
- * Port name, for which to generate sources. By default, sources will be generated for all
- * ports.
- *
- * @parameter expression="${axis2.wsdl2code.portName}"
- */
- private String portName;
-
- /**
- * Service name, for which to generate sources. By default, sources will be generated for all
- * services.
- *
- * @parameter expression="${axis2.wsdl2code.serviceName}"
- */
- private String serviceName;
-
- /**
- * Mode, for which sources are being generated; either of "sync", "async" or "both".
- *
- * @parameter expression="${axis2.wsdl2code.syncMode}" default-value="both"
- */
- private String syncMode;
-
- /**
- * Whether server side sources are being generated.
- *
- * @parameter expression="${axis2.wsdl2code.generateServerSide}" default-value="false"
- */
- private boolean generateServerSide;
-
- /**
- * Whether to generate sources for a test case.
- *
- * @parameter expression="${axis2.wsdl2code.generateTestCase}" default-value="false"
- */
- private boolean generateTestcase;
-
- /**
- * Whether to generate a "services.xml" file.
- *
- * @parameter expression="${axis2.wsdl2code.generateServicesXml}" default-value="false"
- */
- private boolean generateServicesXml;
-
- /**
- * Whether to generate simply all classes. This is only valid in conjunction with
- * "generateServerSide".
- *
- * @parameter expression="${axis2.wsdl2code.generateAllClasses}" default-value="false"
- */
- private boolean generateAllClasses;
-
- /**
- * Whether to unpack classes.
- *
- * @parameter expression="${axis2.wsdl2code.unpackClasses}" default-value="false"
- */
- private boolean unpackClasses;
-
- /**
- * Whether to generate the server side interface.
- *
- * @parameter expression="${axis2.wsdl2code.generateServerSideInterface}" default-value="false"
- */
- private boolean generateServerSideInterface = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.repositoryPath}"
- */
- private String repositoryPath = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.externalMapping}"
- */
- private String externalMapping = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.wsdlVersion}"
- */
- private String wsdlVersion = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.targetSourceFolderLocation}" default-value="src"
- */
- private String targetSourceFolderLocation;
-
- /**
- * @parameter expression="${axis2.wsdl2code.targetResourcesFolderLocation}"
- */
- private String targetResourcesFolderLocation = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.unwrap}" default-value="false" *
- */
- private boolean unwrap = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.allPorts}" default-value="false" *
- */
- private boolean allPorts = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.backwardCompatible}" default-value="false" *
- */
- private boolean backwardCompatible = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.flattenFiles}" default-value="false" *
- */
- private boolean flattenFiles = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.skipMessageReceiver}" default-value="false" *
- */
- private boolean skipMessageReceiver = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.skipBuildXML}" default-value="false" *
- */
- private boolean skipBuildXML = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.skipWSDL}" default-value="false" *
- */
- private boolean skipWSDL = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.overWrite}" default-value="false" *
- */
- private boolean overWrite = false;
-
- /**
- * @parameter expression="${axis2.wsdl2code.suppressPrefixes}" default-value="false" *
- */
- private boolean suppressPrefixes = false;
-
- /**
- * Specify databinding specific extra options
- *
- * @parameter expression="${axis2.java2wsdl.options}"
- */
- private Properties options;
-
- /** @parameter expression="${axis2.wsdl2code.namespaceToPackages}" */
- private String namespaceToPackages = null;
-
- /** @parameter */
- private NamespaceURIMapping[] namespaceURIs = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.http-proxy-host}"
- */
- private String httpProxyHost = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.http-proxy-port}"
- */
- private String httpProxyPort = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.http-proxy-user}"
- */
- private String httpProxyUser = null;
-
- /**
- * @parameter expression="${axis2.wsdl2code.http-proxy-password}"
- */
- private String httpProxyPassword = null;
-
- /** Fills the option map. This map is passed onto the code generation API to generate the code. */
- private Map<String,CommandLineOption> fillOptionMap() throws MojoFailureException {
- Map<String,CommandLineOption> optionMap = new HashMap<String,CommandLineOption>();
-
- ////////////////////////////////////////////////////////////////
- //WSDL file name
- // here we need to set the project base uri to relative paths.
- if (wsdlFile.indexOf(":") == -1){
- //i.e this is not a uri
- File file = new File(wsdlFile);
- if (!file.isAbsolute()){
- wsdlFile = project.getBasedir() + File.separator + wsdlFile;
- }
- }
-
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
- getStringArray(wsdlFile)));
- //output location
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
- getStringArray(outputDirectory.getPath())));
- //////////////////////////////////////////////////////////////////
- // Databinding type
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
- getStringArray(databindingName)));
-
- if ("jibx".equals(databindingName)) {
- String key = CommandLineOptionConstants.WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX
- + org.apache.axis2.wsdl.codegen.extension.JiBXExtension.BINDING_PATH_OPTION;
- optionMap.put(key, new CommandLineOption(key, getStringArray(jibxBindingFile)));
- }
-
- if ("async".equals(syncMode)) {
- // Async only option - forcing to generate async methods only
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
- new String[0]));
- } else if ("sync".equals(syncMode)) {
- // Sync only option - forcing to generate Sync methods only
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
- new String[0]));
- } else if ("both".equals(syncMode)) {
- // Do nothing
- } else {
- throw new MojoFailureException("Invalid syncMode: " + syncMode +
- ", expected either of 'sync', 'async' or 'both'.");
- }
-
- //Package
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
- getStringArray(packageName)));
-
- //stub language
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
- getStringArray(language)));
-
- //server side and generate services.xml options
- if (generateServerSide) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
- new String[0]));
-
- //services XML generation - effective only when specified as the server side
- if (generateServicesXml) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants
- .GENERATE_SERVICE_DESCRIPTION_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants
- .GENERATE_SERVICE_DESCRIPTION_OPTION,
- new String[0]));
- }
- //generate all option - Only valid when generating serverside code
- if (generateAllClasses) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
- new String[0]));
- }
-
- }
-
- //generate the test case
- if (generateTestcase) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
- new String[0]));
- }
-
- //Unwrap classes option - this determines whether the generated classes are inside the stub/MR
- //or gets generates as seperate classes
- if (unpackClasses) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
- new String[0]));
- }
-
- //server side interface option
- if (generateServerSideInterface) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
- new String[0]));
- }
-
- if (unwrap) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.UNWRAP_PARAMETERS,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.UNWRAP_PARAMETERS,
- new String[0]));
- }
-
- if (allPorts) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.All_PORTS_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.All_PORTS_OPTION,
- new String[0]));
- }
-
- if (backwardCompatible) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION,
- new String[0]));
- }
-
- if (flattenFiles) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.FLATTEN_FILES_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.FLATTEN_FILES_OPTION,
- new String[0]));
- }
-
- if (skipMessageReceiver) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG,
- new String[0]));
- }
-
- if (skipBuildXML) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG,
- new String[0]));
- }
-
- if (skipWSDL) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_WSDLS_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.NO_WSDLS_OPTION_LONG,
- new String[0]));
- }
-
- if (overWrite) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.OVERRIDE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.OVERRIDE_OPTION,
- new String[0]));
- }
-
- if (suppressPrefixes) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION,
- new String[0]));
- }
-
- if (repositoryPath != null) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.REPOSITORY_PATH_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.REPOSITORY_PATH_OPTION,
- new String[]{repositoryPath}));
- }
-
- if (externalMapping != null) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION,
- new String[]{externalMapping}));
- }
-
- if (wsdlVersion != null) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION,
- new String[]{wsdlVersion}));
- }
-
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION,
- new String[]{targetSourceFolderLocation}));
-
- if (targetResourcesFolderLocation != null) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.RESOURCE_FOLDER_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.RESOURCE_FOLDER_OPTION,
- new String[]{targetResourcesFolderLocation}));
- }
-
- if(options != null) {
- for (Map.Entry<?,?> entry : options.entrySet()) {
- String key = CommandLineOptionConstants.WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX + entry.getKey();
- String value = (String) entry.getValue();
- optionMap.put(
- key,
- new CommandLineOption(
- key,
- new String[]{value}));
- }
- }
-
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
- new String[] { serviceName }));
-
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
- new String[] { portName }));
- // set the namespaces
- if (!((namespaceToPackages == null) && (namespaceURIs == null))) {
- optionMap.put(
- CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
- new String[] { getNamespaceToPackagesMap() }));
- }
-
- if (httpProxyHost != null) {
- optionMap
- .put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG,
- new String[] { httpProxyHost }));
- }
-
- if (httpProxyPort != null) {
- optionMap
- .put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG,
- new String[] { httpProxyPort }));
- }
-
- if (httpProxyUser != null) {
- optionMap
- .put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_USER_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_USER_OPTION_LONG,
- new String[] { httpProxyUser }));
- }
-
- if (httpProxyPassword != null) {
- optionMap
- .put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PASSWORD_OPTION_LONG,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PASSWORD_OPTION_LONG,
- new String[] { httpProxyPassword }));
- }
-
- return optionMap;
- }
-
- private String getNamespaceToPackagesMap() throws MojoFailureException {
- StringBuffer sb = new StringBuffer();
- if (namespaceToPackages != null) {
- sb.append(namespaceToPackages);
- }
- if (namespaceURIs != null) {
- for (int i = 0; i < namespaceURIs.length; i++) {
- NamespaceURIMapping mapping = namespaceURIs[i];
- String uri = mapping.getUri();
- if (uri == null) {
- throw new MojoFailureException(
- "A namespace to package mapping requires an uri child element.");
- }
- String uriPackageName = mapping.getPackageName();
- if (uriPackageName == null) {
- throw new MojoFailureException(
- "A namespace to package mapping requires a packageName child element.");
- }
- if (sb.length() > 0) {
- sb.append(",");
- }
- sb.append(uri);
- sb.append('=');
- sb.append(uriPackageName);
- }
- }
- return (sb.length() != 0) ? sb.toString() : null;
+ @Override
+ protected File getOutputDirectory() {
+ return outputDirectory;
}
- /**
- * Utility method to convert a string into a single item string[]
- *
- * @param value
- * @return Returns String[].
- */
- private String[] getStringArray(String value) {
- String[] values = new String[1];
- values[0] = value;
- return values;
- }
-
- public void execute() throws MojoFailureException, MojoExecutionException {
-
- fixCompileSourceRoots();
- showDependencies();
-
- Map<String,CommandLineOption> commandLineOptions = this.fillOptionMap();
- CommandLineOptionParser parser =
- new CommandLineOptionParser(commandLineOptions);
- try {
- new CodeGenerationEngine(parser).generate();
- } catch (CodeGenerationException e) {
- Throwable t = e;
- while (t.getCause() != null) {
- t = t.getCause();
- }
- t.printStackTrace();
- throw new MojoExecutionException(e.getMessage(), e);
- }
- }
-
- private void showDependencies() {
- Log log = getLog();
- if (!log.isDebugEnabled()) {
- return;
- }
- log.debug("The projects dependency artifacts are: ");
- for (Iterator<?> iter = project.getDependencyArtifacts().iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact)iter.next();
- log.debug(" " + artifact.getGroupId() + ":" + artifact.getArtifactId() +
- ":" + artifact.getVersion() + ":" + artifact.getClassifier() +
- ":" + artifact.getScope() + ":" + artifact.getType());
- }
- log.debug("The projects transitive artifacts are: ");
- for (Iterator<?> iter = project.getArtifacts().iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact)iter.next();
- log.debug(" " + artifact.getGroupId() + ":" + artifact.getArtifactId() +
- ":" + artifact.getVersion() + ":" + artifact.getClassifier() +
- ":" + artifact.getScope() + ":" + artifact.getType());
- }
- }
-
- private void fixCompileSourceRoots() {
- File srcDir = new File(outputDirectory, targetSourceFolderLocation);
+ @Override
+ protected void addSourceRoot(MavenProject project, File srcDir) {
project.addCompileSourceRoot(srcDir.getPath());
- }
+ }
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/site/site.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/site/site.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/site/site.xml Sun Dec 17 22:34:08 2017
@@ -19,28 +19,15 @@
~ under the License.
-->
-<project name="Maven Axis 2 WSDL2Code Plugin">
- <bannerLeft>
- <name>Maven Axis 2 WSDL2Code Plugin</name>
- <src>http://maven.apache.org/images/apache-maven-project.png</src>
- <href>http://maven.apache.org/</href>
- </bannerLeft>
- <bannerRight>
- <src>http://maven.apache.org/images/maven-small.gif</src>
- </bannerRight>
- <body>
- <links>
- <item name="Apache" href="http://www.apache.org/"/>
- <item name="Webservices" href="http://ws.apache.org/"/>
- <item name="Axis 2" href="http://ws.apache.org/axis2/"/>
- <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
- </links>
-
- <menu name="Overview">
- <item name="Introduction" href="introduction.html"/>
- <item name="How to Use" href="howto.html"/>
- <item name="Configuration" href="configuration.html"/>
- </menu>
- ${reports}
- </body>
+<project name="axis2-wsdl2code-maven-plugin">
+ <body>
+ <menu name="Overview">
+ <item name="About" href="index.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="Plugin Documentation" href="plugin-info.html">
+ <item name="generate-sources" href="generate-sources-mojo.html"/>
+ <item name="generate-test-sources" href="generate-test-sources-mojo.html"/>
+ </item>
+ </menu>
+ </body>
</project>
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/resources/log4j.properties?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/resources/log4j.properties (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/axis2-wsdl2code-maven-plugin/src/test/resources/log4j.properties Sun Dec 17 22:34:08 2017
@@ -24,7 +24,6 @@ log4j.rootCategory=INFO, CONSOLE
# Set the enterprise logger priority to FATAL
log4j.logger.org.apache.axis2.enterprise=FATAL
-log4j.logger.de.hunsicker.jalopy.io=FATAL
log4j.logger.httpclient.wire.header=FATAL
log4j.logger.org.apache.commons.httpclient=FATAL
Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/simple-server-maven-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Dec 17 22:34:08 2017
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/tool/simple-server-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/tool/simple-server-maven-plugin/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/tool/simple-server-maven-plugin/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/tool/simple-server-maven-plugin/pom.xml Sun Dec 17 22:34:08 2017
@@ -19,14 +19,13 @@
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-parent</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
+ <artifactId>axis2</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>simple-server-maven-plugin</artifactId>
<name>Apache Axis2 Simple HTTP server Maven Plugin</name>
@@ -70,21 +69,50 @@
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <!-- Maven supports SLF4J -->
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
</dependency>
</dependencies>
</project>
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/pom.xml Sun Dec 17 22:34:08 2017
@@ -22,9 +22,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-parent</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
+ <artifactId>axis2</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<groupId>org.apache.axis2</groupId>
@@ -45,7 +45,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextFormatter.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextFormatter.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextFormatter.java Sun Dec 17 22:34:08 2017
@@ -24,7 +24,6 @@ import org.apache.axis2.context.MessageC
import org.apache.axis2.AxisFault;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
import org.apache.axis2.transport.base.BaseConstants;
import java.io.ByteArrayOutputStream;
@@ -35,7 +34,6 @@ import java.io.Writer;
import java.net.URL;
import javax.activation.DataSource;
-import javax.xml.stream.XMLStreamException;
public class PlainTextFormatter implements MessageFormatterEx {
@@ -50,12 +48,10 @@ public class PlainTextFormatter implemen
if (BaseConstants.DEFAULT_TEXT_WRAPPER.equals(textElt.getQName())) {
try {
Writer out = new OutputStreamWriter(outputStream, format.getCharSetEncoding());
- ElementHelper.writeTextTo(textElt, out, preserve);
+ textElt.writeTextTo(out, preserve);
out.flush();
} catch (IOException e) {
throw new AxisFault("Error writing text message to stream", e);
- } catch (XMLStreamException e) {
- throw new AxisFault("Error extracting the text payload from the message", e);
}
}
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextFromElementDataSource.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextFromElementDataSource.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextFromElementDataSource.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/format/TextFromElementDataSource.java Sun Dec 17 22:34:08 2017
@@ -25,7 +25,6 @@ import java.io.OutputStream;
import javax.activation.DataSource;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
import org.apache.commons.io.input.ReaderInputStream;
/**
@@ -57,7 +56,7 @@ public class TextFromElementDataSource i
}
public InputStream getInputStream() throws IOException {
- return new ReaderInputStream(ElementHelper.getTextAsStream(element, true), charset);
+ return new ReaderInputStream(element.getTextAsStream(true), charset);
}
public OutputStream getOutputStream() throws IOException {
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java Sun Dec 17 22:34:08 2017
@@ -21,10 +21,6 @@ package org.apache.axis2.transport.base;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
@@ -39,8 +35,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -96,24 +90,6 @@ public class BaseUtils {
}
/**
- * Create a SOAP envelope using SOAP 1.1 or 1.2 depending on the namespace
- * @param in InputStream for the payload
- * @param namespace the SOAP namespace
- * @return the SOAP envelope for the correct version
- * @throws javax.xml.stream.XMLStreamException on error
- */
- public static SOAPEnvelope getEnvelope(InputStream in, String namespace) throws XMLStreamException {
-
- try {
- in.reset();
- } catch (IOException ignore) {}
- XMLStreamReader xmlreader =
- StAXUtils.createXMLStreamReader(in, MessageContext.DEFAULT_CHAR_SET_ENCODING);
- StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, namespace);
- return (SOAPEnvelope) builder.getDocumentElement();
- }
-
- /**
* Get the OMOutput format for the given message
* @param msgContext the axis message context
* @return the OMOutput format to be used
@@ -271,6 +247,12 @@ public class BaseUtils {
String msg = "Error loading properties from a file at :" + filePath;
log.error(msg, e);
throw new BaseTransportException(msg, e);
+ } finally {
+ try {
+ in.close();
+ } catch (IOException ex) {
+ // Ignore
+ }
}
}
return properties;
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointFactory.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointFactory.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointFactory.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointFactory.java Sun Dec 17 22:34:08 2017
@@ -60,10 +60,10 @@ public class URLEndpointFactory {
}
}
- Iterator it = messageBuilders.getChildrenWithName(
+ Iterator<OMElement> it = messageBuilders.getChildrenWithName(
new QName(URLEndpointsConfiguration.MESSAGE_BUILDER));
while(it.hasNext()) {
- OMElement builderElement = (OMElement) it.next();
+ OMElement builderElement = it.next();
OMAttribute contentTypeAttr = builderElement.getAttribute(
new QName(URLEndpointsConfiguration.CONTENT_TYPE));
@@ -90,10 +90,10 @@ public class URLEndpointFactory {
}
}
- Iterator paramItr = xml.getChildrenWithName(
+ Iterator<OMElement> paramItr = xml.getChildrenWithName(
new QName(URLEndpointsConfiguration.PARAMETER));
while (paramItr.hasNext()) {
- OMElement p = (OMElement) paramItr.next();
+ OMElement p = paramItr.next();
OMAttribute paramNameAttr = p.getAttribute(new QName(URLEndpointsConfiguration.NAME));
if (paramNameAttr == null) {
handleException("Parameter " + URLEndpointsConfiguration.NAME + " cannot be null");
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointsConfigurationFactory.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointsConfigurationFactory.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointsConfigurationFactory.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/base/src/main/java/org/apache/axis2/transport/base/endpoint/config/URLEndpointsConfigurationFactory.java Sun Dec 17 22:34:08 2017
@@ -37,11 +37,11 @@ public class URLEndpointsConfigurationFa
private static final Log log = LogFactory.getLog(URLEndpointsConfigurationFactory.class);
public URLEndpointsConfiguration create(OMElement element) throws AxisFault {
- Iterator iterator = element.getChildrenWithName(new QName(URLEndpointsConfiguration.ENDPOINT));
+ Iterator<OMElement> iterator = element.getChildrenWithName(new QName(URLEndpointsConfiguration.ENDPOINT));
URLEndpointsConfiguration configuration = new URLEndpointsConfiguration();
URLEndpointFactory fac = new URLEndpointFactory();
while (iterator.hasNext()) {
- OMElement endpoint = (OMElement) iterator.next();
+ OMElement endpoint = iterator.next();
URLEndpoint epr = fac.create(endpoint);
configuration.addEndpoint(epr);
@@ -63,11 +63,11 @@ public class URLEndpointsConfigurationFa
OMElement element = OMXMLBuilderFactory.createOMBuilder(is).getDocumentElement();
element.build();
- Iterator iterator = element.getChildrenWithName(new QName(URLEndpointsConfiguration.ENDPOINT));
+ Iterator<OMElement> iterator = element.getChildrenWithName(new QName(URLEndpointsConfiguration.ENDPOINT));
URLEndpointsConfiguration configuration = new URLEndpointsConfiguration();
URLEndpointFactory fac = new URLEndpointFactory();
while (iterator.hasNext()) {
- OMElement endpoint = (OMElement) iterator.next();
+ OMElement endpoint = iterator.next();
URLEndpoint epr = fac.create(endpoint);
configuration.addEndpoint(epr);
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/pom.xml Sun Dec 17 22:34:08 2017
@@ -23,14 +23,14 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-parent</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
+ <artifactId>axis2</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>axis2-transport-http</artifactId>
<name>Apache Axis2 - Transport - HTTP</name>
<description>This inclues all the available transports in Axis2</description>
- <packaging>bundle</packaging>
+ <packaging>jar</packaging>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/transport/http</connection>
@@ -62,20 +62,14 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
- <Bundle-Description>${project.description}</Bundle-Description>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.axis2.transport.http.*;-split-package:=merge-last,
- </Export-Package>
- </instructions>
- </configuration>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
<resources>
@@ -103,31 +97,28 @@
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-testkit</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-truth</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java Sun Dec 17 22:34:08 2017
@@ -56,7 +56,8 @@ public class AbstractAgent {
throws IOException, ServletException {
- String requestURI = httpServletRequest.getRequestURI();
+ // Don't use getRequestURI() here because it includes the session ID
+ String requestURI = httpServletRequest.getServletPath() + httpServletRequest.getPathInfo();
String operation;
int i = requestURI.lastIndexOf('/');
@@ -116,7 +117,7 @@ public class AbstractAgent {
HttpServletResponse httpServletResponse)
throws IOException, ServletException {
httpServletResponse.setContentType("text/html");
- httpServletRequest.getRequestDispatcher(Constants.AXIS_WEB_CONTENT_ROOT + jspName)
+ httpServletRequest.getRequestDispatcher("/WEB-INF/views/" + jspName)
.include(httpServletRequest, httpServletResponse);
}
@@ -151,9 +152,8 @@ public class AbstractAgent {
}
}
- protected void populateSessionInformation(HttpServletRequest req) {
- HashMap services = configContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
+ protected void populateRequestAttributes(HttpServletRequest req) {
+ req.setAttribute("configContext", configContext);
+ req.setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
}
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java Sun Dec 17 22:34:08 2017
@@ -19,16 +19,14 @@
package org.apache.axis2.transport.http;
+import org.apache.axiom.blob.Blobs;
+import org.apache.axiom.blob.MemoryBlob;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.util.JavaUtils;
-import javax.xml.stream.FactoryConfigurationError;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;
@@ -36,65 +34,80 @@ import java.util.zip.GZIPOutputStream;
* This Request Entity is used by the HTTPCommonsTransportSender. This wraps the
* Axis2 message formatter object.
*/
-public abstract class AxisRequestEntity {
+public final class AxisRequestEntity {
private MessageFormatter messageFormatter;
- private boolean chunked = false;
+ private final boolean chunked;
+
+ private final boolean gzip;
private MessageContext messageContext;
- private byte[] bytes;
+ private final MemoryBlob content;
- private boolean isAllowedRetry;
+ private final boolean preserve;
private OMOutputFormat format;
- private String soapAction;
+ private final String contentType;
/**
* Method calls to this request entity are delegated to the following Axis2
* message formatter object.
*
* @param messageFormatter
+ * @throws AxisFault
*/
- public AxisRequestEntity(MessageFormatter messageFormatter,
- MessageContext msgContext, OMOutputFormat format, String soapAction,
- boolean chunked, boolean isAllowedRetry) {
+ AxisRequestEntity(MessageFormatter messageFormatter,
+ MessageContext msgContext, OMOutputFormat format, String contentType,
+ boolean chunked, boolean gzip, boolean preserve) throws AxisFault {
this.messageFormatter = messageFormatter;
this.messageContext = msgContext;
this.chunked = chunked;
- this.isAllowedRetry = isAllowedRetry;
+ this.gzip = gzip;
+ this.preserve = preserve;
this.format = format;
- this.soapAction = soapAction;
+ this.contentType = contentType;
+ if (chunked) {
+ content = null;
+ } else {
+ content = Blobs.createMemoryBlob();
+ OutputStream out = content.getOutputStream();
+ try {
+ internalWriteRequest(out);
+ out.close();
+ } catch (IOException ex) {
+ throw AxisFault.makeFault(ex);
+ }
+ }
}
public boolean isRepeatable() {
- // All Axis2 request entity implementations were returning this true
- // So we return true as defualt
- return true;
+ // If chunking is disabled, we don't preserve the original SOAPEnvelope, but we store the
+ // serialized SOAPEnvelope in a byte array, which means that the entity can be written
+ // repeatedly.
+ return preserve || !chunked;
}
public void writeRequest(OutputStream outStream) throws IOException {
- Object gzip = messageContext.getOptions().getProperty(HTTPConstants.MC_GZIP_REQUEST);
- if (gzip != null && JavaUtils.isTrueExplicitly(gzip) && chunked) {
+ if (chunked) {
+ internalWriteRequest(outStream);
+ } else {
+ content.writeTo(outStream);
+ }
+ }
+
+ private void internalWriteRequest(OutputStream outStream) throws IOException {
+ if (gzip) {
outStream = new GZIPOutputStream(outStream);
}
try {
- if (chunked) {
- messageFormatter.writeTo(messageContext, format, outStream, isAllowedRetry);
- } else {
- if (bytes == null) {
- bytes = messageFormatter.getBytes(messageContext, format);
- }
- outStream.write(bytes);
- }
- if (outStream instanceof GZIPOutputStream) {
+ messageFormatter.writeTo(messageContext, format, outStream, preserve);
+ if (gzip) {
((GZIPOutputStream) outStream).finish();
}
outStream.flush();
- } catch (FactoryConfigurationError e) {
- throw AxisFault.makeFault(e);
} catch (IOException e) {
throw AxisFault.makeFault(e);
}
@@ -104,32 +117,16 @@ public abstract class AxisRequestEntity
public long getContentLength() {
if (chunked) {
return -1;
+ } else {
+ return content.getSize();
}
- if (bytes == null) {
- try {
- bytes = messageFormatter.getBytes(messageContext, format);
- } catch (AxisFault e) {
- return -1;
- }
- }
- return bytes.length;
}
- public String getContentTypeAsString() {
- return messageFormatter.getContentType(messageContext, format, soapAction);
+ public String getContentType() {
+ return contentType;
}
public boolean isChunked() {
return chunked;
}
-
- public void setChunked(boolean chunked) {
- this.chunked = chunked;
- }
-
- public InputStream getRequestEntityContent() throws IOException {
- return new ByteArrayInputStream(messageFormatter.getBytes(messageContext, format));
- }
-
-
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java Sun Dec 17 22:34:08 2017
@@ -21,7 +21,7 @@
package org.apache.axis2.transport.http;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFaultCode;
@@ -52,7 +52,6 @@ import org.apache.axis2.transport.http.u
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.MessageContextBuilder;
import org.apache.axis2.util.OnDemandLogger;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -87,11 +86,11 @@ import java.util.concurrent.CountDownLat
*/
public class AxisServlet extends HttpServlet {
private static final long serialVersionUID = 3105135058353738906L;
-
+
static final OnDemandLogger log = new OnDemandLogger(AxisServlet.class);
public static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
public static final String SESSION_ID = "SessionId";
-
+
private static final Set<String> metadataQueryParamNames;
protected transient ConfigurationContext configContext;
@@ -108,9 +107,9 @@ public class AxisServlet extends HttpSer
private boolean closeReader = true;
private static final int BUFFER_SIZE = 1024 * 8;
-
+
private boolean initCalled = false;
-
+
private transient AxisServletListener httpListener;
private transient AxisServletListener httpsListener;
@@ -145,7 +144,7 @@ public class AxisServlet extends HttpSer
//set the initial buffer for a larger value
response.setBufferSize(BUFFER_SIZE);
-
+
preprocessRequest(request);
MessageContext msgContext;
@@ -157,9 +156,9 @@ public class AxisServlet extends HttpSer
try {
// adding ServletContext into msgContext;
String url = request.getRequestURL().toString();
-
+
OutputStream bufferedOut = new BufferedOutputStream(out);
-
+
InvocationResponse pi = HTTPTransportUtils.
processHTTPPostRequest(msgContext,
new BufferedInputStream(request.getInputStream()),
@@ -179,8 +178,8 @@ public class AxisServlet extends HttpSer
}
// if data has not been sent back and this is not a signal response
- if (!TransportUtils.isResponseWritten(msgContext)
- && (((RequestResponseTransport)
+ if (!TransportUtils.isResponseWritten(msgContext)
+ && (((RequestResponseTransport)
msgContext.getProperty(
RequestResponseTransport.TRANSPORT_CONTROL)).
getStatus() != RequestResponseTransport.
@@ -193,7 +192,7 @@ public class AxisServlet extends HttpSer
+ msgContext
.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
}
-
+
// Make sure that no data remains in the BufferedOutputStream even if the message
// formatter doesn't call flush
bufferedOut.flush();
@@ -363,7 +362,7 @@ public class AxisServlet extends HttpSer
try {
SOAPEnvelope envelope = messageContext.getEnvelope();
if(envelope != null) {
- StAXBuilder builder = (StAXBuilder) envelope.getBuilder();
+ OMXMLParserWrapper builder = envelope.getBuilder();
if (builder != null) {
builder.close();
}
@@ -458,7 +457,7 @@ public class AxisServlet extends HttpSer
*/
@Override
public void init(ServletConfig config) throws ServletException {
-
+
// prevent this method from being called more than once per instance
initCalled = true;
super.init(config);
@@ -516,9 +515,12 @@ public class AxisServlet extends HttpSer
"unreliable.");
}
- ListenerManager listenerManager = new ListenerManager();
- listenerManager.init(configContext);
- listenerManager.start();
+ // AXIS2-5673: Create a new ListenerManager only if configContext does not have one already.
+ if (configContext.getListenerManager() == null) {
+ ListenerManager listenerManager = new ListenerManager();
+ listenerManager.init(configContext);
+ listenerManager.start();
+ }
}
private AxisServletListener getAxisServletListener(String name) {
@@ -561,9 +563,13 @@ public class AxisServlet extends HttpSer
&& HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(clientVersion)) {
// TODO - Handle for HTTPClient 4
} else {
- MultiThreadedHttpConnectionManager.shutdownAll();
+ try {
+ Class.forName("org.apache.commons.httpclient.MultiThreadedHttpConnectionManager").getMethod("shutdownAll").invoke(null);
+ } catch (Exception ex) {
+ log.warn("Failed to shut down MultiThreadedHttpConnectionManager", ex);
+ }
}
-
+
}
private String getHTTPClientVersion() {
@@ -643,7 +649,7 @@ public class AxisServlet extends HttpSer
configContext.setContextRoot(contextRoot);
}
-
+
/**
* Preprocess the request. This will:
* <ul>
@@ -653,7 +659,7 @@ public class AxisServlet extends HttpSer
* <li>Reject the request if no {@link AxisServletListener} has been registered for the
* protocol.
* </ul>
- *
+ *
* @param req the request to preprocess
*/
// This method should not be part of the public API. In particular we must not allow subclasses
@@ -677,7 +683,7 @@ public class AxisServlet extends HttpSer
}
}
}
-
+
}
/**
@@ -744,13 +750,9 @@ public class AxisServlet extends HttpSer
msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request));
msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request);
msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, response);
- try {
- ServletContext context = getServletContext();
- if(context != null) {
- msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context);
- }
- } catch (Exception e){
- log.debug(e.getMessage(), e);
+ ServletContext context = getServletContext();
+ if(context != null) {
+ msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context);
}
//setting the RequestResponseTransport object
@@ -812,15 +814,15 @@ public class AxisServlet extends HttpSer
faultToBeThrownOut = fault;
signalResponseReady();
}
-
+
public boolean isResponseWritten() {
return responseWritten;
}
-
+
public void setResponseWritten(boolean responseWritten) {
this.responseWritten = responseWritten;
}
-
+
}
void setResponseState(MessageContext messageContext, HttpServletResponse response) {
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java Sun Dec 17 22:34:08 2017
@@ -25,11 +25,22 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-public abstract class CommonsTransportHeaders implements Map {
+import org.apache.axiom.mime.Header;
- HashMap headerMap = null;
-
- protected abstract void init();
+public final class CommonsTransportHeaders implements Map<String,String> {
+ private final Header[] headers;
+ private Map<String,String> headerMap;
+
+ public CommonsTransportHeaders(Header[] headers) {
+ this.headers = headers;
+ }
+
+ private void init() {
+ headerMap = new HashMap<String,String>();
+ for (int i = 0; i < headers.length; i++) {
+ headerMap.put(headers[i].getName(), headers[i].getValue());
+ }
+ }
public int size() {
if (headerMap == null) {
@@ -65,62 +76,52 @@ public abstract class CommonsTransportHe
return headerMap.containsValue(value);
}
- public Collection values() {
+ public Collection<String> values() {
if (headerMap == null) {
init();
}
return headerMap.values();
}
- public void putAll(Map t) {
+ public void putAll(Map<? extends String,? extends String> t) {
if (headerMap == null) {
init();
}
headerMap.putAll(t);
}
- public Set entrySet() {
+ public Set<Map.Entry<String,String>> entrySet() {
if (headerMap == null) {
init();
}
return headerMap.entrySet();
}
- public Set keySet() {
+ public Set<String> keySet() {
if (headerMap == null) {
init();
}
return headerMap.keySet();
}
- public Object get(Object key) {
+ public String get(Object key) {
if (headerMap == null) {
init();
}
return headerMap.get(key);
}
- public Object remove(Object key) {
+ public String remove(Object key) {
if (headerMap == null) {
init();
}
return headerMap.remove(key);
}
- public Object put(Object key, Object value) {
+ public String put(String key, String value) {
if (headerMap == null) {
init();
}
return headerMap.put(key, value);
}
-
- public HashMap getHeaderMap() {
- return headerMap;
- }
-
- public void setHeaderMap(HashMap headerMap) {
- this.headerMap = headerMap;
- }
-
-
}