use of javax.activation.MimetypesFileTypeMap in project graylog2-server by Graylog2.
the class GenericBindings method configure.
@Override
protected void configure() {
// This is holding all our metrics.
bind(MetricRegistry.class).toProvider(MetricRegistryProvider.class).asEagerSingleton();
// must not be a singleton!
bind(LocalMetricRegistry.class).in(Scopes.NO_SCOPE);
install(new FactoryModuleBuilder().build(DecodingProcessor.Factory.class));
bind(ProcessBuffer.class).asEagerSingleton();
bind(InputBuffer.class).to(InputBufferImpl.class);
bind(NodeId.class).toProvider(NodeIdProvider.class);
bind(ServiceManager.class).toProvider(ServiceManagerProvider.class).asEagerSingleton();
bind(HashedWheelTimer.class).toInstance(new HashedWheelTimer());
bind(ThroughputCounter.class);
bind(EventBus.class).toProvider(EventBusProvider.class).in(Scopes.SINGLETON);
bind(Semaphore.class).annotatedWith(Names.named("JournalSignal")).toInstance(new Semaphore(0));
install(new FactoryModuleBuilder().build(new TypeLiteral<IOState.Factory<MessageInput>>() {
}));
bind(InputRegistry.class).asEagerSingleton();
bind(OkHttpClient.class).toProvider(OkHttpClientProvider.class).asEagerSingleton();
bind(OkHttpClient.class).annotatedWith(Names.named("systemHttpClient")).toProvider(SystemOkHttpClientProvider.class).asEagerSingleton();
bind(MimetypesFileTypeMap.class).toInstance(new MimetypesFileTypeMap());
bind(ExecutorService.class).annotatedWith(Names.named("proxiedRequestsExecutorService")).toProvider(ProxiedRequestsExecutorService.class).asEagerSingleton();
}
use of javax.activation.MimetypesFileTypeMap in project spring-framework by spring-projects.
the class MockServletContextTests method getMimeTypeWithCustomConfiguredType.
/**
* Introduced to dispel claims in a thread on Stack Overflow:
* <a href="http://stackoverflow.com/questions/22986109/testing-spring-managed-servlet">Testing Spring managed servlet</a>
*/
@Test
public void getMimeTypeWithCustomConfiguredType() {
FileTypeMap defaultFileTypeMap = FileTypeMap.getDefaultFileTypeMap();
assertThat(defaultFileTypeMap, instanceOf(MimetypesFileTypeMap.class));
MimetypesFileTypeMap mimetypesFileTypeMap = (MimetypesFileTypeMap) defaultFileTypeMap;
mimetypesFileTypeMap.addMimeTypes("text/enigma enigma");
assertEquals("text/enigma", sc.getMimeType("filename.enigma"));
}
use of javax.activation.MimetypesFileTypeMap in project netty by netty.
the class HttpStaticFileServerHandler method setContentTypeHeader.
/**
* Sets the content type header for the HTTP Response
*
* @param response
* HTTP response
* @param file
* file to extract content type
*/
private static void setContentTypeHeader(HttpResponse response, File file) {
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
response.headers().set(HttpHeaderNames.CONTENT_TYPE, mimeTypesMap.getContentType(file.getPath()));
}
use of javax.activation.MimetypesFileTypeMap in project async-http-client by AsyncHttpClient.
the class HttpStaticFileServerHandler method setContentTypeHeader.
/**
* Sets the content type header for the HTTP Response
*
* @param response
* HTTP response
* @param file
* file to extract content type
*/
private static void setContentTypeHeader(HttpResponse response, File file) {
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
response.headers().set(CONTENT_TYPE, mimeTypesMap.getContentType(file.getPath()));
}
Aggregations