You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,17 +35,15 @@ We have a build.sbt file defined in the root.
35
35
36
36
37
37
### 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`.
39
39
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
41
41
42
-
The Xero Java SDK JsonConfig.java class parses the JSON file from the resources directory using the following bit of code.
Then deploy the Xero-Java-SDK.war found in the target directory to your Java server.
46
+
49
47
50
48
### How to Create the config.json file
51
49
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
97
95
* AuthenticateUrl: path for redirect to authorize *default is /oauth/RequestToken*
98
96
* AccessTokenPath: path for Access Token *default is https://api.xero.com/oauth/Authorize*
99
97
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
+
100
104
### Spring Framework based Config
101
105
102
106
An alternative method of configuring the Xero Java SDK can be found in the `example-spring/src/main/java` folder named `SpringConfig.java`.
This repo includes an Example App mentioned above. The file structure mirrors that of an Eclipse Maven Project with the maven-archetype-webapp
129
135
@@ -278,12 +284,6 @@ try {
278
284
279
285
```
280
286
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.
0 commit comments