mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-10-31 02:25:59 +01:00 
			
		
		
		
	(refs #96)Add build.xml which makes an executable war file.
This commit is contained in:
		
							
								
								
									
										24
									
								
								src/main/java/JettyLauncher.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/main/java/JettyLauncher.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| import org.eclipse.jetty.server.Server; | ||||
| import org.eclipse.jetty.webapp.WebAppContext; | ||||
|  | ||||
| import java.net.URL; | ||||
| import java.security.ProtectionDomain; | ||||
|  | ||||
| public class JettyLauncher { | ||||
|     public static void main(String[] args) throws Exception { | ||||
|         int port = System.getenv("PORT") != null ? Integer.parseInt(System.getenv("PORT")) : 8080; | ||||
|         Server server = new Server(port); | ||||
|         WebAppContext context  = new WebAppContext(); | ||||
|         ProtectionDomain domain   = JettyLauncher.class.getProtectionDomain(); | ||||
|         URL location = domain.getCodeSource().getLocation(); | ||||
|  | ||||
|         context.setContextPath("/"); | ||||
|         context.setDescriptor(location.toExternalForm() + "/WEB-INF/web.xml"); | ||||
|         context.setServer(server); | ||||
|         context.setWar(location.toExternalForm()); | ||||
|  | ||||
|         server.setHandler(context); | ||||
|         server.start(); | ||||
|         server.join(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user