| 1 101 package com.ivata.groupware.web.tag; 102 103 import java.io.File ; 104 import java.io.IOException ; 105 106 import javax.servlet.RequestDispatcher ; 107 import javax.servlet.ServletException ; 108 import javax.servlet.http.HttpServletRequest ; 109 import javax.servlet.jsp.JspException ; 110 import javax.servlet.jsp.tagext.TagSupport ; 111 112 128 public class CheckSiteTag extends TagSupport { 129 130 139 public int doEndTag() throws JspException { 140 HttpServletRequest request = (HttpServletRequest ) pageContext.getRequest(); 141 String jndiPrefix = ""; 142 File siteDownFile = new File ("/var/lock/ivata groupware/site_down/" + 145 jndiPrefix + "_down"); 146 147 String requestURL = request.getRequestURL().toString(); 149 if (requestURL.indexOf("error.jsp") == -1) { 150 request.getSession().setAttribute("lastURL", requestURL); 151 } 152 153 if (!siteDownFile.exists()) { 155 return EVAL_PAGE; 156 } 157 158 try { 159 RequestDispatcher dispatcher = pageContext.getServletContext().getRequestDispatcher("/maintenance.jsp?jndiPrefix=" + jndiPrefix); 162 dispatcher.forward(request, pageContext.getResponse()); 163 } catch (IOException e) { 164 throw new JspException (e); 165 } catch (ServletException e) { 166 throw new JspException (e); 167 } 168 return SKIP_PAGE; 169 } 170 } 171 | Popular Tags |