本文整理汇总了Java中ca.uhn.fhir.rest.server.RestfulServerUtils.determineRequestEncodingNoDefault方法的典型用法代码示例。如果您正苦于以下问题:Java RestfulServerUtils.determineRequestEncodingNoDefault方法的具体用法?Java RestfulServerUtils.determineRequestEncodingNoDefault怎么用?Java RestfulServerUtils.determineRequestEncodingNoDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.rest.server.RestfulServerUtils
的用法示例。
在下文中一共展示了RestfulServerUtils.determineRequestEncodingNoDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: incomingRequestPostProcessed
import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Override
public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, HttpServletRequest theRequest, HttpServletResponse theResponse) throws AuthenticationException {
EncodingEnum encoding = RestfulServerUtils.determineRequestEncodingNoDefault(theRequestDetails);
if (encoding == null) {
ourLog.trace("Incoming request does not appear to be FHIR, not going to validate");
return true;
}
Charset charset = ResourceParameter.determineRequestCharset(theRequestDetails);
String requestText = new String(theRequestDetails.loadRequestContents(), charset);
if (isBlank(requestText)) {
ourLog.trace("Incoming request does not have a body");
return true;
}
ValidationResult validationResult = validate(requestText, theRequestDetails);
// The JPA server will use this
theRequestDetails.getUserData().put(REQUEST_VALIDATION_RESULT, validationResult);
return true;
}
示例2: translateQueryParametersIntoServerArgument
import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Override
public Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding<?> theMethodBinding) throws InternalErrorException, InvalidRequestException {
switch (myMode) {
case BODY:
try {
return IOUtils.toString(createRequestReader(theRequest));
} catch (IOException e) {
// Shouldn't happen since we're reading from a byte array
throw new InternalErrorException("Failed to load request", e);
}
case BODY_BYTE_ARRAY:
return theRequest.loadRequestContents();
case ENCODING:
return RestfulServerUtils.determineRequestEncodingNoDefault(theRequest);
case RESOURCE:
default:
return parseResourceFromRequest(theRequest, theMethodBinding, myResourceType);
}
// }
}