Mercurial Hosting > luan
comparison src/luan/modules/http/LuanHandler.java @ 1004:3fa54d9d19cd
better handling of BindException
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 22 Oct 2016 23:00:57 -0600 |
parents | 32d4b569567c |
children | 0d884377e923 |
comparison
equal
deleted
inserted
replaced
1003:21910079096e | 1004:3fa54d9d19cd |
---|---|
1 package luan.modules.http; | 1 package luan.modules.http; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 import java.lang.reflect.Method; | 4 import java.lang.reflect.Method; |
5 import java.net.BindException; | |
5 import java.util.concurrent.locks.ReadWriteLock; | 6 import java.util.concurrent.locks.ReadWriteLock; |
6 import java.util.concurrent.locks.ReentrantReadWriteLock; | 7 import java.util.concurrent.locks.ReentrantReadWriteLock; |
7 import javax.servlet.http.HttpServletResponse; | 8 import javax.servlet.http.HttpServletResponse; |
8 import org.slf4j.Logger; | 9 import org.slf4j.Logger; |
9 import org.slf4j.LoggerFactory; | 10 import org.slf4j.LoggerFactory; |
10 import org.eclipse.jetty.server.Request; | 11 import org.eclipse.jetty.server.Request; |
12 import org.eclipse.jetty.server.Server; | |
11 import org.eclipse.jetty.server.handler.AbstractHandler; | 13 import org.eclipse.jetty.server.handler.AbstractHandler; |
12 import luan.Luan; | 14 import luan.Luan; |
13 import luan.LuanState; | 15 import luan.LuanState; |
14 import luan.LuanTable; | 16 import luan.LuanTable; |
15 import luan.LuanFunction; | 17 import luan.LuanFunction; |
157 LuanState luan = (LuanState)cloner.clone(this.luan); | 159 LuanState luan = (LuanState)cloner.clone(this.luan); |
158 return fn.call(luan); | 160 return fn.call(luan); |
159 } | 161 } |
160 } | 162 } |
161 | 163 |
164 public static void start(Server server) throws Exception { | |
165 try { | |
166 server.start(); | |
167 } catch(BindException e) { | |
168 throw new LuanException(e.toString()); | |
169 } | |
170 } | |
162 } | 171 } |