当前位置: 首页>>代码示例>>Java>>正文


Java SwaggerPlugin类代码示例

本文整理汇总了Java中com.strategicgains.restexpress.plugin.swagger.SwaggerPlugin的典型用法代码示例。如果您正苦于以下问题:Java SwaggerPlugin类的具体用法?Java SwaggerPlugin怎么用?Java SwaggerPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SwaggerPlugin类属于com.strategicgains.restexpress.plugin.swagger包,在下文中一共展示了SwaggerPlugin类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configurePlugins

import com.strategicgains.restexpress.plugin.swagger.SwaggerPlugin; //导入依赖的package包/类
private static void configurePlugins(Configuration config, RestExpress server)
  {
   configureMetrics(config, server);

new SwaggerPlugin()
	.flag(Flags.Auth.PUBLIC_ROUTE)
	.register(server);

new CacheControlPlugin()							// Support caching headers.
		.register(server);

new HyperExpressPlugin(Linkable.class)
	.register(server);

new CorsHeaderPlugin("*")
	.flag(PUBLIC_ROUTE)
    .allowHeaders(CONTENT_TYPE, ACCEPT, AUTHORIZATION, REFERER, LOCATION)
    .exposeHeaders(LOCATION)
    .register(server);
  }
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:21,代码来源:Main.java

示例2: initializeServer

import com.strategicgains.restexpress.plugin.swagger.SwaggerPlugin; //导入依赖的package包/类
/**
 * Starts up the server for the specified environment.
 *
 * @param args Command line arguments. Should be one parameter with either
 * an environment or a path to a URL with the proper configuration via a
 * REST GET.
 * @param overrideSeeds If you wish to override the otherwise set Cassandra
 * seeds for testing purposes. Pass null if you don't want to override (most
 * of the time.)
 * @return A running RestExpress REST server.
 * @throws IOException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public static RestExpress initializeServer(String[] args, String overrideSeeds) throws IOException, IllegalAccessException, InstantiationException
{
    //args = new String[]{"http://docussandra-dev-webw-1.openclass.com:8080/config/A"};
    RestExpress.setSerializationProvider(new SerializationProvider());
    //Identifiers.UUID.useShortUUID(true);
    //load our plugins first
    try
    {
        PluginHolder.build(PluginUtils.getPluginJars());
    } catch (IllegalStateException e)
    {
        logger.warn("Warning: The plugins were already init'ed, this is fine if you are running tests, but if you see this on a running server, there is probably a problem.");
    }
    Configuration config = loadEnvironment(args);
    logger.info("-----Attempting to start up Docussandra server for version: " + config.getProjectVersion() + "-----");
    boolean initDb = true;
    if (overrideSeeds != null)
    {//if we are overriding our seeds list for testing purposes.
        config.overrideSeeds(overrideSeeds);//this will also override the port back to default
        initDb = false;
    }
    config.initialize(initDb);//make the configuration object ready to use
    RestExpress server = new RestExpress()
            .setName(config.getProjectName(SERVICE_NAME))
            .setBaseUrl(config.getBaseUrl())
            .setExecutorThreadCount(config.getExecutorThreadPoolSize())
            .addPostprocessor(new LastModifiedHeaderPostprocessor())
            .addMessageObserver(new SimpleLogMessageObserver())
            .addPreprocessor(new RequestApplicationJsonPreprocessor())
            .addPreprocessor(new RequestXAuthCheck())
            .setMaxContentSize(6000000);

    new VersionPlugin(config.getProjectVersion())
            .register(server);

    new SwaggerPlugin()
            .register(server);

    Routes.define(config, server);
    Relationships.define(server);
    configurePlugins(config, server);
    mapExceptions(server);

    if (config.getPort() == 0)
    {//no port? calculate it off of the version number
        server.setPort(calculatePort(config.getProjectVersion()));
    } else
    {
        server.setPort(config.getPort());
    }
    server.bind(server.getPort());
    logger.info("-----Docussandra server initialized for version: " + config.getProjectVersion() + "-----");
    return server;
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:69,代码来源:Main.java


注:本文中的com.strategicgains.restexpress.plugin.swagger.SwaggerPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。