Java 类javax.annotation.security.PermitAll 实例源码

项目:Celebino    文件:LitersMinuteController.java   
/**
 * 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();
}
项目:Celebino    文件:LitersMinuteController.java   
/**
 * 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();
}
项目:jobson    文件:JobResource.java   
@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));
}
项目:outland    文件:GroupResource.java   
@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();
}
项目:outland    文件:GroupResource.java   
@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();
}
项目:oasp-tutorial-sources    文件:SecurityRestServiceImpl.java   
/**
 * 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;
}
项目:Celebino    文件:GardenController.java   
/**
 * 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();
}
项目:Celebino    文件:GardenController.java   
/**
 * 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;
}
项目:Celebino    文件:UserController.java   
/**
 * 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();
}
项目:Celebino    文件:UserController.java   
/**
 * 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;
}
项目:Celebino    文件:WateringController.java   
/**
 * 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;
}
项目:Celebino    文件:GardenStatusController.java   
/**
 * 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;
}
项目:Celebino    文件:AirConditioningController.java   
/**
 * 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;
}
项目:Celebino    文件:AirConditioningController.java   
/**
 * 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();
}
项目:Celebino    文件:LitersMinuteController.java   
/**
 * 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;
}
项目:jobson    文件:JobResource.java   
@GET
@Path("{job-id}")
@ApiOperation(
        value = "Get details of a job managed by the system.",
        code = 200,
        notes = "")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Job details found", response = APIJobDetails.class),
        @ApiResponse(code = 404, message = "The job could not be found", response = APIErrorMessage.class),
        @ApiResponse(code = 401, message = "Client not authorized to request job details", response = APIErrorMessage.class)
})
@PermitAll
public Optional<APIJobDetails> getJobDetailsById(
        @Context
                SecurityContext context,
        @ApiParam(value = "The job's ID")
        @PathParam("job-id")
        @NotNull
                JobId jobId) {

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

    return jobDAO.getJobDetailsById(jobId).map(this::toJobResponse);
}
项目:jobson    文件:JobResource.java   
@POST
@Path("/{job-id}/abort")
@ApiOperation(
        value = "Abort a running job",
        notes = "Abort a job, stopping it or removing it from the job execute. The job's status " +
                "should immediately change to aborting. However, full job abortion is not guaranteed " +
                "to be immediate. This is because the underlying job may take time to close gracefully " +
                "or because the system itself has a short delay before forcibly killing the job outright.")
@PermitAll
public void abortJob(
        @Context
                SecurityContext context,
        @ApiParam(value = "ID of the job to abort")
        @PathParam("job-id")
        @NotNull
                JobId jobId) {

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

    if (jobDAO.jobExists(jobId)) {
        if (jobManagerActions.tryAbort(jobId)) return;
        else throw new WebApplicationException("Job cannot be aborted", 400);
    } else throw new WebApplicationException("Job cannot be found", 400);
}
项目:jobson    文件:JobResource.java   
@GET
@Path("/{job-id}/stdout")
@ApiOperation(
        value = "Get a job's standard output",
        notes = "Get a job's standard output, if available. A job that has not yet started will not have a standard output and, " +
                "therefore, this method will return a 404. There is no guarantee that all running/finished jobs will have standard output " +
                "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 fetchJobStdoutById(
        @Context
                SecurityContext context,
        @ApiParam(value = "ID of the job to get stdout for")
        @PathParam("job-id")
        @NotNull
        JobId jobId) {

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

    return generateBinaryDataResponse(jobId, jobDAO.getStdout(jobId));
}
项目:jobson    文件:JobResource.java   
@GET
@Path("/{job-id}/spec")
@ApiOperation(
        value = "Get the spec the job was submitted against",
        notes = "Get the spec the job was submitted against. Note: This returns the exact spec the job was submitted" +
                " against. Any updates to the spec will not be reflected.")
@PermitAll
public Optional<APIJobSpec> fetchJobSpecJobWasSubmittedAgainst(
        @Context
                SecurityContext context,
        @ApiParam(value = "ID of the job to get the spec for")
        @PathParam("job-id")
        @NotNull
                JobId jobId) {

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

    return jobDAO.getSpecJobWasSubmittedAgainst(jobId)
            .map(APIJobSpec::fromJobSpec);
}
项目:jobson    文件:JobResource.java   
@GET
@Path("/{job-id}/inputs")
@ApiOperation(
        value = "Get the job's inputs",
        notes = "Get the inputs that were supplied when the job was submitted.")
@PermitAll
public Optional<Map<JobExpectedInputId, JsonNode>> fetchJobInputs(
        @Context
                SecurityContext context,
        @ApiParam(value = "ID of the job to get inputs for")
        @PathParam("job-id")
        @NotNull
                JobId jobId) {

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

    return jobDAO.getJobInputs(jobId);
}
项目:jboss-eap7.1-playground    文件:DelegateROCBean.java   
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@PermitAll
@Override
public void checkTransactionBehaviour(boolean setLocalRollbackOnly, boolean throwLocalException, boolean setRemoteRollbackOnly, boolean throwRemoteException, boolean expectedToCommit) throws NamingException {
    txRegistry.registerInterposedSynchronization(new TxSyncInterceptor(!expectedToCommit));

    proxy.checkTransactionContext(setRemoteRollbackOnly, throwRemoteException, expectedToCommit);

    if(setLocalRollbackOnly) {
        context.setRollbackOnly();
        log.warning("Rollback set!");
    }
    if(throwLocalException) {
        throw new RuntimeException("Forced failure!");
    }
    log.info("Method done");
}
项目:traccar-service    文件:UserResource.java   
@Override
@PermitAll
@POST
public Response add(User entity) throws SQLException {
    if (!Context.getPermissionsManager().getUserAdmin(getUserId())) {
        Context.getPermissionsManager().checkUserUpdate(getUserId(), new User(), entity);
        if (Context.getPermissionsManager().getUserManager(getUserId())) {
            Context.getPermissionsManager().checkUserLimit(getUserId());
        } else {
            Context.getPermissionsManager().checkRegistration(getUserId());
            entity.setDeviceLimit(Context.getConfig().getInteger("users.defaultDeviceLimit", -1));
            int expirationDays = Context.getConfig().getInteger("users.defaultExpirationDays");
            if (expirationDays > 0) {
                entity.setExpirationTime(
                    new Date(System.currentTimeMillis() + (long) expirationDays * 24 * 3600 * 1000));
            }
        }
    }
    Context.getUsersManager().addItem(entity);
    if (Context.getPermissionsManager().getUserManager(getUserId())) {
        Context.getDataManager().linkObject(User.class, getUserId(), ManagedUser.class, entity.getId(), true);
    }
    Context.getUsersManager().refreshUserItems();
    return Response.ok(entity).build();
}
项目:task-app    文件:InfoResource.java   
@GET
@Produces(MediaType.TEXT_PLAIN)
@PermitAll
@Path("/info")
public String info() {
    StringBuilder sb = new StringBuilder();
    sb.append("Task app client api v1 runnig.\n");
    try {
        sb.append("TMP DIR: ").append(taskDao.getAppProperty(AppProperty.TMP_DIR, "NOT SET")).append("\n");
        sb.append("TIMEOUT: ").append(taskDao.getAppProperty(AppProperty.TIMEOUT, "NOT SET")).append("\n");
        sb.append("DELETE FINISHED: ").append(taskDao.getAppProperty(AppProperty.DELETE_FINISHED, "NOT SET")).append("\n");
    } catch (Exception e) {
        sb.append(ThrowableUtil.createMessage(e));
    }
    return sb.toString();
}
项目:holon-vaadin    文件:SecurityAnnotationsViewAccessControl.java   
@Override
public boolean isAccessGranted(UI ui, String beanName) {

    if (applicationContext.findAnnotationOnBean(beanName, DenyAll.class) != null) {
        // DenyAll (no authentication required)
        return false;
    }
    if (applicationContext.findAnnotationOnBean(beanName, PermitAll.class) != null) {
        // PermitAll (no authentication required)
        return true;
    }

    // RolesAllowed - authentication required
    RolesAllowed ra = applicationContext.findAnnotationOnBean(beanName, RolesAllowed.class);
    if (ra != null) {

        // check authentication
        final AuthContext authContext = AuthContext.getCurrent()
                .orElseThrow(() -> new IllegalStateException("No AuthContext available as Context resource: "
                        + "failed to validate RolesAllowed security annotation on View bean name [" + beanName
                        + "]"));
        if (!authContext.getAuthentication().isPresent()) {
            // not authenticated
            return false;
        }

        // check permissions
        if (ra.value().length > 0) {
            // for empty roles names, no role is required, only authentication
            if (!authContext.isPermittedAny(ra.value())) {
                // no roles matches (with ANY semantic)
                return false;
            }
        }
    }

    return true;
}
项目:minebox    文件:RemoteTokenResource.java   
@GET
@Path("/getMetadataToken")
@Produces("text/plain")
@PermitAll
public Response getMetadataToken() {
    final Optional<String> token = remoteTokenService.getToken();
    if (token.isPresent()) {
        return Response.ok(token).build();
    } else {
        return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("unable to get token").build();
    }
}
项目:minebox    文件:SerialNoResource.java   
@GET
@Produces("text/plain")
@PermitAll
public Response getSerialNumber() {
    final ListenableFuture<String> masterPassword = encyptionKeyProvider.getMasterPassword();
    if (!masterPassword.isDone()) {
        return Response.status(Response.Status.PRECONDITION_FAILED)
                .entity("Key is not set yet..")
                .build();
    }
    return Response
            .ok(serialNumberService.getPublicIdentifier())
            .build();
}
项目:tools    文件:SerialNoResource.java   
@GET
@Produces("text/plain")
@PermitAll
public Response getSerialNumber() {
    final ListenableFuture<String> masterPassword = encyptionKeyProvider.getMasterPassword();
    if (!masterPassword.isDone()) {
        return Response.status(Response.Status.PRECONDITION_FAILED)
                .entity("Key is not set yet..")
                .build();
    }
    return Response
            .ok(serialNumberService.getPublicIdentifier())
            .build();
}
项目:minebox    文件:StatusResource.java   
@GET
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
public Status getStatus() {
    //todo extract to status service
    final Status status = new Status();
    status.hasEncryptionKey = encyptionKeyProvider.getMasterPassword().isDone();
    if (!status.hasEncryptionKey) {
        return status;
    }
    if (downloadFactory.hasDownloadService()) {
        final DownloadService downloadService = downloadFactory.get();
        status.connectedMetadata = downloadService.connectedMetadata();
        if (!status.connectedMetadata) {
            return status;
        }
        status.remoteMetadataDetected = downloadService.hasMetadata();
        if (!status.remoteMetadataDetected) {
            return status;
        }
        if (status.hasEncryptionKey) {
            final File firstDir = new File(parentDirs.get(0), serialNumberService.getPublicIdentifier());
            status.completedRestorePercent = downloadService.completedPercent(firstDir);
        }
        status.restoreRunning = status.completedRestorePercent < 100.0;
    } else {
        status.connectedMetadata = false;
        status.hasEncryptionKey = false;
        status.remoteMetadataDetected = false;
        status.restoreRunning = false;
    }
    return status;
}
项目:minebox    文件:PauseResource.java   
@PUT
@ApiOperation(value = "causes the MineBD deamon to not flush files for 1.5 seconds. this is to avoid having nonequal .dat files with equal last-write date",
        response = String.class)

@Produces("text/plain")
@PermitAll
public String pause() {
    final Instant instant = mineboxExportProvider.get().blockFlushFor1500Millis();
    return "Not flushing files until " + instant.atZone(ZoneId.systemDefault()).toString() + "\n";
}
项目:InComb    文件:LoggedInUserService.java   
/**
 * Returns the currently logged in user from the current session
 * @param con is injected automatically
 * @return {@link UserModel}
 */
@GET
@PermitAll
public Response getLoggedInUser(@Context final Connection con) {
    final User loggedIn = (User) getSessionAttribute(SESSIONATTR_LOGGEDIN);
    if(loggedIn == null) {
        throw new NotFoundException();
    }

    return ok(UserUtil.getModel(true, loggedIn, con));
}
项目:jboss-eap7.1-playground    文件:SimpleBean.java   
@PermitAll
@Override
public boolean checkApplicationUser(String userName) {
    Principal caller = context.getCallerPrincipal();

    if(!userName.equals(caller.getName())) {
        log.warning("Given user name '" + userName + "' not equal to real use name '" + caller.getName() + "'");
        return false;
    }else{
        log.info("SimpleBean invoked with expected user '" + userName + "'");
        return true;
    }
}
项目:holon-vaadin7    文件:SecurityAnnotationsViewAccessControl.java   
@Override
public boolean isAccessGranted(UI ui, String beanName) {

    if (applicationContext.findAnnotationOnBean(beanName, DenyAll.class) != null) {
        // DenyAll (no authentication required)
        return false;
    }
    if (applicationContext.findAnnotationOnBean(beanName, PermitAll.class) != null) {
        // PermitAll (no authentication required)
        return true;
    }

    // RolesAllowed - authentication required
    RolesAllowed ra = applicationContext.findAnnotationOnBean(beanName, RolesAllowed.class);
    if (ra != null) {

        // check authentication
        final AuthContext authContext = AuthContext.getCurrent()
                .orElseThrow(() -> new IllegalStateException("No AuthContext available as Context resource: "
                        + "failed to validate RolesAllowed security annotation on View bean name [" + beanName
                        + "]"));
        if (!authContext.getAuthentication().isPresent()) {
            // not authenticated
            return false;
        }

        // check permissions
        if (ra.value().length > 0) {
            // for empty roles names, no role is required, only authentication
            if (!authContext.isPermittedAny(ra.value())) {
                // no roles matches (with ANY semantic)
                return false;
            }
        }
    }

    return true;
}
项目:outland    文件:GroupResource.java   
@POST
@Path("/{group}/owners")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
@Timed(name = "addOwner")
public Response addOwner(
    @Auth AuthPrincipal authPrincipal,
    @PathParam("group") String group,
    Owner owner
) throws AuthenticationException {
  return postUpdate(authPrincipal, group, ns -> groupService.add(ns, owner));
}
项目:outland    文件:GroupResource.java   
@POST
@Path("/{group}/access/services")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
@Timed(name = "addService")
public Response addService(
    @Auth AuthPrincipal authPrincipal,
    @PathParam("group") String group,
    ServiceAccess serviceAccess
) throws AuthenticationException {
  return postUpdate(authPrincipal, group, ns -> groupService.add(ns, serviceAccess));
}
项目:jboss-eap7.1-playground    文件:SimpleBean.java   
@Override
@PermitAll
public String getJBossServerName() {
    Principal caller = context.getCallerPrincipal();
    String serverName = System.getProperty("jboss.server.name");

    log.info("[" + caller.getName() + "] ServerName is " + serverName);

    return serverName;
}
项目:jboss-eap7.1-playground    文件:DelegateROCBean.java   
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@PermitAll
@Override
public void checkTransactionStickyness() {

    HashSet<String> servers = new HashSet<String>();
    for(int i = 0 ; i <20 ; i++) {
        servers.add(proxy.getJBossServerNameInRunningTx());
    }
    if(servers.size() != 1) {
        log.severe("Unexpected list of target servers : " + servers);
        throw new RuntimeException("Tx seems not to be sticky servers are : " + servers);
    }
    log.info("Method done");
}
项目:outland    文件:GroupResource.java   
@DELETE
@Path("/{group}/owners/{owner_key}")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
@Timed(name = "removeOwner")
public Response removeOwner(
    @Auth AuthPrincipal authPrincipal,
    @PathParam("group") String groupKey,
    @PathParam("owner_key") String ownerKey
) throws AuthenticationException {
  final long start = System.currentTimeMillis();

  if (Strings.isNullOrEmpty(ownerKey)) {
    return headers.enrich(Response.status(404).entity(
        Problem.clientProblem("param_not_found", "", 404)), start).build();
  }

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

  if (maybe.isPresent()) {
    final Group group = maybe.get();
    accessControlSupport.throwUnlessGrantedFor(authPrincipal, group);
    final Group updated = groupService.removeOwner(group, ownerKey);
    return headers.enrich(Response.ok(updated), start).build();
  }

  return headers.enrich(Response.status(404).entity(
      Problem.clientProblem(GroupResource.TITLE_NOT_FOUND, "", 404)), start).build();
}
项目:outland    文件:FeatureResource.java   
@POST
@Path("/{group}")
@PermitAll
@Timed(name = "registerFeature")
public Response registerFeature(
    @Auth AuthPrincipal principal,
    Feature feature,
    @Context HttpHeaders httpHeaders
) throws AuthenticationException {

  final long start = System.currentTimeMillis();

  final Optional<Group> maybe = groupService.loadByKey(feature.getGroup());
  if (!maybe.isPresent()) {
    return notFound(start);
  }

  accessControlSupport.throwUnlessGrantedFor(principal, maybe.get());

  final URI loc = locationUrl(feature);

  final Optional<String> maybeSeen = idempotencyChecker.extractKey(httpHeaders);
  if (maybeSeen.isPresent() && idempotencyChecker.seen(maybeSeen.get())) {
    return respondAlreadyCreated(feature, start, loc, maybeSeen);
  }

  return headers.enrich(
      Response.created(loc).entity(featureService.registerFeature(feature)), start).build();
}
项目:jboss-eap7.1-playground    文件:SimpleBean.java   
@Override
@PermitAll
public void logText(String text) {
    Principal caller = context.getCallerPrincipal();
    log.info("[" + caller.getName() + "] Invocation granted with @permitAll  message: " + text);

    return;
}
项目:outland    文件:FeatureResource.java   
@GET
@Path("/{group}")
@PermitAll
@Timed(name = "getFeatures")
public Response getFeatures(
    @Auth AuthPrincipal principal,
    @PathParam("group") String group
) throws AuthenticationException {

  final long start = System.currentTimeMillis();
  grantedGuard(principal, group);
  return this.headers.enrich(Response.ok(featureService.loadFeatures(group)), start).build();
}