Skip to content

Commit 24f71a8

Browse files
committed
Small updates to README
1 parent 54a5c6c commit 24f71a8

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,15 @@ We have a build.sbt file defined in the root.
3535

3636

3737
### Configure
38-
The Xero Java SDK is easily configured using an external JSON file to configure values unique to your Application. This is the default configuration method, however you can implement the `Config` interface and pass it to the `XeroClient`.
38+
The Xero Java SDK is configured using a config.json file to provide API Keys and other values unique to your Application. This is the default configuration method, however you can implement the `Config` interface and pass it to the `XeroClient`.
3939

40-
We include an Example App (in this repo) built using Eclipse. We started with a Maven Project and selected the maven-archetype-webapp with the setup Wizard. This created a web application structure good for use with Servlets & JSPs. By default a src/main/resources directory is added to the project. **Place the config.json file you create in the resources directory**.
40+
To build the example app as a WAR file, **update the config.json in example/src/main/resources directory** and from the terminal run
4141

42-
The Xero Java SDK JsonConfig.java class parses the JSON file from the resources directory using the following bit of code.
43-
44-
```java
45-
final ClassLoader loader = Config.class.getClassLoader();
46-
URL path = loader.getResource("config.json");
47-
File f = new File(path.getFile());
42+
```javascript
43+
mvn clean compile war:war
4844
```
45+
Then deploy the Xero-Java-SDK.war found in the target directory to your Java server.
46+
4947

5048
### How to Create the config.json file
5149
In a text editor, create a file called config.json (examples are below) Refer to Xero Developer Center [Getting Started](http://developer.xero.com/documentation/getting-started/getting-started-guide/) when you are ready to create a Xero App - this is how you'll create a Consumer Key and Secret. Private and Partner apps require a [public/private key pair](http://developer.xero.com/documentation/api-guides/create-publicprivate-key/) you'll create using OpenSSL. The private key should be exported as a pfx file and in our example we create a "certs" folder inside the resources folder and place it there.
@@ -97,6 +95,12 @@ In a text editor, create a file called config.json (examples are below) Refer t
9795
* AuthenticateUrl: path for redirect to authorize *default is /oauth/RequestToken*
9896
* AccessTokenPath: path for Access Token *default is https://api.xero.com/oauth/Authorize*
9997

98+
## Custom Request Signing
99+
100+
You can provide your own signing mechanism by using the `public XeroClient(Config config, SignerFactory signerFactory)` constructor. Simply implement the `SignerFactory` interface with your implementation.
101+
102+
You can also provide a `RsaSignerFactory` using the `public RsaSignerFactory(InputStream privateKeyInputStream, String privateKeyPassword)` constructor to fetch keys from any InputStream.
103+
100104
### Spring Framework based Config
101105

102106
An alternative method of configuring the Xero Java SDK can be found in the `example-spring/src/main/java` folder named `SpringConfig.java`.
@@ -124,6 +128,8 @@ xero.PrivateKeyCert=certs/public_privatekey.pfx
124128
xero.PrivateKeyPassword=
125129
```
126130

131+
132+
127133
### Example App
128134
This repo includes an Example App mentioned above. The file structure mirrors that of an Eclipse Maven Project with the maven-archetype-webapp
129135

@@ -278,12 +284,6 @@ try {
278284

279285
```
280286

281-
## Custom request signing
282-
283-
You can provide your own signing mechanism by using the `public XeroClient(Config config, SignerFactory signerFactory)` constructor. Simply implement the `SignerFactory` interface with your implementation.
284-
285-
You can also provide a `RsaSignerFactory` using the `public RsaSignerFactory(InputStream privateKeyInputStream, String privateKeyPassword)` constructor to fetch keys from any InputStream.
286-
```
287287

288288
## Acknowledgement
289289

0 commit comments

Comments
 (0)