Example #1
0
 /** This method will encode a url to support URL rewriting */
 public String encodeURL(String url) {
   if (url == null) return null;
   if (url.toLowerCase().startsWith("javascript:")) return url;
   if (!getPage().getEncodeURLs()) {
     String logicalName = getSiteMapEntryName(url);
     if (logicalName == null) return url;
     else {
       url = translateSiteMapURL(url);
       SiteMap m = getPage().getSiteMap();
       if (m != null) return m.addJavaScriptToUrl(logicalName, url);
       else return url;
     }
   }
   if (!getPage().isWMLMaintained()) {
     HttpServletRequest req = getPage().getCurrentRequest();
     HttpServletResponse res = getPage().getCurrentResponse();
     String logicalName = getSiteMapEntryName(url);
     if (logicalName == null) return HttpServletResponseWrapper.encodeURL(url, req, res);
     else {
       String translatedURL = translateSiteMapURL(url);
       String encodedURL = HttpServletResponseWrapper.encodeURL(translatedURL, req, res);
       SiteMap m = getPage().getSiteMap();
       if (m != null) return m.addJavaScriptToUrl(logicalName, encodedURL);
       else return encodedURL;
     }
   } else {
     url = translateSiteMapURL(url);
     HttpServletRequest req = getPage().getCurrentRequest();
     HttpServletResponse res = getPage().getCurrentResponse();
     if (HttpServletResponseWrapper.encodeURL(url, req, res).indexOf(';') >= 0) {
       if (url.indexOf('?') >= 0)
         if (url.indexOf(
                 PageTag.getSessionIdentifier()
                     + "="
                     + PageTag.getWmlSessId(getPage().getSession()))
             < 0) {
           if (url.endsWith("&amp;") || url.endsWith("?"))
             return url
                 + PageTag.getSessionIdentifier()
                 + "="
                 + PageTag.getWmlSessId(getPage().getSession());
           else
             return url
                 + "&amp;"
                 + PageTag.getSessionIdentifier()
                 + "="
                 + PageTag.getWmlSessId(getPage().getSession());
         } else return url;
       else
         return url
             + "?"
             + PageTag.getSessionIdentifier()
             + "="
             + PageTag.getWmlSessId(getPage().getSession());
     } else return url;
   }
 }
 public void setStatus(int statusCode, String message) {
   detectErrorResponse(statusCode);
   super.setStatus(statusCode, message);
 }
 public void setStatus(int statusCode) {
   detectErrorResponse(statusCode);
   super.setStatus(statusCode);
 }
 public void sendError(int errorCode, String message) throws IOException {
   detectErrorResponse(errorCode);
   super.sendError(errorCode, message);
 }