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


Java RestfulServerUtils.streamResponseAsResource方法代码示例

本文整理汇总了Java中ca.uhn.fhir.rest.server.RestfulServerUtils.streamResponseAsResource方法的典型用法代码示例。如果您正苦于以下问题:Java RestfulServerUtils.streamResponseAsResource方法的具体用法?Java RestfulServerUtils.streamResponseAsResource怎么用?Java RestfulServerUtils.streamResponseAsResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca.uhn.fhir.rest.server.RestfulServerUtils的用法示例。


在下文中一共展示了RestfulServerUtils.streamResponseAsResource方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReturnResponse

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testReturnResponse() throws IOException {
	IdType theId = new IdType(15L);
	int operationStatus = 200;
	boolean allowPrefer = true;
	String resourceName = "Patient";
	MethodOutcome methodOutcome = new MethodOutcome(theId);
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(Constants.CT_FHIR_JSON_NEW+"; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertTrue(result.getEntity().toString().contains("resourceType\": \"Patient"));
	assertTrue(result.getEntity().toString().contains("15"));
	
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:JaxRsResponseDstu3Test.java

示例2: testReturnResponseAsXml

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testReturnResponseAsXml() throws IOException {
	IdType theId = new IdType(15L);
	int operationStatus = 200;
	boolean allowPrefer = true;
	String resourceName = "Patient";
	MethodOutcome methodOutcome = new MethodOutcome(theId);
	response.getRequestDetails().addParameter(Constants.PARAM_FORMAT, new String[]{Constants.CT_XML});
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals("application/fhir+xml; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertTrue(result.getEntity().toString().contains("<Patient"));
	assertTrue(result.getEntity().toString().contains("15"));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:JaxRsResponseDstu3Test.java

示例3: testSendAttachmentResponse

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponse() throws IOException {
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	String contentType = "foo";
	byte[] content = new byte[] { 1, 2, 3, 4 };
	binary.setContentType(contentType);
	binary.setContent(content);
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(contentType, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(content, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:15,代码来源:JaxRsResponseTest.java

示例4: testSendAttachmentResponseNoContent

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponseNoContent() throws IOException {
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	binary.setContent(new byte[] {});
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(null, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(null, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:JaxRsResponseTest.java

示例5: testSendAttachmentResponseEmptyContent

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponseEmptyContent() throws IOException {
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(null, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(null, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:11,代码来源:JaxRsResponseTest.java

示例6: testReturnResponse

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testReturnResponse() throws IOException {
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	// Response result = response.returnResponse(outcome, operationStatus, allowPrefer, methodOutcome, resourceName);
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals("application/json+fhir; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	System.out.println(result.getEntity().toString());
	assertTrue(result.getEntity().toString().contains("resourceType\": \"Patient"));
	assertTrue(result.getEntity().toString().contains("15"));

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:14,代码来源:JaxRsResponseTest.java

示例7: testReturnResponseAsXml

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testReturnResponseAsXml() throws IOException {
	response.getRequestDetails().addParameter(Constants.PARAM_FORMAT, new String[] { Constants.CT_XML });
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals("application/xml+fhir; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertTrue(result.getEntity().toString().contains("<Patient"));
	assertTrue(result.getEntity().toString().contains("15"));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:JaxRsResponseTest.java

示例8: testNoOutcomeXml

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testNoOutcomeXml() throws IOException {
	response.getRequestDetails().addParameter(Constants.PARAM_FORMAT, new String[] { Constants.CT_XML });
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals("application/xml+fhir; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:JaxRsResponseTest.java

示例9: testGetResponseWriterNoZipNoBrowser

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testGetResponseWriterNoZipNoBrowser() throws IOException {
	boolean theRequestIsBrowser = false;
	boolean respondGzip = false;
	Set<SummaryEnum> theSummaryMode = Collections.<SummaryEnum>emptySet();
       boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), bundle, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, request);
	assertEquals(200, result.getStatus());
	assertEquals(Constants.CT_FHIR_JSON_NEW+Constants.CHARSET_UTF8_CTSUFFIX, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertTrue(result.getEntity().toString().contains("Patient"));
	assertTrue(result.getEntity().toString().contains("15"));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:13,代码来源:JaxRsResponseDstu3Test.java

示例10: testSendAttachmentResponse

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponse() throws IOException {
	boolean theRequestIsBrowser = true;
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	String contentType = "foo";
	byte[] content = new byte[] { 1, 2, 3, 4 };
	binary.setContentType(contentType);
	binary.setContent(content);
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(contentType, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(content, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:16,代码来源:JaxRsResponseDstu3Test.java

示例11: testSendAttachmentResponseNoContent

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponseNoContent() throws IOException {
	boolean theRequestIsBrowser = true;
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	binary.setContent(new byte[]{});
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(null, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(null, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:13,代码来源:JaxRsResponseDstu3Test.java

示例12: testSendAttachmentResponseEmptyContent

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testSendAttachmentResponseEmptyContent() throws IOException {
	boolean theRequestIsBrowser = true;
	boolean respondGzip = true;
	IBaseBinary binary = new Binary();
	boolean theAddContentLocationHeader = false;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), binary, theSummaryMode, 200, theAddContentLocationHeader, respondGzip, this.request);
	assertEquals(200, result.getStatus());
	assertEquals(null, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
	assertEquals(null, result.getEntity());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:JaxRsResponseDstu3Test.java

示例13: testNoOutcomeXml

import ca.uhn.fhir.rest.server.RestfulServerUtils; //导入方法依赖的package包/类
@Test
public void testNoOutcomeXml() throws IOException {
	response.getRequestDetails().addParameter(Constants.PARAM_FORMAT, new String[]{Constants.CT_XML});
	boolean addContentLocationHeader = true;
	boolean respondGzip = true;
	Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), null, theSummaryMode, 204, addContentLocationHeader, respondGzip, this.request);
	assertEquals(204, result.getStatus());
	assertEquals(null, result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:JaxRsResponseDstu3Test.java


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