Skip to content
Snippets Groups Projects
Commit 046b6279 authored by Damon Kohler's avatar Damon Kohler
Browse files

Convert from Maven to Gradle.

parent 7a27b3c6
No related branches found
No related tags found
No related merge requests found
Showing
with 4 additions and 1280 deletions
#Tue Feb 28 13:29:14 CET 2012

\ No newline at end of file
File added
File added
File added
File added
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Append to CPACK_SOURCE_IGNORE_FILES a semicolon-separated list of
# directories (or patterns, but directories should suffice) that should
# be excluded from the distro. This is not the place to put things that
# should be ignored everywhere, like "build" directories; that happens in
# rosbuild/rosbuild.cmake. Here should be listed packages that aren't
# ready for inclusion in a distro.
#
# This list is combined with the list in rosbuild/rosbuild.cmake. Note
# that CMake 2.6 may be required to ensure that the two lists are combined
# properly. CMake 2.4 seems to have unpredictable scoping rules for such
# variables.
#list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental)
rosbuild_make_distribution(0.2.0)
.PHONY: all clean test
all:
mvn install
clean:
mvn clean
test:
mvn test
Visit the rosjava wiki for instructions.
Visit the rosjava_core wiki for instructions.
http://ros.org/wiki/rosjava
http://ros.org/wiki/rosjava_core
.PHONY: all clean test
all:
mvn install
clean:
mvn clean
test:
mvn test
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
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">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.ros.org.apache.xmlrpc.client</artifactId>
<packaging>jar</packaging>
<name>Apache XML-RPC Client Library</name>
<parent>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc</artifactId>
<version>3.1.3</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc.common</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>ws-commons-util</groupId>
<artifactId>ws-commons-util</artifactId>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
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">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.ros.org.apache.xmlrpc.common</artifactId>
<packaging>jar</packaging>
<name>Apache XML-RPC Common Library</name>
<parent>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc</artifactId>
<version>3.1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
</dependency>
<dependency>
<groupId>ws-commons-util</groupId>
<artifactId>ws-commons-util</artifactId>
</dependency>
</dependencies>
</project>
<package>
<description brief="apache_xmlrpc">
apache_xmlrpc
</description>
<author>Apache Foundation</author>
<license>Apache License 2.0</license>
<review status="unreviewed" notes="" />
<url>http://ros.org/wiki/apache_xmlrpc</url>
</package>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc</artifactId>
<name>Apache XML-RPC</name>
<version>3.1.3</version>
<description>
A rosjava modification to Apache XML-RPC.
</description>
<packaging>pom</packaging>
<inceptionYear>2001</inceptionYear>
<modules>
<module>common</module>
<module>client</module>
<module>server</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>ws-commons-util</groupId>
<artifactId>ws-commons-util</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
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">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.ros.org.apache.xmlrpc.server</artifactId>
<packaging>jar</packaging>
<name>Apache XML-RPC Server Library</name>
<parent>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc</artifactId>
<version>3.1.3</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>org/apache/xmlrpc/test/ScalabilityTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>org.ros.org.apache.xmlrpc.common</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
</project>
This diff is collapsed.
bundle.version=3.1.3
-output: target/org.ros.rosjava.apache-xmlrpc-${bundle.version}.jar
Bundle-Name: org.ros.rosjava.apache-xmlrpc
Bundle-SymbolicName: org.ros.rosjava.apache-xmlrpc
Bundle-Version: ${bundle.version}
Export-Package: org.apache.xmlrpc.*
~~
~~
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~
---------------------------
Advanced Programming Topics
---------------------------
This page describes some advanced topics.
Dynamic proxies
Dynamic proxies are an extremely comfortable way of Client programming.
Basically, the idea is as follows: All request processors on the server
side are splitted into interface and implementation. The interfaces are
shared between client and server, typically within some common jar file.
Now, rather than using the
{{{apidocs/org/apache/xmlrpc/client/XmlRpcClient.html}XmlRpcClient}}
directly,
the programmer creates an instance of
{{{apidocs/org/apache/xmlrpc/client/util/ClientFactory.html}ClientFactory}},
which is configured with an
{{{apidocs/org/apache/xmlrpc/client/XmlRpcClient.html}XmlRpcClient}}.
The {{{apidocs/org/apache/xmlrpc/client/util/ClientFactory.html}factory}}
can take an interface as input and returns an implementation,
which internally calls the server by using the
{{{apidocs/org/apache/xmlrpc/client/XmlRpcClient.html}XmlRpcClient}}.
Perhaps some code shows more than words. First of all, let's create
a request processor interface.
-----------------------------------------------------------------------------------
package com.foo;
public interface Adder {
public int add(int pNum1, int pNum2);
}
-----------------------------------------------------------------------------------
The server contains the request processors implementation:
-----------------------------------------------------------------------------------
package com.foo;
public class AdderImpl implements Adder {
public int add(int pNum1, int pNum2) {
return pNum1 + pNum2;
}
}
-----------------------------------------------------------------------------------
And here is how the client would use this:
-----------------------------------------------------------------------------------
import com.foo.Adder;
import java.net.URL;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.util.ClientFactory;
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
ClientFactory factory = new ClientFactory(client);
Adder adder = (Adder) factory.newInstance(Adder.class);
int sum = adder.add(2, 4);
-----------------------------------------------------------------------------------
* Exception handling
Currently, exceptions are a problem: If the server throws an exception
(for example an IOException), then the client receives an XmlRpcException.
Consequently, the generated implementation will attempt to throw the
XmlRpcException.
Unfortunately, the method signature will of course contain an IOException,
but rarely an XmlRpcException. As the XmlRpcException cannot be thrown,
it is converted into an UndeclaredThrowableException.
This is no problem, if you are prepared for runtime exceptions by enclosing
your code with proper exception handlers. (Of course, the exception handlers
may be in a calling method.) Only if you want to catch the exception (for
example, because you expect an error at a certain point), then you need
to consider, which exception is being trapped: If the method exposes
XmlRpcException, then you'll need to catch the XmlRpcException.
Otherwise, it's UndeclaredThrowableException.
It is recommended to use the property enabledForExceptions. If this property
is set, then the server will attempt to convert the exception into a byte
array, which is transmitted to the client. The client will be able to
convert the byte array back into an exception and throw that, as if it
came right out of the client. Note, that this approach may cause security
and privacy issues, because the serialized exception may, in theory, contain
arbitrary objects.
* Cookie handling
Cookie has not yet been generalized. In other words, it depends on the
transport.
* The XmlRpcLiteHttpTransport doesn't have support for cookies.
* The XmlRpcSunHttpTransport requires hand written code for setting
and getting the cookies or using a cookie library. (The latter is
recommended, of course.) In either way, you've got to use a custom
transport and overwrite the methods newURLConnection(URL),
initHttpHeaders(XmlRpcRequest), and close():
-----------------------------------------------------------------------------------
import java.net.URLConnection;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcSunHttpTransport;
import org.apache.xmlrpc.client.XmlRpcTransport;
import org.apache.xmlrpc.client.XmlRpcTransportFactory;
final XmlRpcClient client = new XmlRpcClient();
XmlRpcTransportFactory factory = new XmlRpcTransportFactory(){
public XmlRpcTransport getTransport(){
private URLConnection conn;
protected URLConnection newURLConnection(URL pURL) throws IOException {
conn = super.newURLConnection(pURL);
return conn;
}
protected void initHttpHeaders(XmlRpcRequest pRequest) {
super.initHttpHeaders(pRequest);
setCookies(conn);
}
protected void close() throws XmlRpcClientException {
getCookies(conn);
}
private void setCookies(URLConnection pConn) {
// Implement me ...
}
private void getCookies(URLConnection pConn) {
// Implement me ...
}
}
};
client.setTransportFactory(factory);
-----------------------------------------------------------------------------------
* The XmlRpcCommonsHttpTransport requires that the HttpClient is being
reused. (By default, a new HttpClient is created for any connection.)
To reuse the HttpClient, set it on the transport factory:
-----------------------------------------------------------------------------------
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcCommonsTransport;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
final XmlRpcClient client = new XmlRpcClient();
final HttpClient httpClient = new HttpClient();
final XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(client);
factory.setHttpClient(httpClient);
client.setTransportFactory(factory);
final HttpState httpState = client.getState();
-----------------------------------------------------------------------------------
Cookies may now be read or set on the httpState object.
Note, that this means losing the XmlRpcClients multithreading abilities!
The factory above is obviously bound to the HttpClient, which must be
bound to a thread. If you need to set cookies initially, overwrite the
transport method initHttpHeaders(XmlRpcRequest) as well.
* Custom data types
Apache XML-RPC was built with extensibility in mind. In particular, it was
written to support custom data types.
The data type handling is completely left to the
{{{apidocs/org/apache/xmlrpc/common/TypeFactory.html}TypeFactory}}. In
other words, adding support for custom data types is as simple as
providing your own type factory. This is typically done by subclassing
{{{apidocs/org/apache/xmlrpc/common/TypeFactoryImpl.html}TypeFactoryImpl}}.
We'll illustrate the concept by creating a type factory, which uses a
non-standard date format for transmitting date values. First of all,
we've got to implement the subclass:
-----------------------------------------------------------------------------------
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.apache.xmlrpc.common.TypeFactoryImpl;
import org.apache.xmlrpc.common.XmlRpcController;
import org.apache.xmlrpc.parser.DateParser;
import org.apache.xmlrpc.parser.TypeParser;
import org.apache.xmlrpc.serializer.DateSerializer;
import org.apache.xmlrpc.serializer.TypeSerializer;
import org.apache.ws.commons.util.NamespaceContextImpl;
public class MyTypeFactory extends TypeFactoryImpl {
public MyTypeFactory(XmlRpcController pController) {
super(pController);
}
private DateFormat newFormat() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
}
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI, String pLocalName) {
if (DateSerializer.DATE_TAG.equals(pLocalName)) {
return new DateParser(pFormat);
} else {
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
}
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException {
if (pObject instanceof Date) {
return new DateSerializer(newFormat());
} else {
return super.getSerializer(pConfig, pObject);
}
}
}
-----------------------------------------------------------------------------------
On the client side, we've got to tell the
{{{apidocs/org/apache/xmlrpc/client/XmlRpcClient.html}XmlRpcClient}} to use the
new factory. That's as simple as typing
-----------------------------------------------------------------------------------
XmlRpcClient client = new XmlRpcClient();
client.setTypeFactory(new MyTypeFactory());
-----------------------------------------------------------------------------------
Things are a little bit more difficult on the server side. Basically all we need
to do is setting the type factory on the
{{{apidocs/org/apache/xmlrpc/server/XmlRpcServer.html}XmlRpcServer}}. The question
is, how to obtain the server object. That depends on the environment. If you
are using the XmlRpcServlet, then you've got to derive a subclass:
-----------------------------------------------------------------------------------
import org.apache.xmlrpc.webserver.XmlRpcServletServer;
import org.apache.xmlrpc.webserver.XmlRpcServlet;
public class MyXmlRpcServlet extends XmlRpcServlet {
protected XmlRpcServletServer newXmlRpcServer(ServletConfig pConfig) {
XmlRpcServletServer server = super.newXmlRpcServer(pConfig);
server.setTypeFactory(new MyTypeFactory(server));
return server;
}
}
-----------------------------------------------------------------------------------
And, if you are using the
{{{apidocs/org/apache/xmlrpc/webserver/WebServer.html}WebServer}}, you've got
to override a similar method:
-----------------------------------------------------------------------------------
import java.net.InetAddress;
import org.apache.xmlrpc.server.XmlRpcStreamServer;
import org.apache.xmlrpc.webserver.WebServer;
public class MyWebServer extends WebServer {
public MyWebServer(int pPort) {
super(pPort);
}
public MyWebServer(int pPort, InetAddress pAddr) {
super(pPort, pAddr);
}
protected XmlRpcStreamServer newXmlRpcStreamServer() {
XmlRpcStreamServer server = new ConnectionServer();
server.setTypeFactory(new MyTypeFactory());
return server;
}
}
-----------------------------------------------------------------------------------
\ No newline at end of file
~~
~~
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~
-------------------------
The Apache XML-RPC Client
-------------------------
The XmlRpcClient
Before talking to an XML-RPC server, you need an instance of
{{{apidocs/org/apache/xmlrpc/client/XmlRpcClient.html}XmlRpcClient}}.
The XmlRpcClient is a stateless, thread safe object. The clients
configuration occurs by setting the following objects:
*------------------+--------------------------------------------------------------+
| Name | Description |
*------------------+--------------------------------------------------------------+
| ClientConfig | This object is an instance of |
| | {{{apidocs/org/apache/xmlrpc/client/XmlRpcClientConfig.html} |
| | XmlRpcClientConfig}}. It has a lot of atomic properties, |
| | that specify details like server URL, credentials, character |
| | set, and the like. |
*------------------+--------------------------------------------------------------+
| TransportFactory | The task of the transport factory is to create an object, |
| | which uses the client configuration for talking to the |
| | server. For example, there is a transport factory, which |
| | uses the java.net classes. Another example is a transport |
| | factory based on the Jakarta Commons Http Client. However, |
| | transport factories don't need to use HTTP: An excellent |
| | example is the local transport factory, which talks to an |
| | embedded server. This last factory is, of course, very |
| | useful for debugging. |
*------------------+--------------------------------------------------------------+
| XmlWriterFactory | The XmlWriter is an object, which creates XML for you. |
| | Typically, you do not need to care for this object, because |
| | the defaults should be fine. However, it is useful, if you |
| | need a special XML syntax. |
*------------------+--------------------------------------------------------------+
So, let's have a look at a first example:
-----------------------------------------------------------------------------------
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[]{new Integer(33), new Integer(9)};
Integer result = (Integer) client.execute("Calculator.add", params);
-----------------------------------------------------------------------------------
In other words, we invoke the remote method <Calculator.add>, passing the arguments
2 and 3. Hopefully, we know <the answer>. :-)
The Transport Factory
The above example uses the java.net.URLConnection classes to talk to the server.
What, if you'd prefer to use the {{{http://jakarta.apache.org/commons/httpclient}
Jakarta HTTP Client}}? There's basically just a single line, you'd need to add:
-----------------------------------------------------------------------------------
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/XmlRpcServlet"));
XmlRpcClient client = new XmlRpcClient();
client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
client.setConfig(config);
Object[] params = new Object[]{new Integer(2), new Integer(3)};
Integer result = (Integer) client.execute("Calculator.add", params);
-----------------------------------------------------------------------------------
In other words, the transport factory determines the way, how the client
communicates with the server. The most important transport factories are:
*--------------------------------+-------------------------------------------+
| Name | Description |
*--------------------------------+-------------------------------------------+
| XmlRpcSunHttpTransportFactory | This is the default factory, connecting |
| | to an HTTP server using the |
| | <<<java.net.HttpURLConnection>>>. |
*--------------------------------+-------------------------------------------+
| XmlRpcCommonsTransportFactory | Another HTTP transport factory, which |
| | uses the Jakarta Commons HttpClient. |
| | The main advantage over the default |
| | factory is, that the Commons HttpClient |
| | allows direct access to the result |
| | document. This allows a much lower |
| | memory profile. |
*--------------------------------+-------------------------------------------+
| XmlRpcLiteHttpTransportFactory | Yet another HTTP transport factory, which |
| | is based on an own and very lightweight |
| | HTTP client. It is possibly the fastest |
| | of the HTTP transport factories. On the |
| | other hand, it doesn't support HTTP/1.1, |
| | thus cannot use keepalive connections. |
*--------------------------------+-------------------------------------------+
| XmlRpcLocalTransportFactory | This transport factory has an embedded |
| | XML-RPC server, which is invoked via |
| | direct Java calls. This is particularly |
| | useful for debugging and development. |
*--------------------------------+-------------------------------------------+
The Client Configuration
The transport factory uses the clients configuration. Obviously, the
clients configuration depends on the transport factory. In particular,
different transport factories depend on different configuration types:
* The HTTP transport factories need an instance of
<<<org.apache.xmlrpc.client.XmlRpcHttpClientConfig>>>.
* The local transport factory requires an instance of
<<<org.apache.xmlrpc.client.XmlRpcLocalClientConfig>>>.
For convenience, you can simply use the
<<<org.apache.xmlrpc.client.XmlRpcClientConfigImpl>>>, which implements
both interfaces.
Let's have a look at the various properties, which HTTP client configurations
accept:
*-----------------------+---------------------------------------------------+
| Property Name | Description |
*-----------------------+---------------------------------------------------+
| basicUserName | The user name and password, if your HTTP server |
| basicPassword | requires basic authentication. |
*-----------------------+---------------------------------------------------+
| basicEncoding | Specifies the encoding being used to create the |
| | base 64 encoded Authorization header, which is |
| | being used for basic authentication. |
| | |
| | By default, the value of the encoding property |
| | is used. The encoding property itself defaults to |
| | UTF-8. |
*-----------------------+---------------------------------------------------+
| contentLengthOptional | Enables the faster and memory saving streaming |
| | mode: The client will not set the content-length |
| | header and the request is directly written to the |
| | HTTP requests output stream. The XML-RPC |
| | specification requires setting a content-length |
| | header. For that reason, the streaming mode is |
| | only available, if the property |
| | enabledForExtensions is set was well. |
*-----------------------+---------------------------------------------------+
| enabledForExceptions | Whether the client should request, that the |
| | server returns exceptions as serializable objects.|
| | If the server does, then the client will |
| | deserialize such exceptions and throw them, as |
| | if they had been cause within the clients code. |
*-----------------------+---------------------------------------------------+
| enabledForExtensions | Whether the vendor extensions of Apache XML-RPC |
| | should be enabled. By default, Apache XML-RPC is |
| | strictly compliant to the XML-RPC specification. |
| | Unfortunately, this specification has serious |
| | limitations. For example, it requires setting a |
| | content-length header. This enforces writing the |
| | XML-RPC request and response to byte arrays, |
| | before sending them over the net. |
| | |
| | Vendor extensions include the very fast and |
| | memory saving streaming mode (by disabling the |
| | content-length header), the compression of |
| | request and/or response. In particular, a lot of |
| | additional data types may be transmitted, when |
| | extensions are enabled: longs, shorts, bytes, |
| | floats, DOM nodes, instances of |
| | java.io.Serializable, or JAXB objects. |
*-----------------------+---------------------------------------------------+
| encoding | Sets the encoding, which is used for creating the |
| | XML-RPC request. The default encoding is UTF-8. |
| | |
| | Typically, the encoding is also used for the |
| | basic authentications, if any. However, you may |
| | specify a different encoding for the credentials |
| | using the basicEncoding property. |
*-----------------------+---------------------------------------------------+
| gzipCompressing | Whether the XML-RPC request should be compressed. |
| | Request compression is violating the XML-RPC |
| | specification, that's why gzipCompressing is only |
| | available, if the enabledForExtension property is |
| | also set. For the same reason, you should not |
| | assume, that the server is able to handle |
| | compressed requests, unless you know, that the |
| | server is itself running version 3 of |
| | Apache XML-RPC. |
*-----------------------+---------------------------------------------------+
| gzipRequesting | Requests, that the server will be compressing the |
| | response. Response compression is violating the |
| | XML-RPC specification. Therefore, this feature is |
| | only available, if the enabledForExtension |
| | property is set. Also, do not assume, that the |
| | server will actually compress the response, |
| | unless it is an Apache XML-RPC 3 server. |
*-----------------------+---------------------------------------------------+
And these properties are for configuring the local transport factory:
*-----------------------+---------------------------------------------------+
| Property Name | Description |
*-----------------------+---------------------------------------------------+
| xmlRpcServer | This is the embedded XML-RPC server, which is |
| | called to execute the clients requests. |
| | Obviously, this is an extremely fast transport. |
| | However, its main use is for debugging and |
| | development. |
*-----------------------+---------------------------------------------------+
~~
~~
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~
------------
Contributing
------------
Contributing
A great {{{http://jakarta.apache.org/site/contributing.html}description}}
of contributing to Apache XML-RPC is available from the Jakarta
project.
Submitting Patches
The preferred patch format is unidiff. The best way to generate a patch
is by checking out the sources, applying your changes and running
---------------------------------------------------------------------------------
svn diff
---------------------------------------------------------------------------------
Emails containing patches should be sent to the mailing list
xmlrpc-dev@ws.apache.org, and prefix their subject lines with <<[PATCH]>>.
Patches are also accepted via the
{{{http://issues.apache.org/jira/browse/XMLRPC}issue tracker}}.
The Jakarta project provides a description of
{{{http://jakarta.apache.org/site/source.html}life with ASF source code}}
-- look for the <<Patches>> section.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment