mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-09 14:33:32 +00:00
Add testing hooks to testpage overlay
This commit is contained in:
parent
7c48eadf38
commit
235bdcc4fc
@ -234,12 +234,14 @@ public class Controller extends BaseController {
|
|||||||
GenericClient client = theRequest.newClient(theReq, context, myConfig, interceptor);
|
GenericClient client = theRequest.newClient(theReq, context, myConfig, interceptor);
|
||||||
|
|
||||||
String url = defaultString(theReq.getParameter("page-url"));
|
String url = defaultString(theReq.getParameter("page-url"));
|
||||||
if (!url.startsWith(theModel.get("base").toString())) {
|
if (myConfig.isRefuseToFetchThirdPartyUrls()) {
|
||||||
ourLog.warn(logPrefix(theModel) + "Refusing to load page URL: {}", url);
|
if (!url.startsWith(theModel.get("base").toString())) {
|
||||||
theModel.put("errorMsg", "Invalid page URL: " + url);
|
ourLog.warn(logPrefix(theModel) + "Refusing to load page URL: {}", url);
|
||||||
return "result";
|
theModel.put("errorMsg", "Invalid page URL: " + url);
|
||||||
|
return "result";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url.replace("&", "&");
|
url = url.replace("&", "&");
|
||||||
|
|
||||||
ResultType returnsResource = ResultType.BUNDLE;
|
ResultType returnsResource = ResultType.BUNDLE;
|
||||||
|
@ -24,6 +24,7 @@ public class TesterConfig {
|
|||||||
private LinkedHashMap<String, FhirVersionEnum> myIdToFhirVersion = new LinkedHashMap<String, FhirVersionEnum>();
|
private LinkedHashMap<String, FhirVersionEnum> myIdToFhirVersion = new LinkedHashMap<String, FhirVersionEnum>();
|
||||||
private LinkedHashMap<String, String> myIdToServerBase = new LinkedHashMap<String, String>();
|
private LinkedHashMap<String, String> myIdToServerBase = new LinkedHashMap<String, String>();
|
||||||
private LinkedHashMap<String, String> myIdToServerName = 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>();
|
private List<ServerBuilder> myServerBuilders = new ArrayList<TesterConfig.ServerBuilder>();
|
||||||
|
|
||||||
public IServerBuilderStep1 addServer() {
|
public IServerBuilderStep1 addServer() {
|
||||||
@ -71,10 +72,26 @@ public class TesterConfig {
|
|||||||
return myIdToServerName;
|
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) {
|
public void setClientFactory(ITestingUiClientFactory theClientFactory) {
|
||||||
myClientFactory = 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
|
@Required
|
||||||
public void setServers(List<String> theServers) {
|
public void setServers(List<String> theServers) {
|
||||||
List<String> servers = theServers;
|
List<String> servers = theServers;
|
||||||
@ -137,7 +154,7 @@ public class TesterConfig {
|
|||||||
public interface IServerBuilderStep5 {
|
public interface IServerBuilderStep5 {
|
||||||
|
|
||||||
IServerBuilderStep1 addServer();
|
IServerBuilderStep1 addServer();
|
||||||
|
|
||||||
IServerBuilderStep5 allowsApiKey();
|
IServerBuilderStep5 allowsApiKey();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
<span th:unless="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' / ' + ${riBundle.totalElement.value} + ' entries'"/>
|
<span th:unless="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' / ' + ${riBundle.totalElement.value} + ' entries'"/>
|
||||||
</a>
|
</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 -->
|
<!-- Prev/Next Page Buttons -->
|
||||||
<button class="btn btn-success btn-xs" type="button" id="page-prev-btn"
|
<button class="btn btn-success btn-xs" type="button" id="page-prev-btn"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user