Changeset 6887
- Timestamp:
- 01/08/16 08:27:10 (8 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/pom.xml
r6886 r6887 24 24 <!-- Properties to configure ComponentRegistry override on commandline 25 25 with -D or change here --> 26 <serviceRootUrl>http://localhost:8080/${project.artifactId}</serviceRootUrl> 26 <serviceUrlBase>http://localhost:8080</serviceUrlBase> 27 <serviceUrlPath>/${project.artifactId}</serviceUrlPath> 27 28 <!-- Will be inserted in context.xml --> 28 29 <webXmlPath>src/main/webapp/WEB-INF/web-test.xml</webXmlPath> … … 345 346 <logging.level>debug</logging.level> 346 347 <logging.appender>CONSOLE</logging.appender> 347 <serviceRootUrl>http://localhost:8080/ComponentRegistry</serviceRootUrl> 348 <serviceUrlBase>http://localhost:8080</serviceUrlBase> 349 <serviceUrlPath>/ComponentRegistry</serviceUrlPath> 348 350 <!-- Will be inserted in context.xml --> 349 351 <shibLI>http://lux16.mpi.nl/Shibboleth.sso/Login</shibLI> … … 358 360 <id>lux16</id> 359 361 <properties> 360 <serviceRootUrl>http://lux16.mpi.nl/ds/ComponentRegistry</serviceRootUrl> 362 <serviceUrlBase>http://lux16.mpi.nl</serviceUrlBase> 363 <serviceUrlPath>/ds/ComponentRegistry</serviceUrlPath> 361 364 <!-- Will be inserted in context.xml --> 362 365 <shibLI>https://lux16.mpi.nl/Shibboleth.sso/Login</shibLI> … … 372 375 <properties> 373 376 <logging.level>warn</logging.level> 374 <serviceRootUrl>http://catalog.clarin.eu/ds/ComponentRegistry</serviceRootUrl> 377 <serviceRootUrl></serviceRootUrl> 378 <serviceUrlBase>http://catalog.clarin.eu</serviceUrlBase> 379 <serviceUrlPath>/ds/ComponentRegistry</serviceUrlPath> 375 380 <!-- Will be inserted in context.xml --> 376 381 <shibLI>https://catalog.clarin.eu/Shibboleth.sso/Login</shibLI> -
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r5973 r6887 1616 1616 /** 1617 1617 * 1618 * @return The application's base URI as configured in the 1619 * {@link #APPLICATION_BASE_URL_PARAM} context parameter. If correctly 1620 * configured, it should look something like 1618 * @return The application's base URI as defined by the following context 1619 * parameters: 1620 * 1621 * {@link APPLICATION_URL_BASE_PARAM}, 1622 * {@link APPLICATION_URL_PATH_PARAM}, 1623 * {@link APPLICATION_URL_PROTOCOL_HEADER_PARAM}, and 1624 * {@link APPLICATION_URL_HOST_HEADER_PARAM} 1625 * 1626 * If correctly configured, it should look something like 1621 1627 * "http://catalog.clarin.eu/ds/ComponentRegistry". <em>Be aware that this 1622 1628 * can also be null if configured incorrectly!</em> 1623 *1624 * @see #APPLICATION_BASE_URL_PARAM1625 1629 */ 1626 private String getApplicationBaseURI() { 1627 return servletContext.getInitParameter(APPLICATION_BASE_URL_PARAM); 1630 private synchronized String getApplicationBaseURI() { 1631 //TODO: Move logic to separate class so that it can also be used in the conig.jsp 1632 final String path = servletContext.getInitParameter(APPLICATION_URL_PATH_PARAM); 1633 if (path != null) { 1634 final String protocolHeader = servletContext.getInitParameter(APPLICATION_URL_PROTOCOL_HEADER_PARAM); 1635 final String hostHeader = servletContext.getInitParameter(APPLICATION_URL_HOST_HEADER_PARAM); 1636 if (protocolHeader != null && hostHeader != null) { 1637 1638 return String.format("%s://%s%s", 1639 request.getHeader(protocolHeader), 1640 request.getHeader(hostHeader), 1641 request.getHeader(path) 1642 ); 1643 } else { 1644 final String base = servletContext.getInitParameter(APPLICATION_URL_BASE_PARAM); 1645 return base + path; 1646 } 1647 } 1648 LOG.error("Application URI could not be determined. Information available:\n" 1649 + " {}: {}\n {}: {}\n {}: {}\n {}: {}", 1650 APPLICATION_URL_PATH_PARAM, servletContext.getInitParameter(APPLICATION_URL_PATH_PARAM), 1651 APPLICATION_URL_BASE_PARAM, servletContext.getInitParameter(APPLICATION_URL_BASE_PARAM), 1652 APPLICATION_URL_PROTOCOL_HEADER_PARAM, servletContext.getInitParameter(APPLICATION_URL_PROTOCOL_HEADER_PARAM), 1653 APPLICATION_URL_HOST_HEADER_PARAM, servletContext.getInitParameter(APPLICATION_URL_HOST_HEADER_PARAM) 1654 ); 1655 throw new RuntimeException("Cannot determine application path"); 1628 1656 } 1629 1657 … … 1996 2024 } 1997 2025 } 1998 2026 1999 2027 } -
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java
r5832 r6887 38 38 public interface IComponentRegistryRestService { 39 39 40 public static final String APPLICATION_BASE_URL_PARAM = "eu.clarin.cmdi.componentregistry.serviceRootUrl"; 40 public static final String APPLICATION_URL_BASE_PARAM = "eu.clarin.cmdi.componentregistry.serviceUrlBase"; 41 public static final String APPLICATION_URL_PATH_PARAM = "eu.clarin.cmdi.componentregistry.serviceUrlPath"; 42 public static final String APPLICATION_URL_PROTOCOL_HEADER_PARAM = "eu.clarin.cmdi.componentregistry.serviceUrlProtocolHeader"; 43 public static final String APPLICATION_URL_HOST_HEADER_PARAM = "eu.clarin.cmdi.componentregistry.serviceUrlHostHeader"; 41 44 public static final String DATA_FORM_FIELD = "data"; 42 45 public static final String NAME_FORM_FIELD = "name"; -
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/webapp/META-INF/context.xml
r6871 r6887 41 41 the '/rest/registry' part will be added by the application. 42 42 --> 43 <Parameter name="eu.clarin.cmdi.componentregistry.serviceRootUrl" value="${serviceRootUrl}"/> 43 <Parameter name="eu.clarin.cmdi.componentregistry.serviceUrlBase" value="${serviceUrlBase}"/> 44 <Parameter name="eu.clarin.cmdi.componentregistry.serviceUrlPath" value="${serviceUrlPath}"/> 45 46 <!-- 47 <Parameter name="eu.clarin.cmdi.componentregistry.serviceUrlProtocolHeader" value="${serviceUrlProtocolHeader}"/> 48 <Parameter name="eu.clarin.cmdi.componentregistry.serviceUrlHostHeader" value="${serviceUrlHostHeader}"/> 49 --> 50 44 51 <!-- 45 52 Location that gets redirected to from /documentation.jsp, which in turn is linked to
Note: See TracChangeset
for help on using the changeset viewer.