コード例 #1
0
ファイル: PlatformSPFilter.java プロジェクト: ossbase/p1
  protected void sendToLogoutPage(
      HttpServletRequest request, HttpServletResponse response, HttpSession session)
      throws IOException, ServletException {
    // we are invalidated.
    RequestDispatcher dispatch =
        this.servletContext.getRequestDispatcher(this.getConfiguration().getLogOutPage());
    if (dispatch == null) {
      logger.samlSPCouldNotDispatchToLogoutPage(this.getConfiguration().getLogOutPage());
    } else {
      logger.trace("Forwarding request to logOutPage: " + this.getConfiguration().getLogOutPage());

      try {
        session.invalidate();
      } catch (IllegalStateException e) {
        // if session was already invalidated we just ignore the exception.
        return;
      }

      try {
        dispatch.forward(request, response);
      } catch (Exception e) {
        //                JBAS5.1 and 6 quirkiness
        dispatch.forward(request, response);
      }
    }
  }
コード例 #2
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    /*	-- pentru codul scris in java
    	response.setContentType("text/thml");
    	PrintWriter out =  response.getWriter();
    	out.println("Beer Selection Advice");
    */
    String c = request.getParameter("color");
    /* se adauga clasa BeerExpert */
    BeerExpert be = new BeerExpert();
    List result = be.getBrands(c);

    /*
     out.println("Got beer color " + c);
    // afisare rezultate din metoda getBrends
     Iterator it = result.iterator();
     while(it.hasNext()){
     	out.println("try: "+ it.next());
     }
    */
    /* cod folosit de aplicatia JSP */
    request.setAttribute("styles", result);
    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request, response);
  }
コード例 #3
0
  // call the an appropriate request dispatcher
  private JSONObject callRequestDispatcher(JmxRequest pJmxReq)
      throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException,
          MBeanException, IOException {
    Object retValue = null;
    boolean useValueWithPath = false;
    boolean found = false;
    for (RequestDispatcher dispatcher : requestDispatchers) {
      if (dispatcher.canHandle(pJmxReq)) {
        retValue = dispatcher.dispatchRequest(pJmxReq);
        useValueWithPath = dispatcher.useReturnValueWithPath(pJmxReq);
        found = true;
        break;
      }
    }
    if (!found) {
      throw new IllegalStateException(
          "Internal error: No dispatcher found for handling " + pJmxReq);
    }

    JsonConvertOptions opts = getJsonConvertOptions(pJmxReq);

    Object jsonResult =
        converters
            .getToJsonConverter()
            .convertToJson(retValue, useValueWithPath ? pJmxReq.getPathParts() : null, opts);

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("value", jsonResult);
    jsonObject.put("request", pJmxReq.toJSON());
    return jsonObject;
  }
コード例 #4
0
ファイル: BeerSelect.java プロジェクト: ithakar/servlet
  public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    // res.setContentType("text/html");
    // PrintWriter pw = res.getWriter();
    // pw.println("Beer selection advice<br/>");
    BeerExpert be = new BeerExpert();
    String c = req.getParameter("color");
    List result = be.getBrands(c);

    req.setAttribute("styles", result);

    String email = getServletConfig().getInitParameter("adminEmail");
    RequestDispatcher view = req.getRequestDispatcher("result.jsp");
    // try{
    view.forward(req, res);
    // } catch (Exception e) {
    // 	System.out.println("some thing wrong in view.forward");
    // 	e.printStackTrace();
    // }

    // Iterator it = result.iterator();
    // while(it.hasNext()){
    // 	pw.println("<br/> tyr: " + it.next());
    // }

  }
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    String amount = request.getParameter("amount");
    String amount2 = request.getParameter("amount2");
    String amount3 = request.getParameter("amount3");
    Integer posotita = Integer.parseInt(amount);
    Integer posotita2 = Integer.parseInt(amount2);
    Integer posotita3 = Integer.parseInt(amount3);

    HttpSession session = request.getSession();

    if (session.isNew()) {
      request.setAttribute("sessionVal", "this is a new session");
    } else {
      request.setAttribute("sessionVal", "Welcome Back!");
    }

    double total = ((posotita * 18.50) + (posotita2 * 6.95) + (posotita3 * 1.29));
    session.setAttribute("totalVal", total);

    request.setAttribute("currency", total);
    request.setAttribute("from", amount);
    request.setAttribute("from2", amount2);
    request.setAttribute("from3", amount3);

    RequestDispatcher view = request.getRequestDispatcher("index.jsp");
    view.forward(request, response);
  }
コード例 #6
0
  private void processRequestDefault(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    request.setAttribute(QueryBuilder.HTML_TITLE, GlobalProperties.getTitle());

    RequestDispatcher dispatcher =
        getServletContext().getRequestDispatcher("/WEB-INF/jsp/tumormap/tumormap.jsp");
    dispatcher.forward(request, response);
  }
コード例 #7
0
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {

    String fowarding = "/guestbook";
    RequestDispatcher rd = req.getRequestDispatcher(fowarding);

    try {
      rd.forward(req, resp);
    } catch (ServletException e) {
      e.printStackTrace();
    }
  }
コード例 #8
0
  /**
   * @param request The servlet request we are processing
   * @param result The servlet response we are creating
   * @param chain The filter chain we are processing
   * @exception IOException if an input/output error occurs
   * @exception ServletException if a servlet error occurs
   */
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    // once session invalidated, go back to login screen
    HttpServletRequest req = (HttpServletRequest) request;
    HttpSession session = req.getSession();
    String login = (String) session.getAttribute("login");
    if (login != null && login.equals("Y")) {
      chain.doFilter(request, response);
    } else {
      RequestDispatcher rd = request.getRequestDispatcher("/myadmin/logout.jsp");
      rd.forward(request, response);
    }

    // chain.doFilter(request, response);
  }
コード例 #9
0
ファイル: Select.java プロジェクト: thanosgk/ECE-projects
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {

    String c = request.getParameter("type");
    String d = request.getParameter("q");

    Expert ce = new Expert();

    List result = ce.getTypes(c, d);

    getServletContext().setAttribute("SAVED_DATA", result);
    request.setAttribute("styles", result);

    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request, response);
  }
コード例 #10
0
ファイル: HandleDelete.java プロジェクト: sll778/mobileshop
 public void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   request.setCharacterEncoding("gb2312");
   String delete = request.getParameter("delete");
   Login loginBean = null;
   HttpSession session = request.getSession(true);
   try {
     loginBean = (Login) session.getAttribute("loginBean");
     boolean b = loginBean.getLogname() == null || loginBean.getLogname().length() == 0;
     if (b) response.sendRedirect("login.jsp"); // 重定向到登录页面
     LinkedList<String> car = loginBean.getCar();
     car.remove(delete);
   } catch (Exception exp) {
     response.sendRedirect("login.jsp"); // 重定向到登录页面
   }
   RequestDispatcher dispatcher = request.getRequestDispatcher("lookShoppingCar.jsp");
   dispatcher.forward(request, response); // 转发
 }
コード例 #11
0
  /**
   * Handles HTTP GET requests.
   *
   * @param request Description of the Parameter
   * @param response Description of the Parameter
   * @exception ServletException if there is a Servlet failure
   * @exception IOException if there is an IO failure
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession();

    Integer sessionCounter = (Integer) session.getAttribute("project4SessionCounter");

    if (sessionCounter == null) {
      Integer newCounter = new Integer(1);
      sessionCounter = newCounter;
    } else {
      sessionCounter++;
    }
    session.setAttribute("project4SessionCounter", sessionCounter);

    String url = "/project4Session.jsp";

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);

    dispatcher.forward(request, response);
  }
コード例 #12
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    HttpSession session = request.getSession(false);
    if (session == null) {
      response.sendRedirect("login.html");
      return;
    }

    String userName = (String) session.getAttribute("userName");
    if (isMissing(userName)) {
      response.sendRedirect("login.html");
      return;
    }
    String title = request.getParameter("title");
    String link = request.getParameter("link");
    String description = request.getParameter("description");
    session.setAttribute("title", title);
    session.setAttribute("link", link);
    session.setAttribute("description", description);
    String address = "WEB-INF/view/SaveBookmarkPage.jsp";
    String urlEncoding = response.encodeURL(address);
    RequestDispatcher dispatcher = request.getRequestDispatcher(urlEncoding);
    dispatcher.forward(request, response);
  }
コード例 #13
0
 /**
  * Allows one to forward the following request and response using the request dispatcher.
  *
  * @param resource the resource to forward the request/response to.
  * @param request the http request to forward.
  * @param response the http response to forward.
  * @throws javax.servlet.ServletException
  * @throws java.io.IOException
  */
 protected void forward(String resource, HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   RequestDispatcher rd = request.getRequestDispatcher(resource);
   rd.forward(request, response);
 }
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<br><h4>we are getting data</h4>");
    String code = request.getParameter("code");
    out.println("<br>code: " + code);
    out.println("<br>");
    try {
      OAuthClientRequest requestOAuth =
          OAuthClientRequest.tokenLocation("https://graph.facebook.com/oauth/access_token")
              .setGrantType(GrantType.AUTHORIZATION_CODE)
              .setClientId(apiKey)
              .setClientSecret(secretKey)
              .setRedirectURI(redirectUri)
              .setCode(code)
              .buildBodyMessage();

      OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());

      GitHubTokenResponse oAuthResponse =
          oAuthClient.accessToken(requestOAuth, GitHubTokenResponse.class);
      accessToken = oAuthResponse.getAccessToken();
      expiresIn = oAuthResponse.getExpiresIn();
    } catch (OAuthSystemException ae) {
      ae.printStackTrace();
    } catch (OAuthProblemException pe) {
      pe.printStackTrace();
    }

    // out.println("<br>Access Token: " + accessToken);
    // out.println("<br>Expires In: " + expiresIn);

    try {
      FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
      myFriends = facebookClient.fetchConnection("me/friends", User.class);
      myFeeds = facebookClient.fetchConnection("me/home", Post.class);

      for (User myFriend : myFriends.getData()) {
        f.add(myFriend.getName());
        out.println("<br>id: " + myFriend.getId() + " Name: " + myFriend.getName());
      }
      //	out.println("<br>");
      out.println("<br>f count: " + f.size());
    } catch (FacebookException e) {
      e.printStackTrace();
    }

    facebookDataBean fdb = new facebookDataBean();
    fdb.setName("zishan ali khan");
    HttpSession session = request.getSession();
    if (session != null) {
      session.setAttribute("myfdb", fdb);
      session.setAttribute("yourFriends", f);
      session.setAttribute("feeds", myFeeds);
      RequestDispatcher view = request.getRequestDispatcher("result.jsp");
      view.forward(request, response);
      f.clear();
      // out.println("<br>I am in");
    } else {
      // out.println("<br>Session Over");
    }
  }
コード例 #15
0
ファイル: Search.java プロジェクト: JSProjects/projects
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    HttpSession session = request.getSession(false);
    String reseller = null;
    if (session != null && session.getAttribute("reseller") != null)
      reseller = "%" + session.getAttribute("reseller") + "%";
    List<LicenseData> searchResult = null;
    if (reseller != null) {
      /*  session.setAttribute("fieldsearch", true);
      session.removeAttribute("datesearch");*/

      if (request.getParameter("so") != null && !request.getParameter("so").isEmpty()) {

        log.info(
            "Search Fields : Sales Order Search "
                + request.getParameter("so")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("so"), "so");

        session.setAttribute("so", request.getParameter("so"));
        session.removeAttribute("enduser");
        session.removeAttribute("ek");
        session.setAttribute("label", "Sales Order");
        session.setAttribute("value", request.getParameter("so"));

      } else if (request.getParameter("enduser") != null
          && !request.getParameter("enduser").isEmpty()) {

        log.info(
            "Search Fields : End User Search "
                + request.getParameter("enduser")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult =
            getSearchByFieldResults(reseller, request.getParameter("enduser"), "enduser");
        session.setAttribute("enduser", request.getParameter("enduser"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("ek");
        session.setAttribute("label", "End User");
        session.setAttribute("value", request.getParameter("enduser"));

      } else if (request.getParameter("ek") != null && !request.getParameter("ek").isEmpty()) {

        log.info(
            "Search Fields : Entitlement Key Search "
                + request.getParameter("ek")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("ek"), "ek");
        session.setAttribute("ek", request.getParameter("ek"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("enduser");
        session.setAttribute("label", "Entitlement Key");
        session.setAttribute("value", request.getParameter("ek"));

      } else if (request.getParameter("sno") != null && !request.getParameter("sno").isEmpty()) {

        log.info(
            "Search Fields : Serial Number Search "
                + request.getParameter("sno")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("sno"), "sno");
        session.setAttribute("sno", request.getParameter("sno"));
        session.removeAttribute("ek");
        session.removeAttribute("so");
        session.removeAttribute("enduser");
        request.setAttribute("sno", 1);
        session.setAttribute("label", "Serial Number");
        session.setAttribute("value", request.getParameter("sno"));

      } else if (request.getParameter("po") != null && !request.getParameter("po").isEmpty()) {

        log.info(
            "Search Fields : Purchase Order Search "
                + request.getParameter("po")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("po"), "po");
        session.setAttribute("po", request.getParameter("po"));
        session.setAttribute("label", "Purchase Order");
        session.setAttribute("value", request.getParameter("po"));

      } else if (request.getParameter("hm") != null && !request.getParameter("hm").isEmpty()) {

        log.info(
            "Search Fields : HM ID Search "
                + request.getParameter("hm")
                + " for reseller "
                + session.getAttribute("hm"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("hm"), "hm");
        session.setAttribute("hm", request.getParameter("hm"));
        session.setAttribute("label", "Hive Manager ID");
        session.setAttribute("value", request.getParameter("hm"));
      }

      session.setAttribute("fieldSearchList", searchResult);
      String nextJSP = "/viewFieldSearchResult.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    } else {

      log.info("Search Fields : Reseller Blank  ");
      String nextJSP = "/login.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    }
  }
コード例 #16
0
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String actionName = "";
    String pathInfo = request.getPathInfo();
    String destinationPage = ERROR_PAGE;

    if (inventory == null) {
      String errorMessage = "Inventory EJB reference is null.";
      request.setAttribute(ERROR_KEY, errorMessage);
    } else {

      if (pathInfo != null) {
        actionName = pathInfo.substring(1); // Get the action name from the HTTP Request.
      }

      // perform action
      if (VIEW_CAR_LIST_ACTION.equals(actionName)) {
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (ADD_CAR_ACTION.equals(actionName)) {
        request.setAttribute("car", new CarDTO());
        destinationPage = "/carForm.jsp";
      } else if (EDIT_CAR_ACTION.equals(actionName)) {
        int id = Integer.parseInt(request.getParameter("id"));
        request.setAttribute("car", inventory.findCar(id));
        destinationPage = "/carForm.jsp";
      } else if (SAVE_CAR_ACTION.equals(actionName)) {
        // build the car from the request parameters
        CarDTO car = new CarDTO();
        car.setId(Integer.parseInt(request.getParameter("id")));
        car.setMake(request.getParameter("make"));
        car.setModel(request.getParameter("model"));
        car.setModelYear(request.getParameter("modelYear"));

        // save the car
        inventory.saveCar(car);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (DELETE_CAR_ACTION.equals(actionName)) {
        // get list of ids to delete
        String[] ids = request.getParameterValues("id");

        // delete the list of ids

        inventory.deleteCars(ids);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (VIEW_BUY_CAR_FORM_ACTION.equals(actionName)) {
        int id = Integer.parseInt(request.getParameter("id"));
        request.setAttribute("car", inventory.findCar(id));
        destinationPage = "/buyCarForm.jsp";
      } else if (BUY_CAR_ACTION.equals(actionName)) {
        int carId = Integer.parseInt(request.getParameter("id"));
        double price;

        // Use $5000.00 as the default price if the user enters bad data.
        try {
          price = Double.parseDouble(request.getParameter("price"));
        } catch (NumberFormatException nfe) {
          price = 5000.00;
        }

        System.out.println("carId = [" + carId + "], price = [" + price + "]");

        // mark the car as sold
        inventory.buyCar(carId, price);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else {
        String errorMessage = "[" + actionName + "] is not a valid action.";
        request.setAttribute(ERROR_KEY, errorMessage);
      }
    }

    // Redirect to destination page.
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(destinationPage);

    dispatcher.forward(request, response);
  }
コード例 #17
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    boolean orderCompleted = true;

    // Get the user's session and shopping cart
    HttpSession session = request.getSession(true);
    ResourceBundle messages = (ResourceBundle) session.getAttribute("messages");
    ShoppingCart cart = (ShoppingCart) session.getAttribute("cart");

    if (cart == null) {
      cart = new ShoppingCart();
      session.setAttribute("cart", cart);
    }

    // Update the inventory
    try {
      utx.begin();
      bookDB.buyBooks(cart);
      utx.commit();
    } catch (Exception ex) {
      try {
        utx.rollback();
      } catch (Exception e) {
        System.out.println("Rollback failed: " + e.getMessage());
      }

      System.err.println(ex.getMessage());
      orderCompleted = false;
    }

    // Payment received -- invalidate the session
    session.invalidate();

    // set content type header before accessing the Writer
    response.setContentType("text/html");
    response.setBufferSize(8192);

    PrintWriter out = response.getWriter();

    // then write the response
    out.println(
        "<html>" + "<head><title>" + messages.getString("TitleReceipt") + "</title></head>");

    // Get the dispatcher; it gets the banner to the user
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/banner");

    if (dispatcher != null) {
      dispatcher.include(request, response);
    }

    if (orderCompleted) {
      out.println("<h3>" + messages.getString("ThankYou") + request.getParameter("cardname") + ".");
    } else {
      out.println("<h3>" + messages.getString("OrderError"));
    }

    out.println(
        "<p> &nbsp; <p><strong><a href=\""
            + response.encodeURL(request.getContextPath())
            + "/bookstore\">"
            + messages.getString("ContinueShopping")
            + "</a> &nbsp; &nbsp; &nbsp;"
            + "</body></html>");
    out.close();
  }
コード例 #18
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    response.setContentType("text/html");
    HttpSession session =
        request.getSession(true); // ��� �������� ������� ������ ������������� ����� true
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    String phoneToDelete = request.getParameter("phoneToDelete");
    String currentName = request.getParameter("name"); // �������� ������
    String newPrice = request.getParameter("finPrice"); // �������� ���� ������
    String number = request.getParameter("number"); // ���������� ������
    String phonesRequestLine = (String) session.getAttribute("phonesRequestLine");
    StringTokenizer tok = null;

    iPhonePageBean[] iPhones = (iPhonePageBean[]) session.getAttribute("iPhones");
    int summary = 0; // �������� ���� �������
    boolean isNew = true;

    if (phonesRequestLine != null) {
      phonesRequestLine = rebuildStringWithException(phonesRequestLine, "null");
      tok = new StringTokenizer(phonesRequestLine);
    }

    if (currentName != null && newPrice != null && number != null)
      if (isNumber(Integer.parseInt(number)) && isNumber(Integer.parseInt(newPrice))) {
        for (int i = 0; i < iPhones.length; ++i)
          if (iPhones[i].getName().equals(currentName)) {
            iPhones[i].setNumber(number);
            iPhones[i].setFinalPrice(newPrice);

            break;
          }
      }

    for (int i = 0; i < iPhones.length; ++i)
      if (!iPhones[i].getNumber().equals("0")) {
        isNew = false;

        break;
      }

    if (isNew) {
      while (tok.hasMoreElements()) {
        String temp = tok.nextToken();

        for (int i = 0; i < iPhones.length; ++i)
          if (iPhones[i].getName().equals(temp)) {
            iPhones[i].setNumber("1");
            summary += iPhones[i].getPrice();
          }
      }
    } else {
      for (int i = 0; i < iPhones.length; ++i) {
        summary += (Integer.parseInt(iPhones[i].getNumber()) * iPhones[i].getPrice());
      }
    }

    ////////////////////////////////////////////////////////////////////////

    if (phoneToDelete != null && phonesRequestLine != null) {
      phonesRequestLine = rebuildStringWithException(phonesRequestLine, phoneToDelete);

      int tempID = idOfSpecPhone(iPhones, phoneToDelete);

      if (tempID >= 0) {
        summary =
            summary - (iPhones[tempID].getPrice() * Integer.parseInt(iPhones[tempID].getNumber()));
      }

      iPhones[tempID].setNumber("0");

      session.setAttribute("phonesRequestLine", phonesRequestLine);
    }

    session.setAttribute("summary", summary);

    RequestDispatcher dispatcher =
        request.getRequestDispatcher("cart.jsp?lang=" + (String) session.getAttribute("lang"));
    dispatcher.forward(request, response);
  }
コード例 #19
0
 public void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   RequestDispatcher dispatcher =
       request.getRequestDispatcher("/WEB-INF/classes/view/errors/Error.jsp");
   dispatcher.forward(request, response);
 }
  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=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");
      out.write("\r\n\r\n");

      String strIp = (String) request.getParameter("ip");
      String strCommunityString = (String) request.getParameter("cs");
      String strPort = (String) request.getParameter("port");
      String strTimeout = (String) request.getParameter("timeout");
      String strRetries = (String) request.getParameter("retries");
      String strNodeLabel = (String) request.getParameter("node");
      String strNodeId = request.getParameter("nodeId");
      String strFirstTime = (String) request.getParameter("firsttime");
      String strWindowId = (String) request.getParameter("windowid");

      // Create the querier and make the request.
      QueryFactory factory = new QueryFactory();
      Querier querier = (Querier) factory.createQuerier(WinPagePerfSnmpQuerier.QUERIER_NAME);
      DeviceCommunicator deviceCommunicator = new DeviceCommunicator();
      deviceCommunicator.sendQuery(querier, strIp);

      // Error processing
      if (querier.getErrorStatus() == -1) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpCommError");
        rd.forward(request, response);
        return;
      }
      if (querier.getErrorStatus() == -2) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=NoPerfmibSnmpError");
        rd.forward(request, response);
        return;
      }

      if (querier.getErrorStatus() != 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Map calcs = querier.getCalculations();
      long[] results = (long[]) calcs.get(WinPagePerfSnmpQuerier.PAGE_RESULTS);

      if (results[0] < 0
          || results[1] < 0
          || results[2] < 0
          || results[3] < 0
          || results[4] < 0
          || results[5] < 0
          || results[6] < 0
          || results[7] < 0
          || results[8] < 0
          || results[9] < 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Vector vPageStats = null;

      if (strFirstTime == null) {
        // Not the first time, so get the previous polled data from the session
        vPageStats = (Vector) session.getAttribute("vPageStats" + strWindowId);
      } else {
        // This is the first time in this JSP, so create the Vector which will contain the
        // polled data
        Random random = new Random();
        strWindowId = String.valueOf(random.nextInt());

        vPageStats = new Vector();
      }

      vPageStats.add(results);
      session.setAttribute("vPageStats" + strWindowId, vPageStats);

      // This random number is used to prevent the brower from caching the IMG tags
      Random random = new Random();
      int randomInt = random.nextInt();

      out.write("\r\n\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n  ");
      out.write("<title>WebTelemetry - Graphs | Real-Time | Windows Page Performance Monitoring");
      out.write("</title>\r\n  ");
      out.write("<META HTTP-EQUIV=\"refresh\" CONTENT=\"");
      out.print(WTProperties.getMonitorUIRefreshRate());
      out.write("; URL=");
      out.print(WTTools.getJspURL(request));
      out.write("WTwin-page-monitor.jsp?cs=");
      out.print(URLEncoder.encode(strCommunityString, "UTF-8"));
      out.write("&ip=");
      out.print(strIp);
      out.write("&port=");
      out.print(strPort);
      out.write("&timeout=");
      out.print(strTimeout);
      out.write("&retries=");
      out.print(strRetries);
      out.write("&node=");
      out.print(URLEncoder.encode(strNodeLabel, "UTF-8"));
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("&nodeId=");
      out.print(strNodeId);
      out.write("\">\r\n  ");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\r\n  ");
      out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">");
      out.write("</script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      String title =
          "Graphs - Real-Time - Windows Page Performance Monitoring for Node: " + strNodeLabel;
      out.write("\r\n");
      request.setAttribute("title", title);
      request.setAttribute("nodeJsp", "/wt-monitor/element/node.jsp?node=" + strNodeId);
      out.write("\r\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("\r\n\t");
            if (_jspx_meth_c_param_0(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_1(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_2(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\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("\t\r\n\t");
      out.write("\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"20\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimeschart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimesseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("</div>\r\n");
      out.write("<br>\r\n\r\n");
      /* ----  c:import ---- */
      org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_1 =
          (org.apache.taglibs.standard.tag.el.core.ImportTag)
              _jspx_tagPool_c_import_url_context_nobody.get(
                  org.apache.taglibs.standard.tag.el.core.ImportTag.class);
      _jspx_th_c_import_1.setPageContext(pageContext);
      _jspx_th_c_import_1.setParent(null);
      _jspx_th_c_import_1.setContext("/wt-monitor");
      _jspx_th_c_import_1.setUrl("/includes/footer.jsp");
      int[] _jspx_push_body_count_c_import_1 = new int[] {0};
      try {
        int _jspx_eval_c_import_1 = _jspx_th_c_import_1.doStartTag();
        if (_jspx_th_c_import_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } catch (Throwable _jspx_exception) {
        while (_jspx_push_body_count_c_import_1[0]-- > 0) out = pageContext.popBody();
        _jspx_th_c_import_1.doCatch(_jspx_exception);
      } finally {
        _jspx_th_c_import_1.doFinally();
        _jspx_tagPool_c_import_url_context_nobody.reuse(_jspx_th_c_import_1);
      }
      out.write("\r\n\t\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } 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);
    }
  }