1 43 package net.jforum; 44 45 import javax.servlet.http.HttpServletRequest ; 46 import javax.servlet.http.HttpServletResponse ; 47 48 52 public class JForumContext 53 { 54 private String contextPath; 55 private String servletExtension; 56 57 private HttpServletResponse response; 58 59 private boolean isEncodingDisabled; 60 61 public JForumContext(String contextPath, String servletExtension, HttpServletRequest req, 62 HttpServletResponse response, boolean isEncodingDisabled) 63 { 64 this.contextPath = contextPath; 65 this.servletExtension = servletExtension; 66 this.response = response; 67 this.isEncodingDisabled = isEncodingDisabled; 68 } 69 70 public String encodeURL(String url) 71 { 72 return this.encodeURL(url, servletExtension); 73 } 74 75 public String encodeURL(String url, String extension) 76 { 77 String ucomplete = contextPath + url + extension; 78 79 if (isEncodingDisabled()) { 80 return ucomplete; 81 } 82 83 return response.encodeURL(ucomplete); 84 } 85 86 public boolean isEncodingDisabled() 87 { 88 return this.isEncodingDisabled; 89 } 90 91 } 92 | Popular Tags |