Skip to content

Commit 1a9759d

Browse files
committed
Merge branch 'release-1.3.0'
2 parents 13b63f0 + 2810910 commit 1a9759d

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>ubc.pavlab</groupId>
77
<artifactId>rdp</artifactId>
8-
<version>1.2.10</version>
8+
<version>1.3.0</version>
99

1010
<parent>
1111
<groupId>org.springframework.boot</groupId>

src/main/java/ubc/pavlab/rdp/services/RemoteResourceServiceImpl.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import ubc.pavlab.rdp.repositories.RoleRepository;
1919
import ubc.pavlab.rdp.settings.ApplicationSettings;
2020

21+
import javax.ws.rs.client.Client;
2122
import javax.ws.rs.core.Response;
2223
import java.io.UnsupportedEncodingException;
2324
import java.net.URLEncoder;
@@ -117,7 +118,23 @@ private <T> Collection<T> getRemoteEntities( Class<T[]> arrCls, String uri, Map<
117118
}
118119

119120
private <T> T remoteRequest( Class<T> cls, String remoteUrl, Map<String, String> args ) throws RemoteException {
120-
ResteasyClient client = new ResteasyClientBuilder().build();
121+
122+
String proxyHost = applicationSettings.getIsearch().getHost();
123+
String proxyPort = applicationSettings.getIsearch().getPort();
124+
ResteasyClient client = null;
125+
126+
if (proxyHost != null && proxyPort != null &&
127+
!proxyHost.equals("") && !proxyPort.equals("") ) {
128+
client = new ResteasyClientBuilder().defaultProxy(
129+
proxyHost,
130+
Integer.parseInt( proxyPort )
131+
).build();
132+
log.info( "Using " +proxyHost + ":" + proxyPort+ " as proxy for rest client." );
133+
} else {
134+
client = new ResteasyClientBuilder().build();
135+
log.info( "Using default proxy for rest client." );
136+
}
137+
121138
ResteasyWebTarget target = client.target( remoteUrl + encodeParams( args ) );
122139
Response response = target.request().get();
123140
if ( response.getStatus() != 200 ) {

src/main/java/ubc/pavlab/rdp/settings/ApplicationSettings.java

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.Getter;
44
import lombok.Setter;
5+
import org.hibernate.validator.constraints.URL;
56
import org.springframework.boot.context.properties.ConfigurationProperties;
67
import org.springframework.stereotype.Component;
78
import ubc.pavlab.rdp.services.UserService;
@@ -53,6 +54,9 @@ public static class InternationalSearchSettings {
5354
private String[] apis;
5455
private List<String> authTokens;
5556
private String searchToken;
57+
@URL
58+
private String host = null;
59+
private String port = null;
5660
}
5761

5862
private InternationalSearchSettings isearch;
@@ -61,4 +65,13 @@ public static class InternationalSearchSettings {
6165
private boolean sendEmailOnRegistration;
6266
private int goTermSizeLimit = 100;
6367

68+
// @Getter
69+
// @Setter
70+
// public static class ProxySettings {
71+
// @URL
72+
// private String host = null;
73+
// private String port = null;
74+
// }
75+
// private ProxySettings proxy;
76+
6477
}

src/main/java/ubc/pavlab/rdp/settings/SiteSettings.java

+4
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ public String getFullUrl() {
4848
return host + context + (context.endsWith( "/" ) ? "" : "/");
4949
}
5050

51+
@URL
52+
private String proxyHost;
53+
private String proxyPort;
54+
5155
}

0 commit comments

Comments
 (0)