Results 1 to 3 of 3
  1. #1
    Berick is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default Web Logging Filter

    Hi there

    I am writing a filter to log the web access to one of my projects. So far everything is going well.

    Now I have the problem that I only get the status code for 4xx codes. If there is a 5xx error or everything is going well I don't get any code back. I would like to change that.

    And also if there is a 5xx error I would like to save the displayed error message so I can check what happened.

    This is how my wrapper class looks at the moment:
    Java Code:
    private static class StatusExposingServletResponse extends HttpServletResponseWrapper {
    
    		private Integer httpStatus;
    
    		public StatusExposingServletResponse(HttpServletResponse response) {
    			super(response);
    		}
    
    		@Override
    		public void sendError(int sc) throws IOException {
    			httpStatus = sc;
    			super.sendError(sc);
    		}
    
    		@Override
    		public void sendError(int sc, String msg) throws IOException {
    			httpStatus = sc;
    			super.sendError(sc, msg);
    		}
    
    		@Override
    		public void setStatus(int sc) {
    			httpStatus = sc;
    			super.setStatus(sc);
    		}
    
    		@Override
    		public void setStatus(int sc, String msg) {
    			httpStatus = sc;
    			super.setStatus(sc, msg);
    		}
    
    		public Integer getStatus() {
    			return httpStatus;
    		}
    But now I only get some statuscodes but not all. Any ideas how to change that and how to get the content if there is a 5xx error code? So I can save the exception?

  2. #2
    Berick is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    I am not sure what do you mean with additional information? Please be more specific.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default

    They're a spammer.
    Hence the link in their sig.

    As for your question, I'm not sure you can expect to be able to intercept all codes?
    They don't all come from deep enough in the server for your filter to work, I'd have thought anyway.

Similar Threads

  1. JVM Logging
    By sansana in forum New To Java
    Replies: 2
    Last Post: 07-10-2010, 01:56 AM
  2. web content filter or internet filter
    By sundarjothi in forum Advanced Java
    Replies: 3
    Last Post: 05-15-2008, 11:36 AM
  3. Logging applications
    By ravian in forum New To Java
    Replies: 2
    Last Post: 01-02-2008, 06:43 PM
  4. what is logging
    By Thirumalt in forum Java Software
    Replies: 1
    Last Post: 11-26-2007, 11:37 AM
  5. Logging
    By ravian in forum New To Java
    Replies: 3
    Last Post: 11-18-2007, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •