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


Java ContainerResponse类代码示例

本文整理汇总了Java中org.glassfish.jersey.server.ContainerResponse的典型用法代码示例。如果您正苦于以下问题:Java ContainerResponse类的具体用法?Java ContainerResponse怎么用?Java ContainerResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: writeResponseStatusAndHeaders_ContextHeaderAndStatusGiven_ShouldUpdateResponseStatusAndHeaders

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void writeResponseStatusAndHeaders_ContextHeaderAndStatusGiven_ShouldUpdateResponseStatusAndHeaders() {
	MultivaluedMap<String, String> actualHeaders = new MultivaluedHashMap<>();
	actualHeaders.add("header0", "value0_0");
	actualHeaders.add("header0", "value0_1");
	actualHeaders.add("header1", "value1_0");
	MultivaluedMap<String, String> expectedHeaders = new MultivaluedHashMap<>();
	expectedHeaders.add("header0", "value0_0");
	expectedHeaders.add("header0", "value0_1");
	expectedHeaders.add("header1", "value1_0");

	ContainerResponse context = mock(ContainerResponse.class);
	when(context.getStatusInfo()).thenReturn(Status.CONFLICT);
	when(context.getStringHeaders()).thenReturn(actualHeaders);

	containerResponseWriter.writeResponseStatusAndHeaders(-1, context);

	assertEquals(Status.CONFLICT, response.getStatusType());
	assertEquals(expectedHeaders, response.getHeaders());
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:21,代码来源:JRestlessContainerResponseWriterTest.java

示例2: listOwnerTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listOwnerTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	ContainerResponse response = call(request("/owners/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(
			getContent(response),
			java.util.List.class,
			org.minnal.examples.petclinic.domain.Owner.class)
			.size(),
			(int) org.minnal.examples.petclinic.domain.Owner
					.count());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:17,代码来源:OwnerResourceTest.java

示例3: listOwnerPetTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listOwnerPetTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();

	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();

	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(getContent(response),
			java.util.List.class,
			org.minnal.examples.petclinic.domain.Pet.class)
			.size(), owner.getPets().size());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:OwnerResourceTest.java

示例4: readOwnerPetTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void readOwnerPetTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId(), HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserialize(getContent(response),
			org.minnal.examples.petclinic.domain.Pet.class)
			.getId(), pet.getId());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:17,代码来源:OwnerResourceTest.java

示例5: updateOwnerPetTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void updateOwnerPetTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet modifiedpet = createDomain(
			org.minnal.examples.petclinic.domain.Pet.class,
			1);
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId(), HttpMethod.PUT,
			serialize(modifiedpet)));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	pet.merge();
	assertTrue(compare(modifiedpet, pet, 1));
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:OwnerResourceTest.java

示例6: deleteOwnerPetTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void deleteOwnerPetTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId(),
			HttpMethod.DELETE));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	response = call(request("/owners/" + owner.getId() + "/pets/"
			+ pet.getId(), HttpMethod.GET, serialize(pet)));
	assertEquals(response.getStatus(),
			Response.Status.NOT_FOUND.getStatusCode());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:19,代码来源:OwnerResourceTest.java

示例7: listOwnerPetVisitTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listOwnerPetVisitTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();

	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();

	org.minnal.examples.petclinic.domain.Visit visit = createDomain(org.minnal.examples.petclinic.domain.Visit.class);
	pet.collection("visits").add(visit);
	pet.persist();

	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId() + "/visits/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(
			getContent(response),
			java.util.List.class,
			org.minnal.examples.petclinic.domain.Visit.class)
			.size(), pet.getVisits().size());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:26,代码来源:OwnerResourceTest.java

示例8: readOwnerPetVisitTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void readOwnerPetVisitTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	org.minnal.examples.petclinic.domain.Visit visit = createDomain(org.minnal.examples.petclinic.domain.Visit.class);
	pet.collection("visits").add(visit);
	pet.persist();
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId() + "/visits/"
					+ visit.getId(), HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserialize(
			getContent(response),
			org.minnal.examples.petclinic.domain.Visit.class)
			.getId(), visit.getId());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:22,代码来源:OwnerResourceTest.java

示例9: updateOwnerPetVisitTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void updateOwnerPetVisitTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	org.minnal.examples.petclinic.domain.Visit visit = createDomain(org.minnal.examples.petclinic.domain.Visit.class);
	pet.collection("visits").add(visit);
	pet.persist();
	org.minnal.examples.petclinic.domain.Visit modifiedvisit = createDomain(
			org.minnal.examples.petclinic.domain.Visit.class,
			1);
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId() + "/visits/"
					+ visit.getId(),
			HttpMethod.PUT, serialize(modifiedvisit)));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	visit.merge();
	assertTrue(compare(modifiedvisit, visit, 1));
}
 
开发者ID:minnal,项目名称:minnal,代码行数:24,代码来源:OwnerResourceTest.java

示例10: deleteOwnerPetVisitTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void deleteOwnerPetVisitTest() {
	org.minnal.examples.petclinic.domain.Owner owner = createDomain(org.minnal.examples.petclinic.domain.Owner.class);
	owner.persist();
	org.minnal.examples.petclinic.domain.Pet pet = createDomain(org.minnal.examples.petclinic.domain.Pet.class);
	owner.collection("pets").add(pet);
	owner.persist();
	org.minnal.examples.petclinic.domain.Visit visit = createDomain(org.minnal.examples.petclinic.domain.Visit.class);
	pet.collection("visits").add(visit);
	pet.persist();
	ContainerResponse response = call(request(
			"/owners/" + owner.getId() + "/pets/"
					+ pet.getId() + "/visits/"
					+ visit.getId(),
			HttpMethod.DELETE));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	response = call(request("/owners/" + owner.getId() + "/pets/"
			+ pet.getId() + "/visits/" + visit.getId(),
			HttpMethod.GET, serialize(visit)));
	assertEquals(response.getStatus(),
			Response.Status.NOT_FOUND.getStatusCode());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:24,代码来源:OwnerResourceTest.java

示例11: listVetSpecialtyTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listVetSpecialtyTest() {
	org.minnal.examples.petclinic.domain.Vet vet = createDomain(org.minnal.examples.petclinic.domain.Vet.class);
	vet.persist();

	org.minnal.examples.petclinic.domain.Specialty specialty = createDomain(org.minnal.examples.petclinic.domain.Specialty.class);
	vet.collection("specialties").add(specialty);
	vet.persist();

	ContainerResponse response = call(request(
			"/vets/" + vet.getId() + "/specialties/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(
			getContent(response),
			java.util.List.class,
			org.minnal.examples.petclinic.domain.Specialty.class)
			.size(), vet.getSpecialties().size());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:21,代码来源:VetResourceTest.java

示例12: readVetSpecialtyTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void readVetSpecialtyTest() {
	org.minnal.examples.petclinic.domain.Vet vet = createDomain(org.minnal.examples.petclinic.domain.Vet.class);
	vet.persist();
	org.minnal.examples.petclinic.domain.Specialty specialty = createDomain(org.minnal.examples.petclinic.domain.Specialty.class);
	vet.collection("specialties").add(specialty);
	vet.persist();
	ContainerResponse response = call(request(
			"/vets/" + vet.getId() + "/specialties/"
					+ specialty.getId(),
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserialize(
			getContent(response),
			org.minnal.examples.petclinic.domain.Specialty.class)
			.getId(), specialty.getId());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:19,代码来源:VetResourceTest.java

示例13: updateVetSpecialtyTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void updateVetSpecialtyTest() {
	org.minnal.examples.petclinic.domain.Vet vet = createDomain(org.minnal.examples.petclinic.domain.Vet.class);
	vet.persist();
	org.minnal.examples.petclinic.domain.Specialty specialty = createDomain(org.minnal.examples.petclinic.domain.Specialty.class);
	vet.collection("specialties").add(specialty);
	vet.persist();
	org.minnal.examples.petclinic.domain.Specialty modifiedspecialty = createDomain(
			org.minnal.examples.petclinic.domain.Specialty.class,
			1);
	ContainerResponse response = call(request(
			"/vets/" + vet.getId() + "/specialties/"
					+ specialty.getId(),
			HttpMethod.PUT, serialize(modifiedspecialty)));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	specialty.merge();
	assertTrue(compare(modifiedspecialty, specialty, 1));
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:VetResourceTest.java

示例14: deleteVetSpecialtyTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void deleteVetSpecialtyTest() {
	org.minnal.examples.petclinic.domain.Vet vet = createDomain(org.minnal.examples.petclinic.domain.Vet.class);
	vet.persist();
	org.minnal.examples.petclinic.domain.Specialty specialty = createDomain(org.minnal.examples.petclinic.domain.Specialty.class);
	vet.collection("specialties").add(specialty);
	vet.persist();
	ContainerResponse response = call(request(
			"/vets/" + vet.getId() + "/specialties/"
					+ specialty.getId(),
			HttpMethod.DELETE));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	response = call(request("/vets/" + vet.getId()
			+ "/specialties/" + specialty.getId(),
			HttpMethod.GET, serialize(specialty)));
	assertEquals(response.getStatus(),
			Response.Status.NOT_FOUND.getStatusCode());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:VetResourceTest.java

示例15: listPetTypeTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listPetTypeTest() {
	org.minnal.examples.petclinic.domain.PetType petType = createDomain(org.minnal.examples.petclinic.domain.PetType.class);
	petType.persist();
	ContainerResponse response = call(request("/pet_types/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(
			getContent(response),
			java.util.List.class,
			org.minnal.examples.petclinic.domain.PetType.class)
			.size(),
			(int) org.minnal.examples.petclinic.domain.PetType
					.count());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:17,代码来源:PetTypeResourceTest.java


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