Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • delight delight
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • delight
  • delightdelight
  • Wiki
  • Xmlrpc
  • ExampleUsingConverterRegistry

ExampleUsingConverterRegistry · Changes

Page history
started documentation of json-over-http delight authored Mar 05, 2019 by Andreas Lauer's avatar Andreas Lauer
Hide whitespace changes
Inline Side-by-side
xmlrpc/ExampleUsingConverterRegistry.md 0 → 100644
View page @ 91ec85b6
## [Home](https://git.opendfki.de/delight/delight/wikis/Home) | [Documentation](https://git.opendfki.de/delight/delight/wikis/Documentation) | [People / Contact](https://git.opendfki.de/delight/delight/wikis/people)
---
### Using Third Party Types in your API
Sometimes it is dicouraged to have any XML-RPC or Delight reference in an interface class. In order to still use this interface
with Delight a ```javaParameterConverterRegistry``` has been introduced. See also [Using third party types in your API](ExampleUsingThirdPartyTypes).
```java
*** SOMETIMES DISCOURAGED ***
@ConverterMappings(
@Mapping(type=URL.class,converter=URLConverter.class)
)
public interface Api
{
URL getHomepageLocation();
void addSite( URL url );
}
```
Alternative with **ParameterConverterRegistry:**
```java
public interface Api
{
URL getHomepageLocation();
void addSite( URL url );
}
```
Now, without having to annotate the interface invoking the methods looks like this:
```java
ParameterConverterRegistry.setParameterConverterForClass( URL.class, URLConverter.class );
Api remote_api = XmlRpc.createClient( Api.class, "handlerId", host, port );
URL homepageUrl = remote_api.getHomepageLocation();
InputStream is = homepageUrl.openStream();
...
remote_api.addSite( new URL( "http://middle.of.nowhere" ) );
...
```
**NOTE:** Client **AND** Server have to register the converter prior to a remote call.
Examples in source code: [here](https://git.opendfki.de/delight/delight/tree/master/example-delight-webapp)
\ No newline at end of file
Clone repository
  • DocuFeature
  • ExampleServer
  • ExampleWebApp
  • Home
  • ServerSentEventsFeature
  • StatsFeature
  • people
  • xmlrpc
    • Documentation
    • ExampleUsingConverterRegistry
    • ExampleUsingOwnConceteTypes
    • ExampleUsingOwnInterfaceTypes
    • ExampleUsingThirdPartyTypes
    • ExampleUsingXmlRpcBeans
    • ExampleUsingXmlRpcCompliantTypes

Legal Notice, Imprint, Privacy Policy