public void removeAttribute(String attribute) { request.removeAttribute(attribute); }
/** * Processes the request coming to the servlet and grabs the attributes set by the servlet and * uses them to fire off pre-determined methods set in the setupActionMethods function of the * servlet. * * @param request the http request coming from the browser. * @param response the http response going to the browser. * @throws javax.servlet.ServletException * @throws java.io.IOException */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (!actionInitialized) { LogController.write(this, "This dispatcher servlet is not initialized properly!"); return; } if (actionTag == null) { LogController.write(this, "There is no action attribute tag name!"); return; } HttpSession httpSession = request.getSession(); UserSession userSession = (UserSession) httpSession.getAttribute("user_session"); if (userSession == null) { LogController.write(this, "User session is no longer available in this http session."); userSession = new UserSession(); // We always want a user session though... httpSession.setAttribute("user_session", userSession); } String action = (String) request.getAttribute(actionTag); try { if (action == null) { // There is no action attribute specified, check parameters. String external_action = (String) request.getParameter(actionTag); if (external_action != null) { Method method = externalActions.get(external_action); if (method != null) { LogController.write(this, "Performing external action: " + external_action); method.invoke(this, new Object[] {userSession, request, response}); } else { if (defaultExternalMethod != null) { LogController.write(this, "Performing default external action."); defaultExternalMethod.invoke(this, new Object[] {userSession, request, response}); } else { LogController.write(this, "Unable to perform default external action."); } } } else { if (defaultExternalMethod != null) { LogController.write(this, "Performing default external action."); defaultExternalMethod.invoke(this, new Object[] {userSession, request, response}); } else { LogController.write(this, "Unable to perform default external action."); } } } else { Method method = internalActions.get(action); if (method != null) { LogController.write(this, "Performing internal action: " + action); method.invoke(this, new Object[] {userSession, request, response}); } else { if (defaultInternalMethod != null) { LogController.write(this, "Performing default internal action."); defaultInternalMethod.invoke(this, new Object[] {userSession, request, response}); } else { LogController.write(this, "Unable to perform default internal action."); } } request.removeAttribute("application_action"); } } catch (IllegalAccessException accessEx) { LogController.write(this, "Exception while processing request: " + accessEx.getMessage()); } catch (InvocationTargetException invokeEx) { LogController.write(this, "Exception while processing request: " + invokeEx.toString()); invokeEx.printStackTrace(); } catch (Exception ex) { LogController.write(this, "Unknown exception: " + ex.toString()); } }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=utf-8"); pageContext = _jspxFactory.getPageContext( this, request, response, "/jsp/GeneralError.jsp", true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n"); out.write("\n"); out.write("\n"); out.write("\n\n"); out.write("\n"); out.write("\n\n"); out.write("\n"); java.util.Date now = null; synchronized (pageContext) { now = (java.util.Date) pageContext.getAttribute("now", PageContext.PAGE_SCOPE); if (now == null) { try { now = (java.util.Date) java.beans.Beans.instantiate( this.getClass().getClassLoader(), "java.util.Date"); } catch (ClassNotFoundException exc) { throw new InstantiationException(exc.getMessage()); } catch (Exception exc) { throw new ServletException("Cannot create bean of class " + "java.util.Date", exc); } pageContext.setAttribute("now", now, PageContext.PAGE_SCOPE); } } out.write("\n\n"); out.write("\n"); out.write("<script type=\"text/javascript\" src=\""); if (_jspx_meth_c_url_0(pageContext)) return; out.write("\">"); out.write("</script>\n\n"); out.write("\n"); if (_jspx_meth_html_xhtml_0(pageContext)) return; out.write("\n"); out.write("\n\n"); out.write("\n"); out.write("\n"); out.write("\n\n\n\n"); out.write("<html>\n"); out.write("<head>\n "); out.write("<title>WebTelemetry - Admin Settings | System Management | License Management"); out.write("</title>\n "); out.write("<base HREF=\""); out.print(org.opennms.web.Util.calculateUrlBase(request)); out.write("\" />\n "); out.write( "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\n "); out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">"); out.write("</script>\n"); out.write("</HEAD>\n\n"); out.write("<SCRIPT LANGUAGE=JAVASCRIPT>\nfunction checkError()\n{\n\t"); if (request.getSession().getAttribute("thErrorMsg") != null) { out.write("\n\talert(\""); out.print(request.getSession().getAttribute("thErrorMsg")); out.write("\");\n "); request.getSession().removeAttribute("thErrorMsg"); out.write("\n\t"); } out.write("\n\t"); if (request.getAttribute("thErrorMsg") != null) { out.write("\n\talert(\""); out.print(request.getAttribute("thErrorMsg")); out.write("\");\n "); request.removeAttribute("thErrorMsg"); out.write("\n\t"); } out.write("\n}\n"); out.write("</SCRIPT>\n"); out.write("<body onload=\"checkError();\">\n"); /* ---- c:import ---- */ org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard.tag.el.core.ImportTag) _jspx_tagPool_c_import_url_context.get( org.apache.taglibs.standard.tag.el.core.ImportTag.class); _jspx_th_c_import_0.setPageContext(pageContext); _jspx_th_c_import_0.setParent(null); _jspx_th_c_import_0.setContext("/wt-monitor"); _jspx_th_c_import_0.setUrl("/includes/header.jsp"); int[] _jspx_push_body_count_c_import_0 = new int[] {0}; try { int _jspx_eval_c_import_0 = _jspx_th_c_import_0.doStartTag(); if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody(); _jspx_push_body_count_c_import_0[0]++; out = _bc; _jspx_th_c_import_0.setBodyContent(_bc); _jspx_th_c_import_0.doInitBody(); } do { out.write("\n "); if (_jspx_meth_c_param_0( _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return; out.write("\n "); if (_jspx_meth_c_param_1( _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return; out.write("\n "); if (_jspx_meth_c_param_2( _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return; out.write("\n"); int evalDoAfterBody = _jspx_th_c_import_0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); _jspx_push_body_count_c_import_0[0]--; } if (_jspx_th_c_import_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; } catch (Throwable _jspx_exception) { while (_jspx_push_body_count_c_import_0[0]-- > 0) out = pageContext.popBody(); _jspx_th_c_import_0.doCatch(_jspx_exception); } finally { _jspx_th_c_import_0.doFinally(); _jspx_tagPool_c_import_url_context.reuse(_jspx_th_c_import_0); } out.write("\n\n"); String errorMsg = (String) request.getAttribute("error"); if (errorMsg != null && !errorMsg.equals("")) { out.write("\n\n"); out.write("<table width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n "); out.write("<tr class=\"tableHeader\">\n "); out.write("<td class=\"tableHeader\">Internal Error"); out.write("</td>\n "); out.write("</tr>\n "); out.write("<tr class=\"error\" >\n "); out.write("<td class=\"error\">"); out.write("<br>"); out.print(errorMsg); out.write("\n "); out.write("<br />"); out.write("<br />"); out.write("<a href=\"mailto:[email protected]\">[email protected]"); out.write("</a>"); out.write("<br /> "); out.write("</td>\n "); out.write("</tr>\n"); out.write("</table>\n"); } out.write("\n\n"); out.write("<!-- BEGIN FRAMING TABLE:open tags, keep at 100%-->\n"); out.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t"); out.write("<tr>\n\t\t"); out.write("<td width=\"10\">"); out.write( "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"10\" border=\"0\" alt=\"WebTelemetry LLC\">"); out.write("</td>\n\t\t"); out.write("<td>\n"); out.write("<!-- END FRAMING TABLE:open tags, keep at 100%-->\n\n"); LicenseManager lim = (LicenseManager) request.getAttribute("licenseManager"); boolean valid = false; boolean bIsAdmin = ((Boolean) request.getAttribute("bIsAdmin")).booleanValue(); if (lim == null) { out.write("\n "); out.write("<p class=\"error\">License File not found!\n "); if (bIsAdmin) { out.write("\n Please install a license file to run WebTelemetry.\n "); } else { out.write( "\n Please contact your System Administrator to rectify this problem.\n "); } out.write("\n "); out.write("</p>\n"); } else { if (!lim.isSigValid()) { out.write("<p class=\"error\">License File corrupted!\n "); if (bIsAdmin) { out.write( "\n Please install a new license file to run WebTelemetry.\n "); } else { out.write( "\n Please contact your System Administrator to rectify this problem.\n "); } out.write("\n "); out.write("</p>"); } else if (lim.daysLeft() == 0) { out.write("<p class=\"error\">License File expired!\n\t "); if (bIsAdmin) { out.write( "\n\t Please install a license file to run WebTelemetry.\n\t "); } else { out.write( "\n\t Please contact your System Administrator to rectify this problem.\n\t "); } out.write("\n "); out.write("</p>"); } else { valid = true; } } out.write("\n"); out.write("<table width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); if (bIsAdmin) { out.write("\n "); out.write("<tr>\n\t\t"); if (lim != null) { out.write("\n\t\t"); out.write("<td colspan=\"2\" align=\"right\" valign=\"top\">\n\t\t"); } else { out.write("\n\t\t"); out.write("<td colspan=\"2\" align=\"left\" valign=\"top\">"); out.write("<br>\n\t\t"); } out.write("\n\t\t"); out.write("<a href=\"/wt-core/license/manager.do?currentCommand="); out.print(WTLicenseForm.LICENSE_UPLOAD); out.write("\">"); out.write( "<img src=\"/wt-portal/images/buttons/btn_install_license.gif\" border=\"0\" alt=\"Install a New License\" vspace=\"4\">"); out.write("</a>\n "); out.write("<a class=\"tt\" href=\"javascript:towerTip("); out.print(WTTips.TIP_LICENSE_UPLOAD); out.write(");\" title=\"Telemetry Tip\">"); out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">"); out.write("</a>\n \n\t\t"); out.write("\n"); out.write("</td>"); out.write("</tr>\n"); } out.write("\n "); out.write("<tr>\n "); out.write("<td colspan=\"2\">"); out.write( "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"4\" width=\"10\" border=\"0\" alt=\"WebTelemetry LLC\">"); out.write("</td>\n "); out.write("</tr>\n\n"); if (lim != null) { String licStatus = valid ? "<span class='success'>Valid</span>" : "<span class='error'>Invalid</span>"; String exp = lim.getFeature(License.WT_EXPIRATION_FIELD_NAME); int trCount = -1; out.write("\n\t "); out.write("<tr class=\"tableHeader\">\n\t "); out.write("<td class=\"tableHeader\" width=\"70%\">Attribute"); out.write("<a class=\"tt\" href=\"javascript: towerTip("); out.print(WTTips.TIP_LICENSE_ATTRIBUTES); out.write(");\" title=\"Telemetry Tip\">"); out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">"); out.write("</a>"); out.write("</td>\n\t "); out.write("<td class=\"tableHeader\" width=\"30%\">Value"); out.write("</td>\n\t "); out.write("</tr>\n\n "); String trColor = (++trCount % 2 == 0) ? "tableRowLight" : "tableRowDark"; out.write("\n\t "); out.write("<tr class=\""); out.print(trColor); out.write("\">\n\t "); out.write("<td class=\"tableText\">Support License"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.print(licStatus); out.write("</td>\n\t "); out.write("</tr>\n\n "); trColor = (++trCount % 2 == 0) ? "tableRowLight" : "tableRowDark"; out.write("\n\t "); out.write("<tr class=\""); out.print(trColor); out.write("\">\n\t "); out.write("<td class=\"tableText\">Support Licensor"); out.write("</td>\n"); out.write("<!-- \n\t "); out.write("<td class=\"tableText\">"); out.print(lim.getFeature(License.WT_LICENSOR_FIELD_NAME)); out.write("</td>\n\t\t-->\n\t\t "); out.write("<td class=\"tableText\">WebTelemetry LLC"); out.write("</td>\n\t "); out.write("</tr>\n\n "); trColor = (++trCount % 2 == 0) ? "tableRowLight" : "tableRowDark"; out.write("\n\t "); out.write("<tr class=\""); out.print(trColor); out.write("\">\n\t "); out.write("<td class=\"tableText\">Support Licensee"); out.write("</td>\n\n"); out.write("<!--\n\t "); out.write("<td class=\"tableText\">"); out.print(lim.getFeature(License.WT_LICENSEE_FIELD_NAME)); out.write("</td>\n-->\n\t\t "); out.write("<td class=\"tableText\">WebTelemetry LLC"); out.write("</td>\n\n\t "); out.write("</tr>\n\n\n"); out.write("\n\n "); trColor = (++trCount % 2 == 0) ? "tableRowLight" : "tableRowDark"; out.write("\n\t "); out.write("<tr class=\""); out.print(trColor); out.write("\">\n\t "); out.write("<td class=\"tableText\">Discovery Engine"); out.write("</td>\n\t "); String safariStatus = (Integer.parseInt(lim.getFeature(License.WT_SAFARI_MASTER_ACCOUNT_ID_FIELD_NAME)) > 0 && Integer.parseInt(lim.getFeature(License.WT_SAFARI_USER_COUNT_FIELD_NAME)) > 0) ? "Enabled" : "Disabled"; if (!"Disabled".equals(safariStatus)) { int safariDaysLeft = lim.daysLeft(License.WT_SAFARI_EXPIRATION_FIELD_NAME); if (safariDaysLeft == 0) safariStatus = "Expired"; } out.write("\n\t "); out.write("<td class=\"tableText\">"); out.print(safariStatus); out.write("</td>\n\t "); out.write("</tr>\n\n\t "); if (!"Disabled".equals(safariStatus)) { out.write("\n "); trColor = (++trCount % 2 == 0) ? "tableRowLight" : "tableRowDark"; out.write("\n\t\t "); out.write("<tr class=\""); out.print(trColor); out.write("\">\n\t\t "); out.write("<td class=\"tableText\">Smart Discovery Expiration Date"); out.write("</td>\n\t\t "); out.write("<td class=\"tableText\">"); out.print(lim.getFeature(License.WT_SAFARI_EXPIRATION_FIELD_NAME)); out.write("\n\t\t "); out.write("</tr>\n\t "); } out.write(" \n"); } out.write("\n"); out.write("</table>\n\n"); out.write("<!-- BEGIN FRAMING TABLE:close tags-->\n\t\t"); out.write("</td>\n\t"); out.write("</tr>\n"); out.write("</table>\n"); out.write("<!-- END FRAMING TABLE:close tags-->\n"); out.write("<br>\n\n"); JspRuntimeLibrary.include( request, response, "../includes/footer.jsp" + "?" + "location=" + "admin" + "&" + "help=" + "WTHelp_License.html", out, false); out.write("\n\n "); out.write("</BODY>\n "); out.write("<!-- end list-organiztion.jsp -->\n"); out.write("</HTML>\n"); } catch (Throwable t) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } }