com.alibaba.metrics.rest.server.jersey.FastJsonFeature Maven / Gradle / Ivy
/*
* Copyright 2014 Alibaba.com All right reserved. This software is the
* confidential and proprietary information of Alibaba.com ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Alibaba.com.
*/
package com.alibaba.metrics.rest.server.jersey;
import org.glassfish.jersey.CommonProperties;
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
public class FastJsonFeature implements Feature {
public boolean configure(final FeatureContext context) {
final String disableMoxy = CommonProperties.MOXY_JSON_FEATURE_DISABLE + '.'
+ context.getConfiguration().getRuntimeType().name().toLowerCase();
context.property(disableMoxy, true);
context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
return true;
}
}