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


Java ResponseBuilder.status方法代码示例

本文整理汇总了Java中javax.ws.rs.core.Response.ResponseBuilder.status方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseBuilder.status方法的具体用法?Java ResponseBuilder.status怎么用?Java ResponseBuilder.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.core.Response.ResponseBuilder的用法示例。


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

示例1: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastra litersminute
 * 
 * @param User
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(LitersMinute litersminute) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	Timestamp date = new Timestamp(System.currentTimeMillis());
	litersminute.setDate(date);

	try {
		AirConditioning air = AirConditioningDao.getInstance().getById(litersminute.getAirconditioning().getId());

		if (air.getId().equals(null)) {
			AirConditioningDao.getInstance().insertU(litersminute.getAirconditioning());
		} else {
			litersminute.setAirconditioning(air);
		}

		Long id = LitersMinuteDao.getInstance().insertU(litersminute);
		litersminute.setId(id);

		System.out.println(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date.getTime()));
		System.out.println(date.getTime());
		builder.status(Response.Status.OK).entity(litersminute);

	} catch (SQLException e) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:41,代码来源:LitersMinuteController.java

示例2: getAirConditioningById

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Return all lmin by air
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/byair/{id}")
@Produces("application/json")
public Response getAirConditioningById(@PathParam("id") Long idAir) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		List<LitersMinute> lmin = LitersMinuteDao.getInstance().getByAirId(idAir);

		if (lmin != null) {
			builder.status(Response.Status.OK);
			builder.entity(lmin);

		} else {
			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:31,代码来源:LitersMinuteController.java

示例3: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastra usuario
 * 
 * @param User
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(User user) {

	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {

		Long idUser = (long) UserDao.getInstance().insertU(user);
		user.setId(idUser);
		builder.status(Response.Status.OK).entity(user);

	} catch (SQLException e) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:30,代码来源:UserController.java

示例4: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastra o jardim
 * 
 * @param User
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(Garden garden) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		Long id = (Long) GardenDao.getInstance().insertU(garden);
		garden.setId(id);
		builder.status(Response.Status.OK).entity(garden);

	} catch (SQLException e) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:27,代码来源:GardenController.java

示例5: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastrar air
 * 
 * @param AirConditioning
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(AirConditioning air) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		Long idAir = (long) AirConditioningDao.getInstance().insertU(air);
		air.setId(idAir);
		builder.status(Response.Status.OK).entity(air);

	} catch (SQLException e) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:27,代码来源:AirConditioningController.java

示例6: getAirConditioningById

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Return air by id
 * 
 * @param id
 * @return Response
 */
@PermitAll
@GET
@Path("/{id}")
@Produces("application/json")
public Response getAirConditioningById(@PathParam("id") Long idAirConditioning) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		AirConditioning air = AirConditioningDao.getInstance().getById(idAirConditioning);

		if (air != null) {
			builder.status(Response.Status.OK);
			builder.entity(air);

		} else {
			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:32,代码来源:AirConditioningController.java

示例7: update

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
@PermitAll
@PUT
@Path("/")
@Produces("application/json")
@Consumes("application/json")
public Response update(AirConditioning air) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		AirConditioningDao.getInstance().update(air);
		builder.status(Response.Status.OK).entity(air);

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}
	return builder.build();

}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:20,代码来源:AirConditioningController.java

示例8: getGardenById

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Get Garden by Id
 * 
 * @param idGarden
 * @return Response
 */
@PermitAll
@GET
@Path("/{id}")
@Produces("application/json")
public Response getGardenById(@PathParam("id") Long idGarden) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		Garden garden = GardenDao.getInstance().getById(idGarden);

		if (garden != null) {

			builder.status(Response.Status.OK);
			builder.entity(garden);
		} else {

			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:33,代码来源:GardenController.java

示例9: getGardensByUsername

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Get garden by username's user
 * 
 * @param username
 * @return Response
 */
@PermitAll
@GET
@Path("/username/{username}")
@Produces("application/json")
public Response getGardensByUsername(@PathParam("username") String username) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		List<Garden> gardens = GardenDao.getInstance().getByUsername(username);

		if (gardens != null) {
			builder.status(Response.Status.OK);
			builder.entity(gardens);
			
		} else {
			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:32,代码来源:GardenController.java

示例10: update

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
@PermitAll
@PUT
@Path("/")
@Produces("application/json")
@Consumes("application/json")
public Response update(Garden graden) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		GardenDao.getInstance().update(graden);
		builder.status(Response.Status.OK).entity(graden);

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}
	return builder.build();

}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:20,代码来源:GardenController.java

示例11: getUserByEmail

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
@PermitAll
@GET
@Path("/email/{email}")
@Produces("application/json")
public Response getUserByEmail(@PathParam("email") String email) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {

		User user = UserDao.getInstance().getByEmail(email);

		if (user != null) {

			builder.status(Response.Status.OK);
			builder.entity(user);

		} else {

			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:30,代码来源:UserController.java

示例12: getUserByUsername

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Get user by username
 * 
 * @param username
 * @return
 */
@PermitAll
@GET
@Path("/username/{username}")
@Produces("application/json")
public Response getUserByUsername(@PathParam("username") String username) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {

		User user = UserDao.getInstance().getByUsername(username);

		if (user != null) {

			builder.status(Response.Status.OK);
			builder.entity(user);

		} else {

			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:36,代码来源:UserController.java

示例13: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastra watering
 * 
 * @param Watering
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(Watering watering) {

	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	Timestamp time = new Timestamp(System.currentTimeMillis());
	watering.setTime(time);
	try {

		Long idWatering = (long) WateringDao.getInstance().insert(watering);
		watering.setId(idWatering);
		builder.status(Response.Status.OK).entity(watering);

	} catch (SQLException e) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:32,代码来源:WateringController.java

示例14: getWateringByGardenId

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Get watering by garden's id
 * 
 * @param gardenId
 * @return
 */
@PermitAll
@GET
@Path("/garden/{gardenId}")
@Produces("application/json")
public Response getWateringByGardenId(@PathParam("gardenId") Long gardenId) {

	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {

		List<Watering> waterings = WateringDao.getInstance().getByGardenId(gardenId);

		if (waterings != null) {

			builder.status(Response.Status.OK);
			builder.entity(waterings);
		} else {

			builder.status(Response.Status.NOT_FOUND);
		}

	} catch (SQLException exception) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:36,代码来源:WateringController.java

示例15: insert

import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
/**
 * Cadastra GardenStatus
 * 
 * @param GardenStatus
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(GardenStatus gardenstatus) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	Timestamp time = new Timestamp(System.currentTimeMillis());
	gardenstatus.setTime(time);

	try {
		Garden garden = GardenDao.getInstance().getById(gardenstatus.getGarden().getId());

		if (garden.getId().equals(null)) {
			GardenDao.getInstance().insertU(gardenstatus.getGarden());
		} else {
			gardenstatus.setGarden(garden);
		}
		
		Long id = GardenStatusDao.getInstance().insertU(gardenstatus);
		gardenstatus.setId(id);

		System.out.println(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(time.getTime()));
		System.out.println(time.getTime());
		builder.status(Response.Status.OK).entity(gardenstatus);

	} catch (SQLException e) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:41,代码来源:GardenStatusController.java


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