本文整理汇总了Java中com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures类的典型用法代码示例。如果您正苦于以下问题:Java JacksonFeatures类的具体用法?Java JacksonFeatures怎么用?Java JacksonFeatures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonFeatures类属于com.fasterxml.jackson.jaxrs.annotation包,在下文中一共展示了JacksonFeatures类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProductCatalog
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
@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;
}
示例2: changeAlias
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
@POST
@Path("change-alias")
@JacksonFeatures(serializationDisable = {SerializationFeature.FAIL_ON_EMPTY_BEANS})
public Response changeAlias(final ChangeIndexAliasRequest request) {
assertChangeIndexAliasRequest(request);
indexingComponent.addAlias(request.getAlias(), request.getIndexName());
return Response.ok(new EsCommonsResultResponse<>()).build();
}
示例3: removeIndexByName
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
@POST
@Path("remove-index-by-name")
@JacksonFeatures(serializationDisable = {SerializationFeature.FAIL_ON_EMPTY_BEANS})
public Response removeIndexByName(final RemoveIndexByNameRequest request) {
assertRemoveIndexByNameRequest(request);
indexingComponent.removeIndexByName(request.getIndexName());
return Response.ok(new EsCommonsResultResponse<>()).build();
}
示例4: getJobs
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
/**
* Get job history
* @param crawlId
* @return A nested JSON object of all the jobs created
*/
@GET
@Path(value = "/")
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public Collection<JobInfo> getJobs(@QueryParam("crawlId") String crawlId) {
return jobManager.list(crawlId, State.ANY);
}
示例5: getInfo
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
/**
* Get job info
* @param id Job ID
* @param crawlId Crawl ID
* @return A JSON object of job parameters
*/
@GET
@Path(value = "/{id}")
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public JobInfo getInfo(@PathParam("id") String id,
@QueryParam("crawlId") String crawlId) {
return jobManager.get(crawlId, id);
}
示例6: getConfigs
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
/**
* Returns a list of all configurations created.
* @return List of configurations
*/
@GET
@Path("/")
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public Set<String> getConfigs() {
return configManager.list();
}
示例7: getConfig
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
/**
* Get configuration properties
* @param configId The configuration ID to fetch
* @return HashMap of the properties set within the given configId
*/
@GET
@Path("/{configId}")
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public Map<String, String> getConfig(@PathParam("configId") String configId) {
return configManager.getAsMap(configId);
}
示例8: getProperty
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
/**
* Get property
* @param configId The ID of the configuration
* @param propertyId The name(key) of the property
* @return value of the specified property in the provided configId.
*/
@GET
@Path("/{configId}/{propertyId}")
@Produces(MediaType.TEXT_PLAIN)
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
public String getProperty(@PathParam("configId") String configId,
@PathParam("propertyId") String propertyId) {
return configManager.getAsMap(configId).get(propertyId);
}
示例9: getAllProductCatalog
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
@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();
}
示例10: get
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
@GET
@JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
@Produces(MediaType.APPLICATION_JSON)
public Response get(
@QueryParam("schema") Boolean schema,
@HeaderParam(HttpHeaders.AUTHORIZATION) String auth,
@QueryParam("auth_token") String queryAuthToken,
@QueryParam("q") String querystr,
@QueryParam("op") String opname)
{
if (schema != null)
{
return schema();
}
if (querystr == null || querystr.trim().isEmpty())
{
return Response.status(400).entity(new HttpErrorMessage(HttpErrorCodes.MISSING_PARAMETER, "query required")).build();
}
RegistryAuthValue authValue = RegistryHttpUtils.parseAuth(auth);
if (authValue == null)
{
authValue = RegistryBearerAuthValue.fromToken(queryAuthToken);
}
GQLDocument doc = GQLParser.parseDocument(getQuery(querystr));
final GQLSelectedOperation query;
try
{
query = GQLSelectedOperation.namedQuery(doc, opname);
}
catch (IllegalArgumentException ex)
{
return Response.status(400).entity(new HttpErrorMessage(HttpErrorCodes.INVALID_OPERATION, String.format("Invalid operation '%s'", opname))).build();
}
if (query.operation().type() != GQLOpType.Query)
{
return Response.status(400).entity(new HttpErrorMessage(HttpErrorCodes.INVALID_OP_TYPE, "only query is alllwed over HTTP GET")).build();
}
try (RequestContext ctx = core.open(RequestType.QUERY, authValue))
{
return Response.status(200).entity(ctx.query(query, GQLValues.objectValue())).build();
}
}
示例11: createV6Client
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
public static Client createV6Client(final boolean acceptAllHostNames) {
return createInsecureSSLClient(acceptAllHostNames).register(JacksonFeatures.class).build();
}
示例12: RestClientImpl
import com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures; //导入依赖的package包/类
public RestClientImpl() {
_client = ClientBuilder.newBuilder().register(JacksonFeatures.class).build();
}