changeset 827:f89abbfb3a8f

remove Resource.getWeakETag()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 15 Sep 2016 16:21:56 -0600
parents 6ebf86e4d2ca
children 8579194add85
files src/org/eclipse/jetty/server/handler/ResourceHandler.java src/org/eclipse/jetty/util/resource/Resource.java
diffstat 2 files changed, 0 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Wed Sep 14 18:51:34 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Thu Sep 15 16:21:56 2016 -0600
@@ -69,7 +69,6 @@
 	ByteArrayBuffer _cacheControl;
 	boolean _aliases;
 	boolean _directory;
-	boolean _etags;
 
 	/* ------------------------------------------------------------ */
 	public ResourceHandler()
@@ -130,24 +129,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	/**
-	 * @return True if ETag processing is done
-	 */
-	public boolean isEtags()
-	{
-		return _etags;
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * @param etags True if ETag processing is done
-	 */
-	public void setEtags(boolean etags)
-	{
-		_etags = etags;
-	}
-
-	/* ------------------------------------------------------------ */
 	@Override
 	public void doStart()
 	throws Exception
@@ -438,21 +419,6 @@
 
 		// set some headers
 		long last_modified=resource.lastModified();
-		String etag=null;
-		if (_etags)
-		{
-			// simple handling of only a single etag
-			String ifnm = request.getHeader(HttpHeaders.IF_NONE_MATCH);
-			etag=resource.getWeakETag();
-			if (ifnm!=null && resource!=null && ifnm.equals(etag))
-			{
-				response.setStatus(HttpStatus.NOT_MODIFIED_304);
-				baseRequest.getResponse().getHttpFields().put(HttpHeaders.ETAG_BUFFER,etag);
-				return;
-			}
-		}
-		
-		
 		if (last_modified>0)
 		{
 			long if_modified=request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE);
@@ -470,8 +436,6 @@
 		// set the headers
 		doResponseHeaders(response,resource,mime!=null?mime.toString():null);
 		response.setDateHeader(HttpHeaders.LAST_MODIFIED,last_modified);
-		if (_etags)
-			baseRequest.getResponse().getHttpFields().put(HttpHeaders.ETAG_BUFFER,etag);
 		
 		if(skipContentBody)
 			return;
--- a/src/org/eclipse/jetty/util/resource/Resource.java	Wed Sep 14 18:51:34 2016 -0600
+++ b/src/org/eclipse/jetty/util/resource/Resource.java	Thu Sep 15 16:21:56 2016 -0600
@@ -31,7 +31,6 @@
 import java.util.Arrays;
 import java.util.Date;
 
-import java.util.Base64;
 import org.eclipse.jetty.util.IO;
 import org.eclipse.jetty.util.Loader;
 import org.eclipse.jetty.util.StringUtil;
@@ -641,24 +640,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	public String getWeakETag()
-	{
-		StringBuilder b = new StringBuilder(32);
-		b.append("W/\"");
-		
-		long lhash = lastModified() ^ getName().hashCode() ^ length();
-		byte[] a = new byte[Long.BYTES];
-		for( int i=0; i<a.length; i++ ) {
-			a[i] = (byte)lhash;
-			lhash >>= 8;
-		}
-		b.append( Base64.getEncoder().encodeToString(a) );
-
-		b.append('"');
-		return b.toString();
-	}
-	
-	/* ------------------------------------------------------------ */
 	/** Generate a properly encoded URL from a {@link File} instance.
 	 * @param file Target file. 
 	 * @return URL of the target file.