Mercurial Hosting > luan
changeset 263:54873a389f80
add "http" and "https" protocols
git-svn-id: https://luan-java.googlecode.com/svn/trunk@264 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 29 Oct 2014 00:02:14 +0000 |
parents | 3ccc5205d04d |
children | 9e0d4452e649 |
files | core/src/luan/modules/IoLuan.java |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java Tue Oct 28 23:54:41 2014 +0000 +++ b/core/src/luan/modules/IoLuan.java Wed Oct 29 00:02:14 2014 +0000 @@ -301,7 +301,7 @@ public static final class LuanUrl extends LuanIn { private final URL url; - private LuanUrl(URL url) throws LuanException { + private LuanUrl(URL url) { this.url = url; } @@ -432,12 +432,26 @@ return new LuanUrl(url).table(); } + private static LuanTable url(String url) throws IOException { + return new LuanUrl(new URL(url)).table(); + } + + public static LuanTable http(String path) throws IOException { + return url("http:"+path); + } + + public static LuanTable https(String path) throws IOException { + return url("https:"+path); + } + private static LuanTable newProtocols() { LuanTable protocols = Luan.newTable(); try { add( protocols, "file", LuanState.class, String.class ); add( protocols, "classpath", LuanState.class, String.class ); add( protocols, "socket", LuanState.class, String.class ); + add( protocols, "http", String.class ); + add( protocols, "https", String.class ); } catch(NoSuchMethodException e) { throw new RuntimeException(e); }