return config.getInteger(CONFIG_MAX_BODY_SIZE, DEFAULT_MAX_BODY_SIZE);
}
protected ResourceConfig getResourceConfig() {
checkState();
JsonArray resources = config.getJsonArray(CONFIG_RESOURCES, null);
if (resources == null || resources.size() == 0) {
throw new RuntimeException("At least one resource package name must be specified in the config " +
CONFIG_RESOURCES);
}
String[] resourceArr = new String[resources.size()];
for (int i = 0; i < resources.size(); i++) {
resourceArr[i] = resources.getString(i);
}
ResourceConfig rc = new ResourceConfig();
rc.packages(resourceArr);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
JsonArray features = config.getJsonArray(CONFIG_FEATURES, null);
if (features != null && features.size() > 0) {
for (int i = 0; i < features.size(); i++) {
try {
Class<?> clazz = cl.loadClass(features.getString(i));
rc.register(clazz);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
// Always register the InternalVertxJerseyBinder
rc.register(new InternalVertxJerseyBinder(vertx));
// Register configured binders
JsonArray binders = config.getJsonArray(CONFIG_BINDERS, null);
if (binders != null && binders.size() > 0) {
for (int i = 0; i < binders.size(); i++) {
try {
Class<?> clazz = cl.loadClass(binders.getString(i));
rc.register(clazz.newInstance());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}