use of org.glassfish.jersey.model.internal.CommonConfig in project jersey by jersey.
the class ValidatorTest method createInjectionManager.
private InjectionManager createInjectionManager() {
InjectionManager injectionManager = InjectionManagerFactory.createInjectionManager();
injectionManager.register(new AbstractBinder() {
@Override
protected void configure() {
bind(new CommonConfig(RuntimeType.SERVER, ComponentBag.EXCLUDE_EMPTY)).to(Configuration.class);
}
});
return injectionManager;
}
use of org.glassfish.jersey.model.internal.CommonConfig in project jersey by jersey.
the class JaxbStringReaderProviderTest method stringReaderDoesNotReadExternalDtds.
@Test
public void stringReaderDoesNotReadExternalDtds() {
Provider<SAXParserFactory> saxParserFactoryProvider = new Provider<SAXParserFactory>() {
final SaxParserFactoryInjectionProvider spf = new SaxParserFactoryInjectionProvider(new CommonConfig(RuntimeType.SERVER, ComponentBag.INCLUDE_ALL));
@Override
public SAXParserFactory get() {
return spf.get();
}
};
JaxbStringReaderProvider.RootElementProvider provider = new JaxbStringReaderProvider.RootElementProvider(saxParserFactoryProvider, new Providers() {
@Override
public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return null;
}
@Override
public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return null;
}
@Override
public <T extends Throwable> ExceptionMapper<T> getExceptionMapper(Class<T> type) {
return null;
}
@Override
public <T> ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType) {
return null;
}
});
String content = "<!DOCTYPE x SYSTEM 'file:///no-such-file'> <rootObject/>";
provider.getConverter(RootObject.class, null, null).fromString(content);
}
use of org.glassfish.jersey.model.internal.CommonConfig in project jersey by jersey.
the class CommittingOutputStreamTest method checkBufferSize.
private void checkBufferSize(int expectedSize, Map<String, Object> properties, RuntimeType runtime) throws IOException {
OutboundMessageContext outboundMessageContext = new OutboundMessageContext();
final Passed passed = new Passed();
outboundMessageContext.setStreamProvider(new OutboundMessageContext.StreamProvider() {
@Override
public OutputStream getOutputStream(int contentLength) throws IOException {
assertEquals(-1, contentLength);
passed.pass();
return null;
}
});
CommonConfig configuration = new CommonConfig(runtime, ComponentBag.INCLUDE_ALL);
configuration.setProperties(properties);
outboundMessageContext.enableBuffering(configuration);
final OutputStream entityStream = outboundMessageContext.getEntityStream();
for (int i = 1; (i < 1000000) && (!passed.b); i++) {
entityStream.write((byte) 65);
if (i >= expectedSize + 1) {
break;
} else {
assertFalse("committed already with byte #" + i, passed.b);
}
}
assertTrue(passed.b);
}
Aggregations