Skip to content

Commit

Permalink
Fixes #5 #7 Partial and aborted downloads will now be recorded
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Carenton committed Aug 13, 2015
1 parent 9dc1e22 commit e9af67f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/java/main/esg/node/filters/AccessLoggingFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public void doFilter(ServletRequest request,
long startTime = -1;
long dataSize = -1;
long byteCount = -1;
boolean success = false;
boolean success = true;

public void setRecordID(int id) { this.myID = id; }
public void setStartTime(long startTime) { this.startTime = startTime; }
Expand All @@ -407,7 +407,6 @@ public void setByteCount(long xferSize) {
System.out.println("**** setByteCount("+xferSize+")");

if((AccessLoggingFilter.this.accessLoggingDAO != null) && (myID > 0)) {
if (dataSize == xferSize) { success = true; }
duration = System.currentTimeMillis() - startTime;
System.out.println("AccessLoggingFilter.this.accessLoggingDAO.logEgressInfo(myID: ["+myID+"], success: ["+success+"], duration: ["+duration+"]ms, dataSize ["+dataSize+"], xferSize: ["+xferSize+"] );");
AccessLoggingFilter.this.accessLoggingDAO.logEgressInfo(myID, success, duration, dataSize, xferSize);
Expand All @@ -420,10 +419,10 @@ public void setByteCount(long xferSize) {
byteCountListener.setStartTime(System.currentTimeMillis());
AccessLoggingResponseWrapper accessLoggingResponseWrapper = new AccessLoggingResponseWrapper((HttpServletResponse)response, byteCountListener);
chain.doFilter(request, accessLoggingResponseWrapper);
accessLoggingResponseWrapper.stream.close();
}catch(Throwable t) {
log.error(t);
HttpServletResponse resp = (HttpServletResponse)response;
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Caught unforseen Exception in ESG Access Logging Filter (url may not be resolvable to an exisiting file) "+t.getMessage());
}
}

Expand Down

0 comments on commit e9af67f

Please sign in to comment.