本文整理汇总了Java中org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature类的典型用法代码示例。如果您正苦于以下问题:Java FreemarkerMvcFeature类的具体用法?Java FreemarkerMvcFeature怎么用?Java FreemarkerMvcFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FreemarkerMvcFeature类属于org.glassfish.jersey.server.mvc.freemarker包,在下文中一共展示了FreemarkerMvcFeature类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WebApplicationResourceConfig
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public WebApplicationResourceConfig() {
packages("com.giorgiosironi.gameoflife.web");
property(MvcFeature.TEMPLATE_BASE_PATH, "templates");
register(FreemarkerMvcFeature.class);
register(new AbstractBinder() {
@Override
protected void configure() {
InMemoryGenerationRepository repository = new InMemoryGenerationRepository();
Generation original = Generation.withAliveCells(
Cell.onXAndY(1, 1),
Cell.onXAndY(1, 2),
Cell.onXAndY(2, 1),
Cell.onXAndY(2, 2),
Cell.onXAndY(7, 1),
Cell.onXAndY(7, 2),
Cell.onXAndY(7, 3),
Cell.onXAndY(7, 8)
);
repository.add("a-block-and-a-bar", 0, original);
bind(repository).to(GenerationRepository.class);
}
});
}
示例2: AppConfig
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
@Inject
public AppConfig(ServiceLocator serviceLocator) {
register(FreemarkerMvcFeature.class);
property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/templates");
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, FlexibleConfiguration.class);
register(AttachContextInterceptor.class);
register(ValidationFeature.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");
register(AuthenticationRequestFilter.class);
register(AdminNecessaryRequestFilter.class);
register(RepositoryControllRequestFilter.class);
register(HtmlLoginRequiredExceptionMapper.class);
register(HttpCacheControlFilter.class);
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(GuiceListener.get());
packages(false, this.getClass().getPackage() + ".html");
}
示例3: Server
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public Server() {
register(FreemarkerMvcFeature.class);
packages("ru.qatools.school.baguette.resources");
register(new DynamicFeature() {
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(DatabaseProvider.class);
if (resourceInfo.getResourceMethod().isAnnotationPresent(AuthenticationRequired.class)) {
context.register(AuthenticationFilter.class);
}
}
});
}
示例4: DrillRestServer
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public DrillRestServer(final WorkManager workManager) {
register(DrillRoot.class);
register(StatusResources.class);
register(StorageResources.class);
register(ProfileResources.class);
register(QueryResources.class);
register(MetricsResources.class);
register(ThreadsResources.class);
register(FreemarkerMvcFeature.class);
register(MultiPartFeature.class);
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
//disable moxy so it doesn't conflict with jackson.
final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType());
property(disableMoxy, true);
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
register(GenericExceptionMapper.class);
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(workManager.getContext().getConfig().getMapper());
register(provider);
register(new AbstractBinder() {
@Override
protected void configure() {
bind(workManager).to(WorkManager.class);
bind(workManager.getContext().getConfig().getMapper()).to(ObjectMapper.class);
bind(workManager.getContext().getPersistentStoreProvider()).to(PStoreProvider.class);
bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
}
});
}
示例5: MotdApplication
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public MotdApplication() {
// scan com.gluonhq package for jax-rs classes
packages(true, "com.gluonhq");
// everything inside /webjars should not be handled by the jax-rs application
property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "/webjars/.*");
// use freemarker for web templating
register(FreemarkerMvcFeature.class);
property(FreemarkerMvcFeature.TEMPLATE_BASE_PATH, "freemarker");
}
示例6: Server
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public Server() {
register(FreemarkerMvcFeature.class);
register(new DynamicFeature() {
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(DatabaseProvider.class);
context.register(AuthUserProvider.class);
}
});
packages(Server.class.getPackage().getName());
}
示例7: ExampleApplication
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public ExampleApplication()
{
this.packages(true, "it.pkg.presentation");
this.register(JacksonObjectMappProvider.class);
this.register(JacksonFeature.class);
this.register(MultiPartFeature.class);
this.register(FreemarkerMvcFeature.class);
this.property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, this.getClass().getResource("/"));
}
示例8: ExampleApplication
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public ExampleApplication()
{
this.packages(true, "${package}.presentation");
this.register(JacksonObjectMappProvider.class);
this.register(JacksonFeature.class);
this.register(MultiPartFeature.class);
this.register(FreemarkerMvcFeature.class);
this.property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, this.getClass().getResource("/"));
}
示例9: Server
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public Server() {
register(FreemarkerMvcFeature.class);
register(new DynamicFeature() {
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(DatabaseProvider.class);
}
});
packages(Server.class.getPackage().getName());
}
示例10: Server
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public Server() {
Splinter splinter = new Splinter();
registerBinders(splinter);
SimpleContainer.getLogger().debug(
String.format(
"Starting application in `%s` environment using `%s` database driver",
splinter.getEnvironment().toString().toLowerCase(),
splinter.getConfiguration().getDatabaseConfiguration().getDriver().toString().toLowerCase()
)
);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
register(FreemarkerMvcFeature.class);
register(new DynamicFeature() {
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(DatabaseProvider.class);
context.register(AuthProvider.class);
}
});
packages(Server.class.getPackage().getName());
registerSharedVariables();
}
示例11: Server
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public Server() {
register(FreemarkerMvcFeature.class);
register(new DynamicFeature() {
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(DatabaseProvider.class);
context.register(AuthUserProvider.class);
}
});
packages(Server.class.getPackage().getName());
}
示例12: init
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
protected void init(ScanResult result) {
// FILTERS //
register(JSONPrettyPrintFilter.class);
register(MediaTypeFilter.class);
// RESOURCES //
for (Class<?> resource : result.getAnnotatedClasses(RestResource.class)) {
register(resource);
}
// FEATURES
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration());
register(FreemarkerMvcFeature.class);
register(MultiPartFeature.class);
register(FirstTimeFeature.class);
register(DACAuthFilterFeature.class);
register(DACExceptionMapperFeature.class);
register(DACJacksonJaxbJsonFeature.class);
register(TestResourcesFeature.class);
// LISTENERS //
register(TimingApplicationEventListener.class);
// EXCEPTION MAPPERS //
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
// BODY WRITERS //
register(QlikAppMessageBodyGenerator.class);
register(TableauMessageBodyGenerator.class);
// PROPERTIES //
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE,
getConfiguration().getRuntimeType());
property(disableMoxy, true);
property(TableauMessageBodyGenerator.CUSTOMIZATION_ENABLED, false);
}
示例13: DrillRestServer
import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; //导入依赖的package包/类
public DrillRestServer(final WorkManager workManager, final ServletContext servletContext, final Drillbit drillbit) {
register(DrillRoot.class);
register(StatusResources.class);
register(StorageResources.class);
register(ProfileResources.class);
register(QueryResources.class);
register(MetricsResources.class);
register(ThreadsResources.class);
register(LogsResources.class);
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration(servletContext));
register(FreemarkerMvcFeature.class);
register(MultiPartFeature.class);
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
final boolean isAuthEnabled =
workManager.getContext().getConfig().getBoolean(ExecConstants.USER_AUTHENTICATION_ENABLED);
if (isAuthEnabled) {
register(LogInLogOutResources.class);
register(AuthDynamicFeature.class);
register(RolesAllowedDynamicFeature.class);
}
//disable moxy so it doesn't conflict with jackson.
final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE,
getConfiguration().getRuntimeType());
property(disableMoxy, true);
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
register(GenericExceptionMapper.class);
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(workManager.getContext().getLpPersistence().getMapper());
register(provider);
// Get an EventExecutor out of the BitServer EventLoopGroup to notify listeners for WebUserConnection. For
// actual connections between Drillbits this EventLoopGroup is used to handle network related events. Though
// there is no actual network connection associated with WebUserConnection but we need a CloseFuture in
// WebSessionResources, so we are using EvenExecutor from network EventLoopGroup pool.
final EventExecutor executor = workManager.getContext().getBitLoopGroup().next();
register(new AbstractBinder() {
@Override
protected void configure() {
bind(drillbit).to(Drillbit.class);
bind(workManager).to(WorkManager.class);
bind(executor).to(EventExecutor.class);
bind(workManager.getContext().getLpPersistence().getMapper()).to(ObjectMapper.class);
bind(workManager.getContext().getStoreProvider()).to(PersistentStoreProvider.class);
bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
bind(new UserAuthEnabled(isAuthEnabled)).to(UserAuthEnabled.class);
if (isAuthEnabled) {
bindFactory(DrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
bindFactory(AuthWebUserConnectionProvider.class).to(WebUserConnection.class);
} else {
bindFactory(AnonDrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
bindFactory(AnonWebUserConnectionProvider.class).to(WebUserConnection.class);
}
}
});
}