当前位置: 首页>>代码示例>>Java>>正文


Java RestfulServerUtils.determineRequestEncodingNoDefault方法代码示例

本文整理汇总了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;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:RequestValidatingInterceptor.java

示例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);
	}
	// }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:ResourceParameter.java


注:本文中的ca.uhn.fhir.rest.server.RestfulServerUtils.determineRequestEncodingNoDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。