diff src/luan/modules/url/LuanUrl.java @ 1335:e0cf0d108a77

major cleanup
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 14 Feb 2019 03:10:45 -0700
parents 25746915a241
children 0cceff521abb
line wrap: on
line diff
--- a/src/luan/modules/url/LuanUrl.java	Tue Feb 12 22:53:57 2019 -0700
+++ b/src/luan/modules/url/LuanUrl.java	Thu Feb 14 03:10:45 2019 -0700
@@ -195,19 +195,19 @@
 		return t==null ? null : t.asMap();
 	}
 
-	@Override public InputStream inputStream(Luan luan) throws IOException, LuanException {
+	@Override public InputStream inputStream() throws IOException, LuanException {
 		try {
-			return inputStream(luan,null);
+			return inputStream(null);
 		} catch(AuthException e) {
 			try {
-				return inputStream(luan,e.authorization);
+				return inputStream(e.authorization);
 			} catch(AuthException e2) {
 				throw new RuntimeException(e2);  // never
 			}
 		}
 	}
 
-	private InputStream inputStream(Luan luan,String authorization)
+	private InputStream inputStream(String authorization)
 		throws IOException, LuanException, AuthException
 	{
 		URLConnection con = url.openConnection();
@@ -238,12 +238,12 @@
 		HttpURLConnection httpCon = (HttpURLConnection)con;
 
 		if( method==Method.GET ) {
-			return getInputStream(luan,httpCon,authorization);
+			return getInputStream(httpCon,authorization);
 		}
 
 		if( method==Method.DELETE ) {
 			httpCon.setRequestMethod("DELETE");
-			return getInputStream(luan,httpCon,authorization);
+			return getInputStream(httpCon,authorization);
 		}
 
 		// POST
@@ -263,13 +263,13 @@
 		}
 		out.flush();
 		try {
-			return getInputStream(luan,httpCon,authorization);
+			return getInputStream(httpCon,authorization);
 		} finally {
 			out.close();
 		}
 	}
 
-	private InputStream getInputStream(Luan luan,HttpURLConnection httpCon,String authorization)
+	private InputStream getInputStream(HttpURLConnection httpCon,String authorization)
 		throws IOException, LuanException, AuthException
 	{
 		try {
@@ -335,9 +335,8 @@
 			String msg = Utils.readAll(in);
 			in.close();
 			LuanException le = new LuanException(msg,e);
-			LuanTable tbl = le.table(luan);
-			tbl.rawPut("response_code",responseCode);
-			tbl.rawPut("response_message",responseMessage);
+			le.put("response_code",responseCode);
+			le.put("response_message",responseMessage);
 			throw le;
 		}
 	}