1 7 package com.inversoft.verge.mvc.view.jsp.html; 8 9 10 import java.net.URISyntaxException ; 11 12 import javax.servlet.http.HttpServletRequest ; 13 import javax.servlet.http.HttpServletResponse ; 14 import javax.servlet.jsp.JspException ; 15 16 import com.inversoft.verge.mvc.view.ViewConstants; 17 import com.inversoft.verge.util.url.URLGenerator; 18 import com.inversoft.verge.util.url.config.CategoryConfig; 19 20 21 31 public abstract class ContextBasedTag extends HtmlBaseTag { 32 33 private Boolean context; 34 private String category; 35 36 37 40 public ContextBasedTag() { 41 super(); 42 } 43 44 45 51 public Boolean getContext() { 52 return context; 53 } 54 55 61 public void setContext(Boolean context) { 62 this.context = context; 63 } 64 65 70 public String getCategory() { 71 return category; 72 } 73 74 79 public void setCategory(String category) { 80 this.category = category; 81 } 82 83 84 87 protected void appendContextPlusURL(StringBuffer buf, String url) 88 throws JspException { 89 boolean contextBool = (context == null) ? true : context.booleanValue(); 90 HttpServletRequest request = (HttpServletRequest ) pageContext.getRequest(); 91 try { 92 CategoryConfig cc = URLGenerator.getCategory(request, category, 93 ViewConstants.URL_CATEGORY_NAME); 94 URLGenerator.generateURL(buf, cc, url, contextBool, request, 95 (HttpServletResponse ) pageContext.getResponse()); 96 } catch (URISyntaxException usi) { 97 throw new JspException (usi); 98 } 99 } 100 } | Popular Tags |