| 1 34 35 36 package com.micronova.jsp.tag; 37 38 import java.io.*; 39 import java.util.*; 40 import java.net.*; 41 import javax.net.ssl.*; 42 import java.security.cert.X509Certificate ; 43 import com.micronova.util.*; 44 45 public class IncludeTag extends MapTag 46 { 47 private static final String DEFAULTEXPORT = "${" + VALUEVAR + "." + NetUtil.RESPONSE + "." + NetUtil.CONTENT + "}"; 48 49 protected boolean _asynchronous; 50 protected NestedMap _asynchronousMap; 51 52 protected void init() 53 { 54 super.init(); 55 56 _export = DEFAULTEXPORT; 57 58 _asynchronous = false; 59 60 Map map = _map; 61 62 map.put(NetUtil.USESTRUSTMANAGER, "true"); 63 map.put(NetUtil.USESHOSTNAMEVERIFIER, "true"); 64 map.put(NetUtil.THROWSEXCEPTION, "true"); 65 map.put(NetUtil.FOLLOWSREDIRECTS, "true"); 66 map.put(NetUtil.ALLOWSFILE, "false"); 67 } 68 69 protected Object processValue(Object tagValue) throws Exception  70 { 71 if (_asynchronous) 72 { 73 NetUtil netUtil = new NetUtil(_map); 74 75 Thread thread = new Thread (netUtil); 76 thread.start(); 77 78 return thread; 79 } 80 else 81 { 82 return NetUtil.request(_map); 83 } 84 } 85 86 87 88 public void setUrl(Object expression) throws Exception  89 { 90 _map.put(NetUtil.URL, evaluateAttribute("url", expression, String .class)); 91 } 92 93 94 95 public void setAllowsFile(Object expression) throws Exception  96 { 97 _map.put(NetUtil.ALLOWSFILE, evaluateAttribute("allowsFile", expression, Boolean .class)); 98 } 99 100 101 102 public void setAsynchronous(Object expression) throws Exception  103 { 104 boolean asynchronous = ((Boolean )evaluateAttribute("asynchronous", expression, Boolean .class)).booleanValue(); 105 106 if (asynchronous) 107 { 108 _export = "${" + VALUEVAR + "}"; 109 } 110 111 _asynchronous = asynchronous; 112 } 113 } 114 | Popular Tags |