Java源码示例:io.swagger.jaxrs.config.ReaderConfig
示例1
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
ServletContext servletContext = mc.getServletContext();
if (servletContext != null && servletContext.getAttribute(ReaderConfig.class.getName()) == null) {
if (mc.getServletConfig() != null
&& Boolean.valueOf(mc.getServletConfig().getInitParameter("scan.all.resources"))) {
addReaderConfig(mc.getServletConfig().getInitParameter("ignore.routes"));
} else if (isScanAllResources()) {
addReaderConfig(getIgnoreRoutes());
}
}
}
示例2
protected void addReaderConfig(String ignoreRoutesParam) {
DefaultReaderConfig rc = new DefaultReaderConfig();
rc.setScanAllResources(true);
if (ignoreRoutesParam != null) {
Set<String> routes = new LinkedHashSet<>();
for (String route : ignoreRoutesParam.split(",")) {
routes.add(route.trim());
}
rc.setIgnoredRoutes(routes);
}
mc.getServletContext().setAttribute(ReaderConfig.class.getName(), rc);
}
示例3
public Reader(Swagger swagger, ReaderConfig config) {
this.swagger = (swagger == null) ? new Swagger() : swagger;
this.config = new DefaultReaderConfig(config);
}
示例4
public ReaderConfig getConfig() {
return config;
}
示例5
public ReaderConfig getConfig() {
return config;
}