Added server.properties
This commit is contained in:
parent
5610174340
commit
17fe38a377
@ -1,6 +1,8 @@
|
|||||||
package envoy.client;
|
package envoy.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
@ -27,6 +29,19 @@ public class EnvoyClient {
|
|||||||
|
|
||||||
private DatatypeFactory datatypeFactory;
|
private DatatypeFactory datatypeFactory;
|
||||||
|
|
||||||
|
private static final Properties serverProps = new Properties();
|
||||||
|
|
||||||
|
static {
|
||||||
|
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
|
try {
|
||||||
|
serverProps.load(loader.getResourceAsStream("server.properties"));
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public EnvoyClient() {
|
public EnvoyClient() {
|
||||||
try {
|
try {
|
||||||
datatypeFactory = DatatypeFactory.newInstance();
|
datatypeFactory = DatatypeFactory.newInstance();
|
||||||
@ -58,8 +73,10 @@ public class EnvoyClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
|
String url = String.format("%s:%s/envoy-server/rest/message/send", serverProps.getProperty("server"),
|
||||||
|
serverProps.getProperty("port"));
|
||||||
Client client = ClientBuilder.newClient();
|
Client client = ClientBuilder.newClient();
|
||||||
WebTarget target = client.target("http://kske.feste-ip.net:43315/envoy-server/rest/message/send");
|
WebTarget target = client.target(url);
|
||||||
Response response = target.request().post(Entity.entity(message, "application/xml"));
|
Response response = target.request().post(Entity.entity(message, "application/xml"));
|
||||||
System.out.println("Response code: " + response.getStatus());
|
System.out.println("Response code: " + response.getStatus());
|
||||||
response.close();
|
response.close();
|
||||||
|
2
src/main/resources/server.properties
Normal file
2
src/main/resources/server.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
server=http://kske.feste-ip.net
|
||||||
|
port=43315
|
Reference in New Issue
Block a user