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


Java ResponseBuilder.expires方法代码示例

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


在下文中一共展示了ResponseBuilder.expires方法的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: 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

示例3: 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

示例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: getGardensByUserId

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

	try {
		List<Garden> gardens = GardenDao.getInstance().getByUserId(userId);

		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,代码行数:31,代码来源:GardenController.java

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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