1 37 package net.thauvin.google.taglibs; 38 39 import net.thauvin.google.GoogleSearchBean; 40 import net.thauvin.google.TagUtility; 41 42 import javax.servlet.jsp.*; 43 44 45 53 public class CachedPage extends QuerySupport 54 { 55 61 public int doEndTag() 62 throws JspException 63 { 64 final String query = getQuery(); 65 66 if (TagUtility.isValidString(query, true)) 67 { 68 try 69 { 70 final GoogleSearchBean bean = new GoogleSearchBean(getKey()); 71 72 bean.setProxyServer(pageContext.getServletContext() 73 .getInitParameter(TagUtility.GOOGLE_PROXY_HOST), 74 pageContext.getServletContext() 75 .getInitParameter(TagUtility.GOOGLE_PROXY_PORT), 76 pageContext.getServletContext() 77 .getInitParameter(TagUtility.GOOGLE_PROXY_USERNAME), 78 pageContext.getServletContext() 79 .getInitParameter(TagUtility.GOOGLE_PROXY_PASSWORD)); 80 81 pageContext.getOut().write(bean.getCachedPage(query)); 83 } 84 catch (Exception e) 85 { 86 throw TagUtility.outputError("cachedPage", e); 87 } 88 } 89 90 reset(); 92 93 return EVAL_PAGE; 94 } 95 96 99 public void release() 100 { 101 super.release(); 102 103 reset(); 105 } 106 107 110 protected void reset() 111 { 112 super.reset(); 113 } 114 } 115 | Popular Tags |