diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java index a7ad2d6dee9..21ece7f2af9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java @@ -150,7 +150,7 @@ abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding } for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } return retVal; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java index 57cd0c3ba89..859c0d5d89e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java @@ -176,7 +176,10 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca if (myParams != null) { List parameters = new ArrayList(); for (Entry> nextParam : myParams.entrySet()) { - parameters.add(new BasicNameValuePair(nextParam.getKey(), StringUtils.join(nextParam.getValue(), ','))); + List value = nextParam.getValue(); + for(String s: value){ + parameters.add(new BasicNameValuePair(nextParam.getKey(), s)); + } } try { entity = new UrlEncodedFormEntity(parameters, "UTF-8"); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ConformanceMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ConformanceMethodBinding.java index 9ede1e02798..2fcccd0574d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ConformanceMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ConformanceMethodBinding.java @@ -61,7 +61,7 @@ public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding if (theArgs != null) { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CountParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CountParameter.java index 097171962a9..b1db34a81ab 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CountParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CountParameter.java @@ -33,7 +33,6 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.annotation.Since; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.param.ParameterUtil; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -44,7 +43,7 @@ public class CountParameter implements IParameter { private Class myType; @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { if (theSourceClientArgument != null) { IntegerDt since = ParameterUtil.toInteger(theSourceClientArgument); if (since.isEmpty() == false) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CreateMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CreateMethodBinding.java index 381dd2ff84c..1b4082595e0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CreateMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/CreateMethodBinding.java @@ -75,7 +75,7 @@ public class CreateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe if (theArgs != null) { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java index b83497794a2..138d0a7166a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java @@ -132,7 +132,7 @@ public class DeleteMethodBinding extends BaseOutcomeReturningMethodBinding { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } return retVal; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DynamicSearchParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DynamicSearchParameter.java index 076b08007dc..d4bc9ca1165 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DynamicSearchParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DynamicSearchParameter.java @@ -29,7 +29,6 @@ import java.util.Map; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.model.api.IQueryParameterType; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.param.CompositeOrListParam; import ca.uhn.fhir.rest.param.DateOrListParam; import ca.uhn.fhir.rest.param.DateParam; @@ -59,7 +58,7 @@ public class DynamicSearchParameter implements IParameter { } @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { throw new UnsupportedOperationException("Dynamic search is not supported in client mode (use fluent client for dynamic-like searches)"); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/GetTagsMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/GetTagsMethodBinding.java index 5b07650f98e..caae8c0ccc0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/GetTagsMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/GetTagsMethodBinding.java @@ -136,7 +136,7 @@ public class GetTagsMethodBinding extends BaseMethodBinding { if (theArgs != null) { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java index 98df4fd266d..898f339e2d4 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java @@ -118,7 +118,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding { if (theArgs != null) { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], retVal.getParameters(), retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], retVal.getParameters()); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IParameter.java index ab3c0b13a7c..cccf67ef536 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IParameter.java @@ -27,14 +27,13 @@ import java.util.Map; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; public interface IParameter { - void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException; + void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException; /** * This server method method takes the data received by the server in an incoming request, and translates that data into a single argument for a server method invocation. Note that all diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/NullParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/NullParameter.java index 1e93adeed56..54999e094fa 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/NullParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/NullParameter.java @@ -26,14 +26,13 @@ import java.util.List; import java.util.Map; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; class NullParameter implements IParameter { @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { //nothing } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java index 6bf8ee77e71..53148047192 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java @@ -156,7 +156,7 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding implem for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } return retVal; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java index f93ed34f963..7905b87785e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java @@ -263,15 +263,15 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding { IdDt id = (IdDt) (myIdParamIndex != null ? theArgs[myIdParamIndex] : null); String resourceName = getResourceName(); - BaseHttpClientInvocation retVal = createSearchInvocation(getContext(), resourceName, queryStringArgs, id, myCompartmentName, null); - if (theArgs != null) { for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], queryStringArgs, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], queryStringArgs); } } + BaseHttpClientInvocation retVal = createSearchInvocation(getContext(), resourceName, queryStringArgs, id, myCompartmentName, null); + return retVal; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServerBaseParamBinder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServerBaseParamBinder.java index cfb70fded40..8e2d04179f2 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServerBaseParamBinder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServerBaseParamBinder.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -34,7 +33,7 @@ class ServerBaseParamBinder implements IParameter { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServerBaseParamBinder.class); @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { /* * Does nothing, since we just ignore serverbase arguments */ diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletRequestParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletRequestParameter.java index 979ca3cb8c1..6bc75866155 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletRequestParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletRequestParameter.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -34,7 +33,7 @@ class ServletRequestParameter implements IParameter { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServletRequestParameter.class); @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { /* * Does nothing, since we just ignore HttpServletRequest arguments */ diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletResponseParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletResponseParameter.java index 056037b6a41..2ed86cebd60 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletResponseParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ServletResponseParameter.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -34,7 +33,7 @@ class ServletResponseParameter implements IParameter { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServletResponseParameter.class); @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { /* * Does nothing, since we just ignore HttpServletResponse arguments */ diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SinceParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SinceParameter.java index 2de8869d9e6..14200e33e52 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SinceParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SinceParameter.java @@ -33,7 +33,6 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.annotation.Since; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.param.ParameterUtil; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -44,7 +43,7 @@ class SinceParameter implements IParameter { private Class myType; @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { if (theSourceClientArgument != null) { InstantDt since = ParameterUtil.toInstant(theSourceClientArgument); if (since.isEmpty() == false) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SortParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SortParameter.java index 805ca935b2e..979bff490a9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SortParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SortParameter.java @@ -33,7 +33,6 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.annotation.Sort; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -41,7 +40,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; public class SortParameter implements IParameter { @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { SortSpec ss = (SortSpec) theSourceClientArgument; while (ss != null) { String name; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionParamBinder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionParamBinder.java index 22e23b9d6e2..ea4f8c7c040 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionParamBinder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionParamBinder.java @@ -32,7 +32,6 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.rest.annotation.TransactionParam; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -44,7 +43,7 @@ class TransactionParamBinder implements IParameter { } @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { // TODO Auto-generated method stub } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java index ac998095380..8108bba169b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java @@ -118,7 +118,7 @@ class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithResourceP for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } return retVal; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBinding.java index 3746f965b7e..8475fab918f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBinding.java @@ -74,7 +74,7 @@ public class ValidateMethodBinding extends BaseOutcomeReturningMethodBindingWith for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); - nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal); + nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null); } return retVal; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java index 858493e6e2d..eb7e4836e98 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java @@ -31,7 +31,6 @@ import org.apache.commons.lang3.StringUtils; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.method.IParameter; import ca.uhn.fhir.rest.method.QualifiedParamList; import ca.uhn.fhir.rest.method.Request; @@ -60,7 +59,7 @@ public abstract class BaseQueryParameter implements IParameter { public abstract SearchParamTypeEnum getParamType(); @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { if (theSourceClientArgument == null) { if (isRequired()) { throw new NullPointerException("SearchParameter '" + getName() + "' is required and may not be null"); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java index 54cb1da481f..9de1f0bafd9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java @@ -27,7 +27,6 @@ import java.util.Map; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.method.IParameter; import ca.uhn.fhir.rest.method.Request; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -42,7 +41,7 @@ public class ResourceParameter implements IParameter { } @Override - public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException { + public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map> theTargetQueryArguments) throws InternalErrorException { // TODO Auto-generated method stub } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java index 8aa0336d3e3..044a13e3bf8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java @@ -669,7 +669,7 @@ public class RestfulServer extends HttpServlet { ourLog.error("Failure during REST processing", e); issue.getDetailsElement().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e)); } else if (e instanceof BaseServerResponseException) { - ourLog.warn("Failure during REST processing: {}", e.toString()); + ourLog.warn("Failure during REST processing: {}", e); BaseServerResponseException baseServerResponseException = (BaseServerResponseException) e; statusCode = baseServerResponseException.getStatusCode(); issue.getDetailsElement().setValue(e.getMessage()); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java index 6cf26bc7ffb..f4b26b27458 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java @@ -2,6 +2,7 @@ package ca.uhn.fhir.narrative; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import java.io.InputStreamReader; import java.util.Date; diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/SearchTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/SearchTest.java index 65c3736012e..92c1340b6bb 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/SearchTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/SearchTest.java @@ -1,31 +1,46 @@ package ca.uhn.fhir.rest.client; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.StringReader; import java.nio.charset.Charset; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; +import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.dstu.resource.Conformance; import ca.uhn.fhir.model.dstu.resource.Encounter; import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.rest.annotation.IncludeParam; +import ca.uhn.fhir.rest.annotation.RequiredParam; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.client.api.IBasicClient; +import ca.uhn.fhir.rest.param.TokenOrListParam; +import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; public class SearchTest { @@ -62,6 +77,39 @@ public class SearchTest { } + @Test + public void testPostOnLongParamsList() throws Exception { + String retVal = "<id>bc59fca7-0a8f-4caf-abef-45c8d53ece6a</id><link rel=\"self\" href=\"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/Encounter?identifier=urn%3Aoid%3A1.3.6.1.4.1.12201.2%7C11410000159&_include=Encounter.participant&_include=Encounter.location.location&_include=Encounter.subject\"/><link rel=\"fhir-base\" href=\"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2\"/><os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">1</os:totalResults><published>2014-08-08T14:46:16.497-04:00</published><author><name>HAPI FHIR Server</name></author><entry><title>Encounter 5994268http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/Encounter/59942682014-08-05T12:00:11.000-04:002014-08-05T11:59:21.000-04:00
No narrative template available for resource profile: http://fhir.connectinggta.ca/Profile/encounter
Patient 5993715http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/Patient/59937152014-08-08T14:46:16-04:00
Person CHA
IdentifierUHN MRN 7018614
Address100 Dundas street west
Toronto ON Can
Date of birth01 January 1988
Practitioner Practitioner/5738815http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/Practitioner/57388152014-08-08T13:53:52.000-04:002009-12-04T13:43:11.000-05:00
No narrative template available for resource profile: http://hl7.org/fhir/profiles/Practitioner
Location Location/5994269http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/Location/59942692014-08-08T14:46:16-04:00
No narrative template available for resource profile: http://hl7.org/fhir/profiles/Location
"; + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(httpClient.execute(capt.capture())).thenReturn(httpResponse); + when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML+ "; charset=UTF-8")); + when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8"))); + + ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo"); + Set includes = new HashSet(); + includes.add(new Include("one")); + includes.add(new Include("two")); + TokenOrListParam params = new TokenOrListParam(); + for(int i=0; i<1000; i++){ + params.add(new TokenParam("system", "value")); + } + List found = client.searchByList(params, includes); + + assertEquals(1, found.size()); + + Encounter encounter = found.get(0); + assertNotNull(encounter.getSubject().getResource()); + HttpUriRequest value = capt.getValue(); + + assertTrue("Expected request of type POST on long params list", value instanceof HttpPost); + HttpPost post = (HttpPost) value; + String body = IOUtils.toString(post.getEntity().getContent()); + System.out.println(body); + assertThat(body, Matchers.containsString("_include=one")); + assertThat(body, Matchers.containsString("_include=two")); + } private interface ITestClient extends IBasicClient { @@ -69,6 +117,12 @@ public class SearchTest { @Search List search(); + @Search + List searchByList( + @RequiredParam(name = Encounter.SP_IDENTIFIER) TokenOrListParam tokenOrListParam, + @IncludeParam Set theIncludes + ) throws BaseServerResponseException; + } }