Add testing hooks to testpage overlay

This commit is contained in:
James 2017-05-19 10:11:11 -04:00
parent 7c48eadf38
commit 235bdcc4fc
3 changed files with 26 additions and 7 deletions

View File

@ -234,12 +234,14 @@ public class Controller extends BaseController {
GenericClient client = theRequest.newClient(theReq, context, myConfig, interceptor);
String url = defaultString(theReq.getParameter("page-url"));
if (!url.startsWith(theModel.get("base").toString())) {
ourLog.warn(logPrefix(theModel) + "Refusing to load page URL: {}", url);
theModel.put("errorMsg", "Invalid page URL: " + url);
return "result";
if (myConfig.isRefuseToFetchThirdPartyUrls()) {
if (!url.startsWith(theModel.get("base").toString())) {
ourLog.warn(logPrefix(theModel) + "Refusing to load page URL: {}", url);
theModel.put("errorMsg", "Invalid page URL: " + url);
return "result";
}
}
url = url.replace("&", "&");
ResultType returnsResource = ResultType.BUNDLE;

View File

@ -24,6 +24,7 @@ public class TesterConfig {
private LinkedHashMap<String, FhirVersionEnum> myIdToFhirVersion = new LinkedHashMap<String, FhirVersionEnum>();
private LinkedHashMap<String, String> myIdToServerBase = new LinkedHashMap<String, String>();
private LinkedHashMap<String, String> myIdToServerName = new LinkedHashMap<String, String>();
private boolean myRefuseToFetchThirdPartyUrls = true;
private List<ServerBuilder> myServerBuilders = new ArrayList<TesterConfig.ServerBuilder>();
public IServerBuilderStep1 addServer() {
@ -71,10 +72,26 @@ public class TesterConfig {
return myIdToServerName;
}
/**
* If set to {@literal true} (default is true) the server will refuse to load URLs in
* response payloads the refer to third party servers (e.g. paging URLs etc)
*/
public boolean isRefuseToFetchThirdPartyUrls() {
return myRefuseToFetchThirdPartyUrls;
}
public void setClientFactory(ITestingUiClientFactory theClientFactory) {
myClientFactory = theClientFactory;
}
/**
* If set to {@literal true} (default is true) the server will refuse to load URLs in
* response payloads the refer to third party servers (e.g. paging URLs etc)
*/
public void setRefuseToFetchThirdPartyUrls(boolean theRefuseToFetchThirdPartyUrls) {
myRefuseToFetchThirdPartyUrls = theRefuseToFetchThirdPartyUrls;
}
@Required
public void setServers(List<String> theServers) {
List<String> servers = theServers;
@ -137,7 +154,7 @@ public class TesterConfig {
public interface IServerBuilderStep5 {
IServerBuilderStep1 addServer();
IServerBuilderStep5 allowsApiKey();
}

View File

@ -245,7 +245,7 @@
<span th:unless="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' / ' + ${riBundle.totalElement.value} + ' entries'"/>
</a>
<th:block th:if="${riBundle.getLink('next') != null} or ${riBundle.getLink('prev') != null}">
<th:block th:if="${riBundle.getLink('next') != null} or ${riBundle.getLink('prev') != null} or ${riBundle.getLink('previous') != null}">
<!-- Prev/Next Page Buttons -->
<button class="btn btn-success btn-xs" type="button" id="page-prev-btn"