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


Java PermitAll类代码示例

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


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

示例1: insert

import javax.annotation.security.PermitAll; //导入依赖的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.annotation.security.PermitAll; //导入依赖的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.annotation.security.PermitAll; //导入依赖的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: fetchJobStderrById

import javax.annotation.security.PermitAll; //导入依赖的package包/类
@GET
@Path("/{job-id}/stderr")
@ApiOperation(
        value = "Get the job's standard error",
        notes = "Get the job's standard error, if available. A job that has not yet starrted will not have a standard error and, " +
                "therefore, this method will return a 404. There is no guarantee that all running/finished jobs will have standard " +
                "error data. This is because administrative and cleanup routines may dequeue a job's output in order to save space on " +
                "the server.")
@Produces(DEFAULT_BINARY_MIME_TYPE)
@PermitAll
public Response fetchJobStderrById(
        @Context
                SecurityContext context,
        @ApiParam(value = "ID of the job to get stderr for")
        @PathParam("job-id")
        @NotNull
        JobId jobId) {

    if (jobId == null)
        throw new WebApplicationException("Job ID cannot be null", 400);

    return generateBinaryDataResponse(jobId, jobDAO.getStderr(jobId));
}
 
开发者ID:adamkewley,项目名称:jobson,代码行数:24,代码来源:JobResource.java

示例5: getByKey

import javax.annotation.security.PermitAll; //导入依赖的package包/类
@GET
@Path("/{group}")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
@Timed(name = "getByKey")
public Response getByKey(
    @Auth AuthPrincipal authPrincipal,
    @PathParam("group") String group
) throws AuthenticationException {

  final long start = System.currentTimeMillis();
  final Optional<Group> maybe = findGroup(group);

  if (maybe.isPresent()) {
    accessControlSupport.throwUnlessGrantedFor(authPrincipal, maybe.get());
    return headers.enrich(Response.ok(maybe.get()), start).build();
  }

  return headers.enrich(Response.status(404).entity(
      Problem.clientProblem(GroupResource.TITLE_NOT_FOUND, "", 404)), start).build();
}
 
开发者ID:dehora,项目名称:outland,代码行数:22,代码来源:GroupResource.java

示例6: removeMember

import javax.annotation.security.PermitAll; //导入依赖的package包/类
@DELETE
@Path("/{group}/access/members/{member_key}")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
@Timed(name = "removeMember")
public Response removeMember(
    @Auth AuthPrincipal authPrincipal,
    @PathParam("group") String groupKey,
    @PathParam("member_key") String memberKey
) throws AuthenticationException {
  final long start = System.currentTimeMillis();

  final Optional<Group> maybe = findGroup(groupKey);

  if (maybe.isPresent()) {
    final Group group = maybe.get();
    accessControlSupport.throwUnlessGrantedFor(authPrincipal, group);
    final Group updated = groupService.removeMemberAccess(group, memberKey);

    return headers.enrich(Response.ok(updated), start).build();
  }

  return headers.enrich(Response.status(404).entity(
      Problem.clientProblem(TITLE_NOT_FOUND, "", 404)), start).build();
}
 
开发者ID:dehora,项目名称:outland,代码行数:26,代码来源:GroupResource.java

示例7: getCsrfToken

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * Retrieves the CSRF token from the server session.
 *
 * @param request {@link HttpServletRequest} to retrieve the current session from
 * @param response {@link HttpServletResponse} to send additional information
 * @return the Spring Security {@link CsrfToken}
 */
@Produces(MediaType.APPLICATION_JSON)
@GET
@Path("/csrftoken/")
@PermitAll
public CsrfToken getCsrfToken(@Context HttpServletRequest request, @Context HttpServletResponse response) {

  // return (CsrfToken) request.getSession().getAttribute(
  // HttpSessionCsrfTokenRepository.class.getName().concat(".CSRF_TOKEN"));
  CsrfToken token = this.csrfTokenRepository.loadToken(request);
  if (token == null) {
    LOG.warn("No CsrfToken could be found - instanciating a new Token");
    token = this.csrfTokenRepository.generateToken(request);
    this.csrfTokenRepository.saveToken(token, request, response);
  }
  return token;
}
 
开发者ID:oasp,项目名称:oasp-tutorial-sources,代码行数:24,代码来源:SecurityRestServiceImpl.java

示例8: insert

import javax.annotation.security.PermitAll; //导入依赖的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

示例9: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * retorna todos os jardins.
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<Garden> getAll() {
	List<Garden> gardens = new ArrayList<Garden>();

	try {
		gardens = GardenDao.getInstance().getAll();
	} catch (SQLException e) {
		// TRATAR EXCECAO
	}

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

示例10: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * retorna todos os usuarios.
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<User> getAll() {

	List<User> users = new ArrayList<User>();

	try {

		users = UserDao.getInstance().getAll();

	} catch (SQLException e) {
		// TRATAR EXCECAO
	}

	return users;
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:24,代码来源:UserController.java

示例11: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * retorna todos os waterings.
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<Watering> getAll() {

	List<Watering> waterings = new ArrayList<Watering>();

	try {

		waterings = WateringDao.getInstance().getAll();

	} catch (SQLException e) {
		// TRATAR EXCECAO
	}

	return waterings;
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:24,代码来源:WateringController.java

示例12: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * retorna todos os gardenstatus.
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<GardenStatus> getAll() {

	List<GardenStatus> gardenstatus = new ArrayList<GardenStatus>();

	try {

		gardenstatus = GardenStatusDao.getInstance().getAll();

	} catch (SQLException e) {
		// TRATAR EXCECAO
	}

	return gardenstatus;
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:24,代码来源:GardenStatusController.java

示例13: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * Return all air.
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<AirConditioning> getAll() {
	List<AirConditioning> airConditionings = new ArrayList<>();

	try {
		airConditionings = AirConditioningDao.getInstance().getAll();
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

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

示例14: getAirConditioningById

import javax.annotation.security.PermitAll; //导入依赖的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

示例15: getAll

import javax.annotation.security.PermitAll; //导入依赖的package包/类
/**
 * Return all lmin
 * 
 * @return Response
 */
@PermitAll
@GET
@Path("/")
@Produces("application/json")
public List<LitersMinute> getAll() {
	List<LitersMinute> lmin = new ArrayList<>();

	try {
		lmin = LitersMinuteDao.getInstance().getAll();

	} catch (SQLException e) {
		// TRATAR EXCECAO
	}

	return lmin;
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:22,代码来源:LitersMinuteController.java


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