本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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));
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}