Package org.apache.struts2.util

Examples of org.apache.struts2.util.Counter


        }

        StringWriter sw = new StringWriter();
        PrintWriter writer = new PrintWriter(sw);

        Counter counter = (Counter) filterConfig.getServletContext()
                                                .getAttribute("hitCounter");
        writer.println();
        writer.println(
                "=======================================================");
        writer.println("The number of hits is: " + counter.incCounter());
        writer.println(
                "=======================================================");

        // Log the resulting string
        writer.flush();
        System.out.println(sw.getBuffer().toString());

        PrintWriter out = response.getWriter();
        CharResponseWrapper wrapper = new CharResponseWrapper(
                    (HttpServletResponse) response);
        chain.doFilter(request, wrapper);

        CharArrayWriter caw = new CharArrayWriter();
        caw.write(
                wrapper.toString().substring(
                        0,
                        wrapper.toString().indexOf("</body>") - 1));
        caw.write(
                "<p>\n<center>" + messages.getString("Visitor")
                + "<font color='red'>" + counter.getCounter()
                + "</font></center>");
        caw.write("\n</body></html>");
        response.setContentLength(caw.toString()
                                     .getBytes().length);
        out.write(caw.toString());
View Full Code Here


    private ServletContext context = null;

    public void contextInitialized(ServletContextEvent event) {
        context = event.getServletContext();

        Counter counter = new Counter();
        context.setAttribute("hitCounter", counter);
        counter = new Counter();
        context.setAttribute("orderCounter", counter);

        try {
            BookDBAO bookDB = new BookDBAO(emf);
            context.setAttribute("bookDB", bookDB);
View Full Code Here

        }
       
        wsdlDefinition = def;
        wsdlURL = wURL;

        accessCount = new Counter();

        releaseResources();
    }
View Full Code Here

        }
       
        wsdlDefinition = def;
        wsdlURL = wURL;

        accessCount = new Counter();

        releaseResources();
    }
View Full Code Here

    assert (body != null);

    try {
      writer.write(body);
    } catch (IOException e) {
      throw new StrutsException("IOError while writing the body: " + e.getMessage(), e);
    }
    if (popComponentStack) {
      popComponentStack();
    }
    return false;
View Full Code Here

        + getComponentName()
        + "', field '"
        + field
        + (parameters != null && parameters.containsKey("name") ? "', name '"
            + parameters.get("name") : "") + "': " + errorMsg;
    throw new StrutsException(msg, e);
  }
View Full Code Here

      }
      try {
        objectFactory.getClassInstance(actionClass.getName());
      } catch (ClassNotFoundException e) {
        logger.error("Object Factory was unable to load class {}", actionClass.getName());
        throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(),
            e);
      }
      String[] beanNames = beanNameFinder.getBeanNames(actionClass);
      switch (beanNames.length) {
      case 0:
View Full Code Here

                if(it.hasNext()) {
                    sb.append("&");
                }
            }
            } catch (UnsupportedEncodingException e) {
                throw new StrutsException("Encoding "+ENCODING+" not found");
            }
        }
        RenderResponse resp = PortletActionContext.getRenderResponse();
        RenderRequest req = PortletActionContext.getRenderRequest();
        return resp.encodeURL(req.getContextPath() + sb.toString());
View Full Code Here

                mapping = actionMapper.getMapping(httpRequest, dispatcherUtils.getConfigurationManager());
            }
        }
       
        if (mapping == null) {
            throw new StrutsException("Unable to locate action mapping for request, probably due to " +
                    "an invalid action path: "+actionPath);
        }
        return mapping;
    }
View Full Code Here

                }
                if (count-- <= 0) {
                    locks.remove(o);
                    o.notify();

                    throw new StrutsException("Deadlock in session lock");
                }
                o.wait(10000);
            }
            ;
            locks.put(o, invocation);
View Full Code Here

TOP

Related Classes of org.apache.struts2.util.Counter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.