Changes between Version 3 and Version 4 of LogParser


Ignore:
Timestamp:
Jul 4, 2008, 4:40:19 PM (16 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LogParser

    v3 v4  
    1212
    1313 * 3. you should filter the exception contents manually,
    14 {{{ ex:  ::1 - - [29/Jun/2008:07:35:15 +0800] "GET / HTTP/1.0" 200 729 "...
    15   }}}
     14{{{
     15ex:  ::1 - - [29/Jun/2008:07:35:15 +0800] "GET / HTTP/1.0" 200 729 "...
    1616}}}
    1717= 結果 =
     
    8181import java.util.regex.Pattern;
    8282
    83 
    84 
    85 
    8683public class LogParser {
    8784
     
    104101  private long timestamp;
    105102
    106 
    107103  private static Pattern p = Pattern
    108104
     
    111107                  " ([^ ]*) ([^ ]*) \"([^\"]*)\" \"([^\"]*)\".*");
    112108
    113   public LogParser(String line) throws ParseException, Exception{
     109  public LogParser(String line) throws ParseException, Exception{ 
    114110
    115111         Matcher matcher = p.matcher(line);
     
    147143         }
    148144
    149 
    150 
    151   }
    152 
     145  }
    153146
    154147  public static boolean isIpAddress(String inputString) {
     
    194187  }
    195188
    196 
    197 
    198189  public String getIp() {
    199190
     
    202193  }
    203194
    204 
    205 
    206195  public String getProtocol() {
    207196
     
    210199  }
    211200
    212 
    213 
    214201  public String getMethod() {
    215202
     
    218205  }
    219206
    220 
    221 
    222207  public String getUrl() {
    223208
     
    226211  }
    227212
    228 
    229 
    230213  public String getCode() {
    231214
     
    234217  }
    235218
    236 
    237 
    238219  public String getByteSize() {
    239220
     
    242223  }
    243224
    244 
    245 
    246225  public String getReferrer() {
    247226
     
    250229  }
    251230
    252 
    253 
    254231  public String getAgent() {
    255232
     
    258235  }
    259236
    260 
    261 
    262237  public long getTimestamp() {
    263238