本文整理汇总了Java中org.restlet.ext.jackson.JacksonConverter类的典型用法代码示例。如果您正苦于以下问题:Java JacksonConverter类的具体用法?Java JacksonConverter怎么用?Java JacksonConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonConverter类属于org.restlet.ext.jackson包,在下文中一共展示了JacksonConverter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
long time = System.currentTimeMillis();
replaceConverter(JacksonConverter.class, new JacksonCustomConverter());
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8082);
component.getDefaultHost().attach("/restlet/hello", HelloResource.class);
component.start();
System.out.println("started in " + (System.currentTimeMillis() - time) + " ms");
}
开发者ID:cdelmas,项目名称:microservices-perf,代码行数:10,代码来源:Main.java
示例2: RestComponent
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
@Inject
public RestComponent(@Hello Application helloApp, @Car Application carApp, Verifier authTokenVerifier) {
getClients().add(Protocol.HTTPS);
Server secureServer = getServers().add(Protocol.HTTPS, 8043);
Series<Parameter> parameters = secureServer.getContext().getParameters();
parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory");
parameters.add("keyStorePath", System.getProperty("javax.net.ssl.keyStorePath"));
getDefaultHost().attach("/api/hello", secure(helloApp, authTokenVerifier, "ame"));
getDefaultHost().attach("/api/cars", secure(carApp, authTokenVerifier, "ame"));
replaceConverter(JacksonConverter.class, new JacksonCustomConverter());
}
开发者ID:cdelmas,项目名称:microservices-comparison,代码行数:12,代码来源:RestComponent.java
示例3: getTranslationResource
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private TranslationResource getTranslationResource() {
Engine.getInstance().getRegisteredConverters()
.add(new JacksonConverter());
Context context = new Context();
context.getParameters().add("controllerSleepTimeMs", timeoutString);
context.getParameters().add("maxIoIdleTimeMs", timeoutString);
context.getParameters().add("socketTimeout", timeoutString);
ClientResource clientResource = new ClientResource(context,
BASE_CLIENT_URL + TranslationResource.RESOURCE_NAME);
clientResource.setRetryOnError(false);
return clientResource.wrap(TranslationResource.class);
}
开发者ID:adiguzel,项目名称:wordwise,代码行数:15,代码来源:RESTfullServerCommunication.java
示例4: getRateResource
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private RateResource getRateResource() {
Engine.getInstance().getRegisteredConverters()
.add(new JacksonConverter());
Context context = new Context();
context.getParameters().add("controllerSleepTimeMs", timeoutString);
context.getParameters().add("maxIoIdleTimeMs", timeoutString);
context.getParameters().add("socketTimeout", timeoutString);
ClientResource clientResource = new ClientResource(context,
BASE_CLIENT_URL + RateResource.RESOURCE_NAME);
clientResource.setRetryOnError(false);
return clientResource.wrap(RateResource.class);
}
开发者ID:adiguzel,项目名称:wordwise,代码行数:15,代码来源:RESTfullServerCommunication.java
示例5: getQualityResource
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private QualityResource getQualityResource() {
Engine.getInstance().getRegisteredConverters()
.add(new JacksonConverter());
Context context = new Context();
context.getParameters().add("controllerSleepTimeMs", timeoutString);
context.getParameters().add("maxIoIdleTimeMs", timeoutString);
context.getParameters().add("socketTimeout", timeoutString);
ClientResource clientResource = new ClientResource(context,
BASE_CLIENT_URL + QualityResource.RESOURCE_NAME);
clientResource.setRetryOnError(false);
return clientResource.wrap(QualityResource.class);
}
开发者ID:adiguzel,项目名称:wordwise,代码行数:15,代码来源:RESTfullServerCommunication.java
示例6: getDifficultyResource
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private DifficultyResource getDifficultyResource() {
Engine.getInstance().getRegisteredConverters()
.add(new JacksonConverter());
Context context = new Context();
context.getParameters().add("controllerSleepTimeMs", timeoutString);
context.getParameters().add("maxIoIdleTimeMs", timeoutString);
context.getParameters().add("socketTimeout", timeoutString);
ClientResource clientResource = new ClientResource(context,
BASE_CLIENT_URL + DifficultyResource.RESOURCE_NAME);
clientResource.setRetryOnError(false);
return clientResource.wrap(DifficultyResource.class);
}
开发者ID:adiguzel,项目名称:wordwise,代码行数:15,代码来源:RESTfullServerCommunication.java
示例7: getWordResource
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private WordResource getWordResource() {
Engine.getInstance().getRegisteredConverters()
.add(new JacksonConverter());
Context context = new Context();
context.getParameters().add("controllerSleepTimeMs", timeoutString);
context.getParameters().add("maxIoIdleTimeMs", timeoutString);
context.getParameters().add("socketTimeout", timeoutString);
ClientResource clientResource = new ClientResource(context,
BASE_CLIENT_URL + WordResource.RESOURCE_NAME);
clientResource.setRetryOnError(false);
return clientResource.wrap(WordResource.class);
}
开发者ID:adiguzel,项目名称:wordwise,代码行数:15,代码来源:RESTfullServerCommunication.java
示例8: doPreSetup
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
@Override
protected void doPreSetup() {
assertPresent(GsonConverter.class);
assertPresent(JacksonConverter.class);
}
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:RestletConfigurationTest.java
示例9: testConfiguration
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
@Test
public void testConfiguration() throws Exception {
assertNotPresent(GsonConverter.class);
assertPresent(JacksonConverter.class);
}
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:RestletConfigurationTest.java
示例10: make
import org.restlet.ext.jackson.JacksonConverter; //导入依赖的package包/类
private void make() {
XMLConverter obixConverter = new XMLConverter();
Engine.getInstance().getRegisteredConverters().add( obixConverter);
JSonConverter jsonConverter = new JSonConverter();
Engine.getInstance().getRegisteredConverters().add(jsonConverter);
// remove standart JacksonConverter
List<ConverterHelper> converters = Engine.getInstance().getRegisteredConverters();
for (ConverterHelper converter : converters) {
if (converter instanceof JacksonConverter) {
converters.remove(converter);
break;
}
}
// and add our that add special mixins
converters.add(new JacksonCustomConverter());
application = new Application();
Context context = new Context();
application.setContext(context);
guiceFinderFactory = new GuiceFinderFactory();
root = new GuiceRouter(context);
root.setFinderFactory(guiceFinderFactory);
// Cors filter for cross domain requests
CorsFilter corsFilter = new CorsFilter(root.getContext());
corsFilter.setNext(root);
// attach resources to root
addRoutes();
// if the rest resources have to be secured, add verification up front.
if( doSecure.booleanValue()){
// Create authentifier, will attempt to authentify every request
ChallengeAuthenticator authenticator = createAuthenticator();
// authorizer will block request on resources based on role for current authentified user
//RoleAuthorizer roleAuth = createRoleAuthorizer();
authenticator.setNext(corsFilter);
//roleAuth.setNext(corsFilter);
application.setInboundRoot(authenticator);
} else {
// otherwie just the cors filter
application.setInboundRoot(corsFilter);
}
Activator.log(LogService.LOG_INFO, "Restlet application initialised.");
//Engine.setRestletLogLevel(Level.OFF);
}
开发者ID:lathil,项目名称:Ptoceti,代码行数:53,代码来源:ObixApplicationFactory.java
注:本文中的org.restlet.ext.jackson.JacksonConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论