comparison src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java @ 12:c2e2d794847f

new: add config.properties file for gazetteer
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 30 Sep 2015 13:43:54 +0200
parents a50cf11e5178
children
comparison
equal deleted inserted replaced
11:08c950a22cee 12:c2e2d794847f
223 PublicKeyAuthenticationInfo auth = 223 PublicKeyAuthenticationInfo auth =
224 new PublicKeyAuthenticationInfo(Util.encodeString(authHandle), 300, privkey); 224 new PublicKeyAuthenticationInfo(Util.encodeString(authHandle), 300, privkey);
225 return auth; 225 return auth;
226 } 226 }
227 private String getRegistrationUrl(Dataset dataset) { 227 private String getRegistrationUrl(Dataset dataset) {
228 String siteUrl = getSiteUrl(); 228
229 229
230 String targetUrl = siteUrl + "/dataset.xhtml?persistentId=hdl:" + dataset.getAuthority() 230 String targetUrl = "/dataset.xhtml?persistentId=hdl:" + dataset.getAuthority()
231 + "/" + dataset.getIdentifier(); 231 + "/" + dataset.getIdentifier();
232 return targetUrl; 232 return targetUrl;
233 } 233 }
234 234
235 public String getSiteUrl() { 235
236 String hostUrl = System.getProperty("dataverse.siteUrl");
237 if (hostUrl != null && !"".equals(hostUrl)) {
238 return hostUrl;
239 }
240 String hostName = System.getProperty("dataverse.fqdn");
241 if (hostName == null) {
242 try {
243 hostName = InetAddress.getLocalHost().getCanonicalHostName();
244 } catch (UnknownHostException e) {
245 return null;
246 }
247 }
248 hostUrl = "https://" + hostName;
249 return hostUrl;
250 }
251 236
252 private byte[] readKey(final String file) { 237 private byte[] readKey(final String file) {
253 byte[] key = null; 238 byte[] key = null;
254 try { 239 try {
255 File f = new File(file); 240 File f = new File(file);