Java 类io.dropwizard.jersey.caching.CacheControl 实例源码

项目:SciGraph    文件:GraphService.java   
@GET
@Path("/{id}")
@ApiOperation(value = "Get all properties of a node", response = Graph.class)
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
@Produces({MediaType.APPLICATION_JSON, CustomMediaTypes.APPLICATION_GRAPHSON,
    MediaType.APPLICATION_XML, CustomMediaTypes.APPLICATION_GRAPHML,
    CustomMediaTypes.APPLICATION_XGMML, CustomMediaTypes.TEXT_GML, CustomMediaTypes.TEXT_CSV,
    CustomMediaTypes.TEXT_TSV, CustomMediaTypes.IMAGE_JPEG, CustomMediaTypes.IMAGE_PNG})
public Object getNode(
    @ApiParam(value = DocumentationStrings.GRAPH_ID_DOC,
        required = true) @PathParam("id") String id,
    @ApiParam(value = DocumentationStrings.PROJECTION_DOC,
        required = false) @QueryParam("project") @DefaultValue("*") Set<String> projection,
    @ApiParam(value = DocumentationStrings.JSONP_DOC,
        required = false) @QueryParam("callback") String callback) {
  return getNeighbors(id, new IntParam("0"), new BooleanParam("false"), Optional.<String>empty(),
      null, new BooleanParam("false"), projection, callback);
}
项目:dropwizard-microservices-example    文件:ProductCatalogResource.java   
@GET
@Timed(name = "showAll-timed-get")
@Metered(name = "showAll-metered-get")
@ExceptionMetered
@CacheControl(maxAge = 12, maxAgeUnit = TimeUnit.HOURS)
public List<ProductCatalogRepresentation> getAllProductCatalog() {
    LOGGER.info("Retrieving all product catalog details of the product");
    List<ProductCatalog> details = productCatalogService.getAllProductDetails();
    if (details == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    LOGGER.debug("Product details:" + details.toString());
    List<ProductCatalogRepresentation> representations = new ArrayList<>();
    for (ProductCatalog detail : details) {
        representations.add(ProductRepresentationDomainConverter.toRepresentation(detail));
    }
    return representations;
}
项目:dropwizard-microservices-example    文件:ProductReviewResource.java   
@GET
@Path("/{skuId}")
@Timed(name = "showAll-timed-get")
@Metered(name = "showAll-metered-get")
@ExceptionMetered
@CacheControl(maxAge = 12, maxAgeUnit = TimeUnit.HOURS)
public List<ProductReviewRepresentation> getAllProductReviews(@PathParam("skuId") String skuId) {
    LOGGER.info("Retrieving all product reviews of the product:" + skuId);
    List<ProductReview> reviews = productReviewService.getAllProductReviews(skuId);
    if (reviews == null || reviews.isEmpty()) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    List<ProductReviewRepresentation> representations = new ArrayList<>();
    for (ProductReview review : reviews) {
        representations.add(ProductReviewRepresentationDomainConverter.toRepresentation(review));
    }
    return representations;
}
项目:dropwizard-microservices-example    文件:ProductResource.java   
@GET
@Path("/{id}")
@Timed(name = "showAll-timed-get")
@Metered(name = "showAll-metered-get")
@ExceptionMetered
@CacheControl(maxAge = 12, maxAgeUnit = TimeUnit.SECONDS)
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public ProductRepresentation getProductCatalog(@Auth User user, @PathParam("id") String id) throws Exception {
    LOGGER.info("Fetching the product catalog for the product with id:" + id);
    ProductRepresentation product = new ProductRepresentation();
    JSONObject productCatalog = productCatalogClient.getProductCatalog(id);
    if (productCatalog == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    product.setProductCatalog((HashMap<String, Object>) productCatalog.toMap());
    List<HashMap<String, Object>> reviewList = new ArrayList<>();
    List<Object> reviews = productReviewClient.getProductReviews(id).toList();
    for (Object review : reviews) {
        reviewList.add((HashMap<String, Object>) review);
    }
    product.setProductReviews(reviewList);
    return product;
}
项目:SciGraph    文件:VocabularyService.java   
@GET
@Path("/id/{id}")
@ApiOperation(value = "Find a concept by its ID",
notes = "Find concepts that match either a IRI or a CURIE. ",
response = ConceptDTO.class)
@ApiResponses({
  @ApiResponse(code = 404, message = "Concept with ID could not be found")
})
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public ConceptDTO findById(
    @ApiParam( value = "ID to find", required = true)
    @PathParam("id") String id) throws Exception {
  Vocabulary.Query query = new Vocabulary.Query.Builder(id).build();
  Optional<Concept> concept = vocabulary.getConceptFromId(query);
  if (!concept.isPresent()) {
    throw new WebApplicationException(404);
  } else {
    ConceptDTO dto = conceptDtoTransformer.apply(concept.get());
    return dto;
  }
}
项目:SciGraph    文件:VocabularyService.java   
@GET
@Path("/suggestions/{term}")
@ApiOperation(value = "Suggest terms",
notes = "Suggests terms based on a mispelled or mistyped term.",
response = String.class,
responseContainer = "List")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Object suggestFromTerm(
    @ApiParam( value = "Mispelled term", required = true )
    @PathParam("term") String term,
    @ApiParam( value = DocumentationStrings.RESULT_LIMIT_DOC, required = false )
    @QueryParam("limit") @DefaultValue("1") IntParam limit) {
  List<String> suggestions = newArrayList(Iterables.limit(vocabulary.getSuggestions(term), limit.get()));
  return suggestions;
}
项目:snowizard    文件:IdResource.java   
/**
 * Get one or more IDs as a Google Protocol Buffer response
 *
 * @param agent
 *            User Agent
 * @param count
 *            Number of IDs to return
 * @return generated IDs
 */
@GET
@Timed
@Produces(ProtocolBufferMediaType.APPLICATION_PROTOBUF)
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public SnowizardResponse getIdAsProtobuf(
        @HeaderParam(HttpHeaders.USER_AGENT) final String agent,
        @QueryParam("count") final Optional<IntParam> count) {

    final List<Long> ids = Lists.newArrayList();
    if (count.isPresent()) {
        for (int i = 0; i < count.get().get(); i++) {
            ids.add(getId(agent));
        }
    } else {
        ids.add(getId(agent));
    }
    return SnowizardResponse.newBuilder().addAllId(ids).build();
}
项目:http-caching-and-concurrency-examples    文件:DaylightResource.java   
@GET
@CacheControl(maxAge = 1, maxAgeUnit = DAYS)
public Response get() {
    DaylightDto daylight = new DaylightDto();
    daylight.setSunrise(OffsetTime.of(6, 0, 0, 0, STOCKHOLM_OFFSET));
    daylight.setSunset(OffsetTime.of(18, 0, 0, 0, STOCKHOLM_OFFSET));
    return Response.ok(daylight).expires(endOfTheDayUtcTime()).build();
}
项目:openregister-java    文件:CacheNoTransformFilterFactory.java   
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
    /* don't add a header if the method provides its own annotation */
    CacheControl cacheControl = resourceInfo.getResourceMethod().getAnnotation(CacheControl.class);
    if (cacheControl == null) {
        context.register(NO_TRANSFORM_FILTER);
    }
}
项目:sam    文件:OAuth2Resource.java   
@GET
@PermitAll
@Path("/services/oauth2/user")
@CacheControl(noCache = true)
@ApiOperation("Get authenticated user.")
public User getAuthenticatedUser(
  @Context SecurityContext securityContext
) {
  return RestHelper.getUser(securityContext);
}
项目:dropwizard-microservices-example    文件:ProductCatalogResource.java   
@GET
@Path("/{id}")
@Timed(name = "showAll-timed-get")
@Metered(name = "showAll-metered-get")
@ExceptionMetered
@CacheControl(maxAge = 12, maxAgeUnit = TimeUnit.SECONDS)
public ProductCatalogRepresentation getProductCatalog(@PathParam("id") String id) {
    LOGGER.info("Retrieving product catalog details of the product with id:" + id);
    ProductCatalog details = productCatalogService.getProductDetails(id);
    if (details == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    LOGGER.debug("Product details:" + details.toString());
    return ProductRepresentationDomainConverter.toRepresentation(details);
}
项目:dropwizard-microservices-example    文件:ProductResource.java   
@GET
@Path("/catalog")
@Timed(name = "showAll-timed-get")
@Metered(name = "showAll-metered-get")
@ExceptionMetered
@CacheControl(maxAge = 12, maxAgeUnit = TimeUnit.SECONDS)
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public List<Object> getAllProductCatalog(@Auth Admin user) throws Exception {
    LOGGER.info("Fetching all the product catalog for the product ");
    JSONArray productCatalogs = productCatalogClient.getAllProductCatalog();
    if (productCatalogs == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    return productCatalogs.toList();
}
项目:dropwizard-caching-bundle    文件:ExampleResource.java   
@GET
    @Path("/test")
    @CacheControl(maxAge = 60)
    @CacheGroup("otter")
    @Vary({"ACCEPT", "ACCEPT-LANGUAGE"})
    public ExampleResult getTestData(@Context HttpContext requestContext) {
//        throw new RuntimeException("uh oh");
        return new ExampleResult(_count++);
    }
项目:dropwizard-caching-bundle    文件:CacheResourceMethodDispatchAdapter.java   
@Override
public RequestDispatcher create(AbstractResourceMethod abstractResourceMethod) {
    RequestDispatcher dispatcher = _provider.create(abstractResourceMethod);
    CacheGroup groupNameAnn = abstractResourceMethod.getAnnotation(CacheGroup.class);
    Vary varyAnn = abstractResourceMethod.getAnnotation(Vary.class);
    IncludeBodyInCacheKey includeBodyInCacheKeyAnn = abstractResourceMethod.getAnnotation(IncludeBodyInCacheKey.class);

    Set<String> vary = ImmutableSet.of();

    if (varyAnn != null && varyAnn.value() != null) {
        vary = HttpHeaderUtils.headerNames(Iterables.filter(
                Arrays.asList(varyAnn.value()),
                Predicates.notNull()));
    }

    boolean includeBodyInCacheKey = includeBodyInCacheKeyAnn != null && includeBodyInCacheKeyAnn.enabled();

    if (groupNameAnn != null || abstractResourceMethod.isAnnotationPresent(CacheControl.class)) {
        String groupName = groupNameAnn == null ? "" : groupNameAnn.value();
        dispatcher = new CachingDispatcher(dispatcher, _cache, _cacheControlMapper.apply(groupName), vary, includeBodyInCacheKey);
    } else if (abstractResourceMethod.getHttpMethod().equals("GET")) {
        Optional<String> cacheControlOverride = _cacheControlMapper.apply("");

        if (cacheControlOverride != null && cacheControlOverride.isPresent()) {
            dispatcher = new CachingDispatcher(dispatcher, _cache, cacheControlOverride, vary, includeBodyInCacheKey);
        }
    }

    return dispatcher;
}
项目:robe    文件:MenuResource.java   
/**
 * get menu for logged user
 *
 * @param credentials injected by {@link RobeAuth} annotation for authentication.
 * @return user {@link MenuItem} as collection
 */

@RobeService(group = "Menu", description = "Get menu for logged user")
@Path("user")
@GET
@UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
@CacheControl(noCache = true)
public List<MenuItem> getUserHierarchicalMenu(@RobeAuth Credentials credentials) {
    Optional<User> user = userDao.findByUsername(credentials.getUsername());
    Set<Permission> permissions = new HashSet<Permission>();

    Role parent = roleDao.findById(user.get().getRoleOid());
    getAllRolePermissions(parent, permissions);
    Set<String> menuOids = new HashSet<String>();

    List<MenuItem> items = convertMenuToMenuItem(menuDao.findHierarchicalMenu());
    items = readMenuHierarchical(items);

    for (Permission permission : permissions) {
        if (permission.getType().equals(Permission.Type.MENU)) {
            menuOids.add(permission.getRestrictedItemOid());
        }
    }
    List<MenuItem> permittedItems = new LinkedList<MenuItem>();

    createMenuWithPermissions(menuOids, items, permittedItems);

    return permittedItems;
}
项目:SciGraph    文件:CypherUtilService.java   
@GET
@Path("/curies")
@ApiOperation(value = "Get the curie map", response = String.class, responseContainer = "Map")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
@Produces({MediaType.APPLICATION_JSON})
public Object getCuries(
    @ApiParam(value = DocumentationStrings.JSONP_DOC, required = false) @QueryParam("callback") String callback) {
  return JaxRsUtil.wrapJsonp(request.get(),
      new GenericEntity<Map<String, String>>(cypherUtil.getCurieMap()) {}, callback);
}
项目:SciGraph    文件:VocabularyService.java   
@GET
@Path("/categories")
@ApiOperation(value = "Get all categories",
notes = "Categories can be used to limit results",
response = String.class,
responseContainer = "Set")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Set<String> getCategories() {
  Set<String> categories = vocabulary.getAllCategories();
  return categories;
}
项目:SciGraph    文件:VocabularyService.java   
@GET
@Path("/prefixes")
@ApiOperation(value = "Get all CURIE prefixes",
notes = "CURIE prefixes can be used to limit results",
response = String.class,
responseContainer = "Set")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Set<String> getCuriePrefixes() {
  Set<String> prefixes = vocabulary.getAllCuriePrefixes();
  return prefixes;
}
项目:SciGraph    文件:LexicalService.java   
/***
 * Break text into sentences.
 * 
 * @param text The source text
 * @param callback The name of the JSONP callback function
 * @return A list of sentences
 */
@GET
@Path("/sentences")
@ApiOperation(value = "Split text into sentences.", 
response = String.class,
responseContainer = "List")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Object getSentences(
    @ApiParam( value = "The text to split", required = true )
    @QueryParam("text") @DefaultValue("") String text) {
  List<String> sentences = lexicalLib.extractSentences(text);
  return sentences;
}
项目:SciGraph    文件:LexicalService.java   
/***
 * Extract POS tags from input text
 * 
 * @param text The source text
 * @param callback The name of the JSONP callback function
 * @return A list of POS tokens
 */
@GET
@Path("/pos")
@ApiOperation(value = "Tag parts of speech.", 
response = PosToken.class,
responseContainer = "List")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public List<PosToken> getPos(
    @ApiParam( value = "The text to tag", required = true )
    @QueryParam("text") @DefaultValue("") String text) {
  List<PosToken> tokens = lexicalLib.tagPOS(text);
  return tokens;
}
项目:SciGraph    文件:LexicalService.java   
/***
 * Extract "chunks" from input text. Chunks are based on POS heuristics.
 * 
 * @param text The source text
 * @param callback The name of the JSONP callback function
 * @return A list of chunks
 */
@GET
@Path("/chunks")
@ApiOperation(value = "Extract entities from text.", response = Token.class,
responseContainer = "List",
notes = "The extracted chunks are based upon POS tagging. This may result in different results that extracting entities.")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public  List<Token<String>> getChunks(
    @ApiParam( value = "The text from which to extract chunks", required = true )
    @QueryParam("text") @DefaultValue("") String text) {
  List<Token<String>> chunks = lexicalLib.getChunks(text);
  return chunks;
}
项目:SciGraph    文件:LexicalService.java   
/***
 * Extract entities from text. Entities are based on a HMM.
 * 
 * @param text The source text
 * @param callback The name of the JSONP callback function
 * @return A list of entities
 */
@GET
@Path("/entities")
@ApiOperation(value = "Extract entities from text.", response = Token.class,
responseContainer = "List",
notes = "The extracted entites are based upon a Hidden Markov Model. This may result in different results that extracting chunks.")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Object getEntities(
    @ApiParam( value = "The text from which to extract entities", required = true )
    @QueryParam("text") @DefaultValue("") String text) {
  List<Token<String>> chunks = lexicalLib.getEntities(text);
  return chunks;
}
项目:SciGraph    文件:GraphService.java   
@GET
@Path("/neighbors/{id}")
@ApiOperation(value = "Get neighbors", response = Graph.class)
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
@Produces({MediaType.APPLICATION_JSON, CustomMediaTypes.APPLICATION_GRAPHSON,
    MediaType.APPLICATION_XML, CustomMediaTypes.APPLICATION_GRAPHML,
    CustomMediaTypes.APPLICATION_XGMML, CustomMediaTypes.TEXT_GML, CustomMediaTypes.TEXT_CSV,
    CustomMediaTypes.TEXT_TSV, CustomMediaTypes.IMAGE_JPEG, CustomMediaTypes.IMAGE_PNG})
public Object getNeighbors(
    @ApiParam(value = DocumentationStrings.GRAPH_ID_DOC,
        required = true) @PathParam("id") String id,
    @ApiParam(value = "How far to traverse neighbors",
        required = false) @QueryParam("depth") @DefaultValue("1") IntParam depth,
    @ApiParam(value = "Traverse blank nodes",
        required = false) @QueryParam("blankNodes") @DefaultValue("false") BooleanParam traverseBlankNodes,
    @ApiParam(value = "Which relationship to traverse",
        required = false) @QueryParam("relationshipType") Optional<String> relationshipType,
    @ApiParam(value = DocumentationStrings.DIRECTION_DOC, required = false,
        allowableValues = DocumentationStrings.DIRECTION_ALLOWED) @QueryParam("direction") @DefaultValue("BOTH") String direction,
    @ApiParam(value = "Should subproperties and equivalent properties be included",
        required = false) @QueryParam("entail") @DefaultValue("false") BooleanParam entail,
    @ApiParam(value = DocumentationStrings.PROJECTION_DOC,
        required = false) @QueryParam("project") @DefaultValue("*") Set<String> projection,
    @ApiParam(value = DocumentationStrings.JSONP_DOC,
        required = false) @QueryParam("callback") String callback) {
  return getNeighborsFromMultipleRoots(newHashSet(id), depth, traverseBlankNodes,
      relationshipType, direction, entail, projection, callback);
}
项目:SciGraph    文件:GraphService.java   
@GET
@Path("/relationship_types")
@ApiOperation(value = "Get all relationship types", response = String.class,
    responseContainer = "List")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
@Produces({MediaType.APPLICATION_JSON})
public Object getRelationships(@ApiParam(value = DocumentationStrings.JSONP_DOC,
    required = false) @QueryParam("callback") String callback) {
  List<String> relationships = getRelationshipTypeNames();
  sort(relationships);
  return JaxRsUtil.wrapJsonp(request.get(), new GenericEntity<List<String>>(relationships) {},
      callback);
}
项目:SciGraph    文件:GraphService.java   
@GET
@Path("/properties")
@ApiOperation(value = "Get all property keys", response = String.class,
    responseContainer = "List")
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
@Produces({MediaType.APPLICATION_JSON})
public Object getProperties(@ApiParam(value = DocumentationStrings.JSONP_DOC,
    required = false) @QueryParam("callback") String callback) {
  List<String> propertyKeys = new ArrayList<>(api.getAllPropertyKeys());
  sort(propertyKeys);
  return JaxRsUtil.wrapJsonp(request.get(), new GenericEntity<List<String>>(propertyKeys) {},
      callback);
}
项目:SciGraph    文件:RefineService.java   
@POST
@Path("/reconcile")
@ApiOperation(value = "Reconcile terms",
notes = DocumentationStrings.RECONCILE_NOTES,
response = RefineResult.class)
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Object suggestFromTerm_POST(
    @ApiParam( value = DocumentationStrings.RECONCILE_QUERY_DOC, required = false)
    @FormParam("query") String query,
    @ApiParam( value = DocumentationStrings.RECONCILE_QUERIES_DOC, required = false )
    @FormParam("queries") String queries) {
  return suggestFromTerm(query, queries, null);
}
项目:SciGraph    文件:AnnotateService.java   
@POST
@Path("/entities")
@Consumes("application/x-www-form-urlencoded")
@ApiOperation(value = "Get entities from text", 
response = EntityAnnotation.class, 
responseContainer = "List",
notes = "Get the entities from content without embedding them in the source - only the entities are returned. " +
    DocumentationStrings.REST_ABUSE_DOC)
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Object postEntities(
    @ApiParam( value = DocumentationStrings.CONTENT_DOC, required = true)
    final @FormParam("content") @DefaultValue("") String content,
    @ApiParam( value = DocumentationStrings.INCLUDE_CATEGORIES_DOC, required = false)
    final @FormParam("includeCat") Set<String> includeCategories,
    @ApiParam( value = DocumentationStrings.EXCLUDE_CATEGORIES_DOC, required = false)
    final @FormParam("excludeCat") Set<String> excludeCategories,
    @ApiParam( value = DocumentationStrings.MINIMUM_LENGTH_DOC, required = false)
    final @FormParam("minLength") @DefaultValue("4") IntParam minLength,
    @ApiParam( value = DocumentationStrings.LONGEST_ENTITY_DOC, required = false)
    final @FormParam("longestOnly") @DefaultValue("false") BooleanParam longestOnly,
    @ApiParam( value = DocumentationStrings.INCLUDE_ABBREV_DOC, required = false)
    final @FormParam("includeAbbrev") @DefaultValue("false") BooleanParam includeAbbrev,
    @ApiParam( value = DocumentationStrings.INCLUDE_ACRONYMS_DOC, required = false)
    final @FormParam("includeAcronym") @DefaultValue("false") BooleanParam includeAcronym,
    @ApiParam( value = DocumentationStrings.INCLUDE_NUMBERS_DOC, required = false)
    final @FormParam("includeNumbers") @DefaultValue("false") BooleanParam includeNumbers) {
  return getEntities(content, includeCategories, excludeCategories, minLength, 
      longestOnly, includeAbbrev, includeAcronym, includeNumbers);
}
项目:SciGraph    文件:AnnotateService.java   
/***
 * A convenience call for retrieving both a list of entities and annotated content
 * 
 * @param content The content to annotate
 * @param includeCategories A set of categories to include
 * @param excludeCategories A set of categories to exclude
 * @param minLength The minimum length of annotated entities
 * @param longestOnly Should only the longest entity be returned for an overlapping group
 * @param includeAbbrev Should abbreviations be included
 * @param includeAcronym Should acronyms be included
 * @param includeNumbers Should numbers be included
 * @return A list of entities and the annotated content
 * @throws IOException 
 */
@POST
@Path("/complete")
@Consumes("application/x-www-form-urlencoded")
@ApiOperation(value = "Get embedded annotations as well as a separate list", 
response = Annotations.class, 
notes="A convenience resource for retrieving both a list of entities and annotated content. " + DocumentationStrings.REST_ABUSE_DOC)
@Timed
@CacheControl(maxAge = 2, maxAgeUnit = TimeUnit.HOURS)
public Annotations postEntitiesAndContent(
    @ApiParam( value = DocumentationStrings.CONTENT_DOC, required = true)
    final @FormParam("content") @DefaultValue("") String content,
    @ApiParam( value = DocumentationStrings.INCLUDE_CATEGORIES_DOC, required = false)
    final @FormParam("includeCat") Set<String> includeCategories,
    @ApiParam( value = DocumentationStrings.EXCLUDE_CATEGORIES_DOC, required = false)
    final @FormParam("excludeCat") Set<String> excludeCategories,
    @ApiParam( value = DocumentationStrings.MINIMUM_LENGTH_DOC, required = false)
    final @FormParam("minLength") @DefaultValue("4") IntParam minLength,
    @ApiParam( value = DocumentationStrings.LONGEST_ENTITY_DOC, required = false)
    final @FormParam("longestOnly") @DefaultValue("false") BooleanParam longestOnly,
    @ApiParam( value = DocumentationStrings.INCLUDE_ABBREV_DOC, required = false)
    final @FormParam("includeAbbrev") @DefaultValue("false") BooleanParam includeAbbrev,
    @ApiParam( value = DocumentationStrings.INCLUDE_ACRONYMS_DOC, required = false)
    final @FormParam("includeAcronym") @DefaultValue("false") BooleanParam includeAcronym,
    @ApiParam( value = DocumentationStrings.INCLUDE_NUMBERS_DOC, required = false)
    final @FormParam("includeNumbers") @DefaultValue("false") BooleanParam includeNumbers) throws IOException {
  return this.getEntitiesAndContent(content, includeCategories, excludeCategories, minLength, longestOnly, includeAbbrev, includeAcronym, includeNumbers);
}
项目:tardis    文件:DatabaseHealthCheckRestService.java   
@GET
@Path("/check")
@CacheControl(noCache = true)
@Override
public Result check() {
    if (random.nextInt(5) % 5 == 1) {
        return Result.unhealthy("Cannot. Is down", "Aap", "Noot");
    } else {
        return Result.healthy();
    }
}
项目:tardis    文件:MetaRestService.java   
@GET
@Path("/profiles")
@CacheControl(noCache = true)
@Override
public Collection<Profile> profiles() {
    return Arrays.asList(Profile.values());
}
项目:tardis    文件:MetaRestService.java   
@GET
@Path("/modules")
@CacheControl(noCache = true)
@Override
public Collection<Module> modules() {
    //TODO: Find a dynamic way to detect all available modules.
    return Arrays.asList((Module) metaModule, (Module) statusModule);
}
项目:tardis    文件:StatusRestService.java   
@Override
@GET
   @Path("/counter")
   @Timed
   @CacheControl(noCache = true)
   public int getCounter() {
       return i++;
   }
项目:tardis    文件:StatusRestService.java   
@GET
@Path("/all")
@Timed
@CacheControl(noCache = true)
public List<Unit> getAllUnits() {
    return new ArrayList<>(units.values());
}
项目:tardis    文件:StatusRestService.java   
@GET
@Path("/{unit}")
@Timed
@CacheControl(noCache = true)
public Unit getUnit(@PathParam("unit") long unit) {
    return units.get(unit);
}
项目:airpal    文件:HealthResource.java   
@GET
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Response health() {
    final SortedMap<String, HealthCheck.Result> results = registry.runHealthChecks();
    if (results.isEmpty()) {
        return Response.status(new NotImplementedStatus()).entity(results).build();
    } else {
        if (isAllHealthy(results)) {
            return Response.status(Response.Status.OK).entity(results).build();
        } else {
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(results).build();
        }
    }
}
项目:snowizard    文件:IdResource.java   
/**
 * Get a new ID as plain text
 *
 * @param agent
 *            User Agent
 * @return generated ID
 */
@GET
@Timed
@Produces(MediaType.TEXT_PLAIN)
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public String getIdAsString(
        @HeaderParam(HttpHeaders.USER_AGENT) final String agent) {
    return String.valueOf(getId(agent));
}
项目:snowizard    文件:IdResource.java   
/**
 * Get a new ID as JSON
 *
 * @param agent
 *            User Agent
 * @return generated ID
 */
@GET
@Timed
@JSONP(callback = "callback", queryParam = "callback")
@Produces({ MediaType.APPLICATION_JSON,
    MediaTypeAdditional.APPLICATION_JAVASCRIPT })
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Id getIdAsJSON(
        @HeaderParam(HttpHeaders.USER_AGENT) final String agent) {
    return new Id(getId(agent));
}
项目:snowizard    文件:VersionResource.java   
@GET
@Produces(MediaType.TEXT_PLAIN)
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Response getVersion() {
    return Response.ok(getClass().getPackage().getImplementationVersion())
            .type(MediaType.TEXT_PLAIN).build();
}
项目:graphiak    文件:PingResource.java   
@GET
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Response ping() {
    return Response.ok("pong").type(MediaType.TEXT_PLAIN).build();
}
项目:graphiak    文件:VersionResource.java   
@GET
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Response getVersion() {
    return Response.ok(version).type(MediaType.TEXT_PLAIN).build();
}