@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); }
@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; }
@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; }
@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; }
@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; } }
@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; }
/** * 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(); }
@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(); }
@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); } }
@GET @PermitAll @Path("/services/oauth2/user") @CacheControl(noCache = true) @ApiOperation("Get authenticated user.") public User getAuthenticatedUser( @Context SecurityContext securityContext ) { return RestHelper.getUser(securityContext); }
@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); }
@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(); }
@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++); }
@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; }
/** * 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; }
@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); }
@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; }
@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; }
/*** * 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; }
/*** * 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; }
/*** * 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; }
/*** * 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; }
@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); }
@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); }
@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); }
@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); }
@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); }
/*** * 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); }
@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(); } }
@GET @Path("/profiles") @CacheControl(noCache = true) @Override public Collection<Profile> profiles() { return Arrays.asList(Profile.values()); }
@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); }
@Override @GET @Path("/counter") @Timed @CacheControl(noCache = true) public int getCounter() { return i++; }
@GET @Path("/all") @Timed @CacheControl(noCache = true) public List<Unit> getAllUnits() { return new ArrayList<>(units.values()); }
@GET @Path("/{unit}") @Timed @CacheControl(noCache = true) public Unit getUnit(@PathParam("unit") long unit) { return units.get(unit); }
@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(); } } }
/** * 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)); }
/** * 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)); }
@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(); }
@GET @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Response ping() { return Response.ok("pong").type(MediaType.TEXT_PLAIN).build(); }
@GET @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Response getVersion() { return Response.ok(version).type(MediaType.TEXT_PLAIN).build(); }