當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。