Mercurial Hosting > luan
comparison http/src/luan/modules/http/HttpServicer.java @ 723:eaf30d5aaf6a
handle url headers
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Fri, 03 Jun 2016 18:43:27 -0600 |
| parents | b21d82ee5756 |
| children | a741a3a33423 |
comparison
equal
deleted
inserted
replaced
| 722:647602e8291a | 723:eaf30d5aaf6a |
|---|---|
| 31 import luan.LuanMeta; | 31 import luan.LuanMeta; |
| 32 import luan.LuanPropertyMeta; | 32 import luan.LuanPropertyMeta; |
| 33 import luan.DeepCloner; | 33 import luan.DeepCloner; |
| 34 import luan.modules.PackageLuan; | 34 import luan.modules.PackageLuan; |
| 35 import luan.modules.IoLuan; | 35 import luan.modules.IoLuan; |
| 36 import luan.modules.LuanUrl; | |
| 36 import luan.modules.TableLuan; | 37 import luan.modules.TableLuan; |
| 37 import luan.modules.Utils; | 38 import luan.modules.Utils; |
| 38 | 39 |
| 39 | 40 |
| 40 public final class HttpServicer { | 41 public final class HttpServicer { |
| 191 public static String toLuanHeaderName(String httpName) { | 192 public static String toLuanHeaderName(String httpName) { |
| 192 return httpName.toLowerCase().replace('-','_'); | 193 return httpName.toLowerCase().replace('-','_'); |
| 193 } | 194 } |
| 194 | 195 |
| 195 public static String toHttpHeaderName(String luanName) { | 196 public static String toHttpHeaderName(String luanName) { |
| 197 /* | |
| 196 StringBuilder buf = new StringBuilder(); | 198 StringBuilder buf = new StringBuilder(); |
| 197 boolean capitalize = true; | 199 boolean capitalize = true; |
| 198 char[] a = luanName.toCharArray(); | 200 char[] a = luanName.toCharArray(); |
| 199 for( int i=0; i<a.length; i++ ) { | 201 for( int i=0; i<a.length; i++ ) { |
| 200 char c = a[i]; | 202 char c = a[i]; |
| 205 a[i] = Character.toUpperCase(c); | 207 a[i] = Character.toUpperCase(c); |
| 206 capitalize = false; | 208 capitalize = false; |
| 207 } | 209 } |
| 208 } | 210 } |
| 209 return String.valueOf(a); | 211 return String.valueOf(a); |
| 212 */ | |
| 213 return LuanUrl.toHttpHeaderName(luanName); | |
| 210 } | 214 } |
| 211 | 215 |
| 212 private static String escape(String value) { | 216 private static String escape(String value) { |
| 213 return value.replaceAll(";", "%3B"); | 217 return value.replaceAll(";", "%3B"); |
| 214 } | 218 } |
