• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ContainerResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: listOrderPaymentTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listOrderPaymentTest() {
	org.minnal.examples.oms.domain.Order order = createDomain(org.minnal.examples.oms.domain.Order.class);
	order.persist();

	org.minnal.examples.oms.domain.Payment payment = createDomain(org.minnal.examples.oms.domain.Payment.class);
	order.collection("payments").add(payment);
	order.persist();

	ContainerResponse response = call(request(
			"/orders/" + order.getId() + "/payments/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(getContent(response),
			java.util.List.class,
			org.minnal.examples.oms.domain.Payment.class)
			.size(), order.getPayments().size());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:OrderResourceTest.java


示例17: readOrderPaymentTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void readOrderPaymentTest() {
	org.minnal.examples.oms.domain.Order order = createDomain(org.minnal.examples.oms.domain.Order.class);
	order.persist();
	org.minnal.examples.oms.domain.Payment payment = createDomain(org.minnal.examples.oms.domain.Payment.class);
	order.collection("payments").add(payment);
	order.persist();
	ContainerResponse response = call(request(
			"/orders/" + order.getId() + "/payments/"
					+ payment.getId(),
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserialize(getContent(response),
			org.minnal.examples.oms.domain.Payment.class)
			.getId(), payment.getId());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:18,代码来源:OrderResourceTest.java


示例18: updateOrderPaymentTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void updateOrderPaymentTest() {
	org.minnal.examples.oms.domain.Order order = createDomain(org.minnal.examples.oms.domain.Order.class);
	order.persist();
	org.minnal.examples.oms.domain.Payment payment = createDomain(org.minnal.examples.oms.domain.Payment.class);
	order.collection("payments").add(payment);
	order.persist();
	org.minnal.examples.oms.domain.Payment modifiedpayment = createDomain(
			org.minnal.examples.oms.domain.Payment.class, 1);
	ContainerResponse response = call(request(
			"/orders/" + order.getId() + "/payments/"
					+ payment.getId(),
			HttpMethod.PUT, serialize(modifiedpayment)));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	payment.merge();
	assertTrue(compare(modifiedpayment, payment, 1));
}
 
开发者ID:minnal,项目名称:minnal,代码行数:19,代码来源:OrderResourceTest.java


示例19: deleteOrderPaymentTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void deleteOrderPaymentTest() {
	org.minnal.examples.oms.domain.Order order = createDomain(org.minnal.examples.oms.domain.Order.class);
	order.persist();
	org.minnal.examples.oms.domain.Payment payment = createDomain(org.minnal.examples.oms.domain.Payment.class);
	order.collection("payments").add(payment);
	order.persist();
	ContainerResponse response = call(request(
			"/orders/" + order.getId() + "/payments/"
					+ payment.getId(),
			HttpMethod.DELETE));
	assertEquals(response.getStatus(),
			Response.Status.NO_CONTENT.getStatusCode());
	response = call(request("/orders/" + order.getId()
			+ "/payments/" + payment.getId(),
			HttpMethod.GET, serialize(payment)));
	assertEquals(response.getStatus(),
			Response.Status.NOT_FOUND.getStatusCode());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:OrderResourceTest.java


示例20: listOrderOrderItemTest

import org.glassfish.jersey.server.ContainerResponse; //导入依赖的package包/类
@Test
public void listOrderOrderItemTest() {
	org.minnal.examples.oms.domain.Order order = createDomain(org.minnal.examples.oms.domain.Order.class);
	order.persist();

	org.minnal.examples.oms.domain.OrderItem orderItem = createDomain(org.minnal.examples.oms.domain.OrderItem.class);
	order.collection("orderItems").add(orderItem);
	order.persist();

	ContainerResponse response = call(request(
			"/orders/" + order.getId() + "/order_items/",
			HttpMethod.GET));
	assertEquals(response.getStatus(),
			Response.Status.OK.getStatusCode());
	assertEquals(deserializeCollection(getContent(response),
			java.util.List.class,
			org.minnal.examples.oms.domain.OrderItem.class)
			.size(), order.getOrderItems().size());
}
 
开发者ID:minnal,项目名称:minnal,代码行数:20,代码来源:OrderResourceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HibernateTransactionManager类代码示例发布时间:2022-05-21
下一篇:
Java ValidationResult类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap