jetty服务器上项目在哪个目录下,Jetty嵌入式服务器 - 更改将部署war文件的路径...

public class OneWebApp

{

public static void main( String[] args ) throws Exception

{

// Create a basic jetty server object that will listen on port 8080.

// Note that if you set this to port 0 then a randomly available port

// will be assigned that you can either look in the logs for the port,

// or programmatically obtain it for use in test cases.

Server server = new Server(8080);

// Setup JMX

MBeanContainer mbContainer = new MBeanContainer(

ManagementFactory.getPlatformMBeanServer());

server.addBean(mbContainer);

// The WebAppContext is the entity that controls the environment in

// which a web application lives and breathes. In this example the

// context path is being set to "/" so it is suitable for serving root

// context requests and then we see it setting the location of the war.

// A whole host of other configurations are available, ranging from

// configuring to support annotation scanning in the webapp (through

// PlusConfiguration) to choosing where the webapp will unpack itself.

WebAppContext webapp = new WebAppContext();

webapp.setContextPath("/");

File warFile = new File(

"C:\Users\MyPCname\AppData\Local\Temp\jetty\your.war");

webapp.setWar(warFile.getAbsolutePath());

webapp.addAliasCheck(new AllowSymLinkAliasChecker());

// A WebAppContext is a ContextHandler as well so it needs to be set to

// the server so it is aware of where to send the appropriate requests.

server.setHandler(webapp);

// Start things up!

server.start();

// The use of server.join() the will make the current thread join and

// wait until the server is done executing.

// See http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#join()

server.join();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值