• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PathResourceManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



PathResourceManager类属于io.undertow.server.handlers.resource包,在下文中一共展示了PathResourceManager类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
public static void main(String[] args) {

        final String urltoConnect = "ws://localhost:5678";
        final String serverUrl = "0.0.0.0";
        final int serverPort = 8080;

        Undertow server = Undertow.builder()
                .addHttpListener(serverPort,serverUrl)
                .setHandler(
                        Handlers.path(
                                Handlers.resource(
                                        new PathResourceManager(Paths.get("plugins/visualizer/src/main/resources").toAbsolutePath(),0)
                                )
                        )
                )
                .build();


        server.start();

        StringBuilder goToBuilder = new StringBuilder();
        goToBuilder.append("http://")
                .append(serverUrl)
                .append(":")
                .append(serverPort)
                .append("?q=")
                .append(urltoConnect);
        System.out.println("Go to: " + goToBuilder);


        System.out.println();

    }
 
开发者ID:datathings,项目名称:greycat,代码行数:34,代码来源:DebugVisualizerServer.java


示例2: main

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
public static void main(String[]args){
Undertow server = Undertow.builder()
     .addHttpListener(7071, "localhost")
     .setHandler(io.undertow.Handlers.resource(
    		 new PathResourceManager(Paths.get("/Users/enonowog/books/jbdevg/code/jbdevg"),10))
                     .setDirectoryListingEnabled(true)
    		 ).build();
  server.start();
 }
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:10,代码来源:UndertowHelloDirectoryBrowser.java


示例3: startPreview

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
/**
    * Creates and starts the server to serve the contents of OUTPUT_DIRECTORY on port
9090.
    */
   protected void startPreview() {
       ResourceHandler resourceHandler = resource(new PathResourceManager(Paths.get(OUTPUT_DIRECTORY), 100, true, true))
               .setDirectoryListingEnabled(false);
       FileErrorPageHandler errorHandler = new FileErrorPageHandler(Paths.get(OUTPUT_DIRECTORY).resolve("404.html"), StatusCodes.NOT_FOUND);
       errorHandler.setNext(resourceHandler);
       GracefulShutdownHandler shutdown = Handlers.gracefulShutdown(errorHandler);
       Undertow server = Undertow.builder().addHttpListener(port, "localhost")
               .setHandler(shutdown)
               .build();
       server.start();
   }
 
开发者ID:pawandubey,项目名称:griffin,代码行数:16,代码来源:Server.java


示例4: getResourceManager

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
public ResourceManager getResourceManager() {
    final Path folder = Paths.get(path.getResourceId());
    return new PathResourceManager(folder, 10000L);
}
 
开发者ID:bootique,项目名称:bootique-undertow,代码行数:5,代码来源:StaticResourceFactory.java


示例5: ExternalAssetProvider

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
ExternalAssetProvider(final DocumentationProvider provider) {
	this.provider = provider;
	this.next =
		resource(
			new PathResourceManager(provider.assetsPath(),100000,false,false));
}
 
开发者ID:SmartDeveloperHub,项目名称:sdh-vocabulary,代码行数:7,代码来源:ExternalAssetProvider.java


示例6: Webserver

import io.undertow.server.handlers.resource.PathResourceManager; //导入依赖的package包/类
public Webserver() {
	try {
		DeploymentInfo uploadServlet = Servlets.deployment()
				.setClassLoader(Webserver.class.getClassLoader())
				.setDeploymentName("HttpRequestHandler")
				.setContextPath("/")
				.addServlets(
						Servlets.servlet(
								"HttpRequestHandler",
								HttpRequestHandler.class)
								.addMapping("/")
								.setMultipartConfig(new MultipartConfigElement(System.getProperty("java.io.tmpdir"), config.getMaxFileSize(), config.getMaxFileSize() * 1024, 0))
				);
		DeploymentInfo panelServlet = Servlets.deployment()
				.setClassLoader(Webserver.class.getClassLoader())
				.setDeploymentName("Panel")
				.setContextPath("/")
				.addServlets(
						Servlets.servlet("PanelLogin", PanelLogin.class).addMapping("/login"),
						Servlets.servlet("Panel", PanelHome.class).addMapping("/")
				);
		
		DeploymentManager upload = Servlets.defaultContainer().addDeployment(uploadServlet);
		upload.deploy();
		
		DeploymentManager panel = Servlets.defaultContainer().addDeployment(panelServlet);
		panel.deploy();
		
		PathHandler path = Handlers.path(
				resource(new PathResourceManager(Paths.get(HermexServer.config.getFolder()), 0))
						.setDirectoryListingEnabled(false)
		);
		path.addPrefixPath("/upload", upload.start());
		path.addPrefixPath("/panel", panel.start());
		path.addPrefixPath("/assets",
				resource(new ClassPathResourceManager(this.getClass().getClassLoader(), "assets/"))
						.setDirectoryListingEnabled(false)
		);
		
		
		this.server = Undertow.builder()
				.addHttpListener(HermexServer.config.getWebPort(), "0.0.0.0")
				.setHandler(path)
				.build();
	} catch (Exception e) {
		logger.log(Level.ERROR, "Unknown error", e);
	}
}
 
开发者ID:HermexTools,项目名称:server-legacy,代码行数:49,代码来源:Webserver.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpWagon类代码示例发布时间:2022-05-23
下一篇:
Java AssertionCreationException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap