You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2007/12/12 06:59:22 UTC
svn commit: r603473 - in /incubator/abdera/java/trunk:
client/src/main/java/org/apache/abdera/protocol/client/
client/src/main/java/org/apache/abdera/protocol/client/cache/
client/src/main/java/org/apache/abdera/protocol/client/cache/lru/
client/src/ma...
Author: jmsnell
Date: Tue Dec 11 21:59:20 2007
New Revision: 603473
URL: http://svn.apache.org/viewvc?rev=603473&view=rev
Log:
A number of general code improvements and cleanups
Added:
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/AbstractCache.java
- copied, changed from r600708, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheBase.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCache.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCacheFactory.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/NonOpTrustManager.java
Removed:
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientException.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/Cache.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheBase.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheDisposition.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheException.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheFactory.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheKey.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CachedResponse.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CachedResponseBase.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/InMemoryCache.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/InMemoryCachedResponse.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUMap.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/SimpleCacheKey.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/lru/
Modified:
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbstractClientResponse.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientResponse.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/SimpleSSLProtocolSocketFactory.java
incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java
incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java
incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java
incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java
incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java
incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java Tue Dec 11 21:59:20 2007
@@ -35,10 +35,10 @@
import org.apache.abdera.protocol.EntityProvider;
import org.apache.abdera.protocol.Response.ResponseType;
import org.apache.abdera.protocol.client.cache.Cache;
-import org.apache.abdera.protocol.client.cache.CacheDisposition;
import org.apache.abdera.protocol.client.cache.CacheFactory;
import org.apache.abdera.protocol.client.cache.CachedResponse;
-import org.apache.abdera.protocol.client.cache.lru.LRUCache;
+import org.apache.abdera.protocol.client.cache.LRUCache;
+import org.apache.abdera.protocol.client.cache.Cache.Disposition;
import org.apache.abdera.protocol.client.util.BaseRequestEntity;
import org.apache.abdera.protocol.client.util.EntityProviderRequestEntity;
import org.apache.abdera.protocol.client.util.MethodHelper;
@@ -116,7 +116,7 @@
CacheFactory cacheFactory =
(CacheFactory)ServiceUtil.newInstance(
"org.apache.abdera.protocol.cache.CacheFactory",
- "org.apache.abdera.protocol.cache.lru.LRUCacheFactory",
+ "org.apache.abdera.protocol.cache.LRUCacheFactory",
abdera);
return cacheFactory;
}
@@ -342,16 +342,6 @@
(ProtocolSocketFactory)factory, port));
}
- private static void registerFactory(
- SimpleSSLProtocolSocketFactory factory,
- int port) {
- Protocol.registerProtocol(
- "https",
- new Protocol(
- "https",
- (ProtocolSocketFactory)factory, port));
- }
-
/**
* Configure the client to use preemptive authentication (HTTP Basic Authentication only)
*/
@@ -386,8 +376,11 @@
String uri,
Base base,
RequestOptions options) {
- RequestEntity re = new BaseRequestEntity(base);
- return execute(method,uri,re,options);
+ return execute(
+ method,
+ uri,
+ new BaseRequestEntity(base),
+ options);
}
public ClientResponse execute(
@@ -409,18 +402,18 @@
return execute(method,uri,re,options);
}
- private CacheDisposition getCacheDisposition(
+ private Disposition getCacheDisposition(
boolean usecache,
String uri,
RequestOptions options,
CachedResponse cached_response) {
- CacheDisposition disp =
+ Disposition disp =
(usecache) ?
- cache.getDisposition(uri, options) :
- CacheDisposition.TRANSPARENT;
- disp = (!disp.equals(CacheDisposition.TRANSPARENT) &&
+ cache.disposition(uri, options) :
+ Disposition.TRANSPARENT;
+ disp = (!disp.equals(Disposition.TRANSPARENT) &&
mustRevalidate(options, cached_response)) ?
- CacheDisposition.STALE :
+ Disposition.STALE :
disp;
return disp;
}
@@ -434,15 +427,17 @@
options = options != null ? options : getDefaultRequestOptions();
try {
Cache cache = getCache();
- CachedResponse cached_response = cache.get(uri, options);
- CacheDisposition disp = getCacheDisposition(
- usecache, uri, options, cached_response);
- switch(disp) {
+ CachedResponse cached_response = cache.get(uri);
+ switch(
+ getCacheDisposition(
+ usecache,
+ uri,
+ options,
+ cached_response)) {
case FRESH: // CACHE HIT: FRESH
- if (cached_response != null) {
- checkRequestException(cached_response,options);
- return cached_response;
- }
+ if (cached_response != null)
+ return checkRequestException(
+ cached_response,options);
case STALE: // CACHE HIT: STALE
// revalidate the cached entry
if (cached_response != null) {
@@ -451,8 +446,6 @@
else if (cached_response.getLastModified() != null)
options.setIfModifiedSince(cached_response.getLastModified());
else options.setNoCache(true);
- } else {
- disp = CacheDisposition.TRANSPARENT;
}
default: // CACHE MISS
HttpMethod httpMethod =
@@ -465,21 +458,21 @@
cached_response != null) return cached_response;
ClientResponse response = new CommonsResponse(abdera,httpMethod);
response = options.getUseLocalCache() ?
- response = cache.update(options, response, cached_response) :
+ response = cache.update(uri, options, response, cached_response) :
response;
- checkRequestException(response,options);
- return response;
+ return checkRequestException(response,options);
}
+ } catch (RuntimeException r) {
+ throw r;
} catch (Throwable t) {
- if (t instanceof ClientException) throw (ClientException)t;
- throw new ClientException(t);
+ throw new RuntimeException(t);
}
}
- private void checkRequestException(
+ private ClientResponse checkRequestException(
ClientResponse response,
RequestOptions options) {
- if (response == null) return;
+ if (response == null) return response;
ResponseType type = response.getType();
if ((type.equals(ResponseType.CLIENT_ERROR) && options.is4xxRequestException()) ||
(type.equals(ResponseType.SERVER_ERROR) && options.is5xxRequestException())) {
@@ -506,6 +499,7 @@
throw new RuntimeException(e);
}
}
+ return response;
}
public RequestOptions getDefaultRequestOptions() {
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbstractClientResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbstractClientResponse.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbstractClientResponse.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbstractClientResponse.java Tue Dec 11 21:59:20 2007
@@ -35,6 +35,8 @@
import org.apache.abdera.protocol.util.AbstractResponse;
import org.apache.abdera.protocol.util.CacheControlUtil;
import org.apache.abdera.util.EntityTag;
+import org.apache.commons.httpclient.util.DateParseException;
+import org.apache.commons.httpclient.util.DateUtil;
public abstract class AbstractClientResponse
extends AbstractResponse
@@ -45,13 +47,18 @@
protected final Date now = new Date();
protected InputStream in = null;
- protected Date response_date = null;
+ protected Date response_date = null;
protected AbstractClientResponse(Abdera abdera) {
this.abdera = abdera;
this.parser = abdera.getParser();
}
+ protected Date initResponseDate() {
+ Date date = getDateHeader("Date");
+ return (date != null) ? date : now;
+ }
+
protected synchronized Parser getParser() {
return parser;
}
@@ -123,10 +130,8 @@
}
public Date getServerDate() {
- if (response_date == null) {
- Date date = getDateHeader("Date");
- response_date = (date != null) ? date : now;
- }
+ if (response_date == null)
+ response_date = initResponseDate();
return response_date;
}
@@ -145,4 +150,17 @@
return charset;
}
+ /**
+ * Return the named HTTP header as a java.util.Date
+ */
+ public Date getDateHeader(String header) {
+ try {
+ String value = getHeader(header);
+ if (value != null)
+ return DateUtil.parseDate(value);
+ else return null;
+ } catch (DateParseException e) {
+ throw new RuntimeException(e); // server likely returned a bad date format
+ }
+ }
}
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientResponse.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientResponse.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ClientResponse.java Tue Dec 11 21:59:20 2007
@@ -29,7 +29,8 @@
import org.apache.abdera.parser.ParserOptions;
import org.apache.abdera.protocol.Response;
-public interface ClientResponse extends Response {
+public interface ClientResponse
+ extends Response {
/**
* Return the request method
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java Tue Dec 11 21:59:20 2007
@@ -21,7 +21,6 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,8 +31,6 @@
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.URIException;
-import org.apache.commons.httpclient.util.DateParseException;
-import org.apache.commons.httpclient.util.DateUtil;
public class CommonsResponse
extends AbstractClientResponse
@@ -41,13 +38,15 @@
private final HttpMethod method;
- protected CommonsResponse(Abdera abdera, HttpMethod method) {
- super(abdera);
- if (method.isRequestSent())
- this.method = method;
- else throw new IllegalStateException();
- parse_cc();
- getServerDate();
+ protected CommonsResponse(
+ Abdera abdera,
+ HttpMethod method) {
+ super(abdera);
+ if (method.isRequestSent())
+ this.method = method;
+ else throw new IllegalStateException();
+ parse_cc();
+ getServerDate();
}
public HttpMethod getHttpMethod() {
@@ -155,22 +154,9 @@
in = method.getResponseBodyAsStream();
if (ce != null)
in = EncodingUtil.getDecodingInputStream(in, ce);
+ in = new AutoReleasingInputStream(method,in);
}
- return new AutoReleasingInputStream(method,in);
- }
-
- /**
- * Return the named HTTP header as a java.util.Date
- */
- public Date getDateHeader(String header) {
- try {
- String value = getHeader(header);
- if (value != null)
- return DateUtil.parseDate(value);
- else return null;
- } catch (DateParseException e) {
- throw new ClientException(e); // server likely returned a bad date format
- }
+ return in;
}
}
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Tue Dec 11 21:59:20 2007
@@ -92,7 +92,7 @@
}
private String combine(String ... values) {
- StringBuffer v = new StringBuffer();
+ StringBuilder v = new StringBuilder();
for (String val : values) {
if (v.length() > 0)
v.append(", ");
@@ -279,7 +279,7 @@
try {
return (val != null) ? DateUtil.parseDate(val) : null;
} catch (DateParseException e) {
- throw new ClientException(e);
+ throw new RuntimeException(e);
}
}
Copied: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/AbstractCache.java (from r600708, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheBase.java)
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/AbstractCache.java?p2=incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/AbstractCache.java&p1=incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheBase.java&r1=600708&r2=603473&rev=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/CacheBase.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/AbstractCache.java Tue Dec 11 21:59:20 2007
@@ -24,114 +24,67 @@
import org.apache.abdera.protocol.client.RequestOptions;
import org.apache.abdera.protocol.util.CacheControlUtil;
-public abstract class CacheBase
+public abstract class AbstractCache
implements Cache {
protected final Abdera abdera;
- protected CacheBase(Abdera abdera) {
+ protected AbstractCache(Abdera abdera) {
this.abdera = abdera;
}
- public CachedResponse get(String uri, RequestOptions options) {
- return get(getCacheKey(uri,options));
- }
-
- public CacheDisposition getDisposition(
- String uri,
+ public Disposition disposition(
+ Object key,
RequestOptions options) {
- CacheKey key = getCacheKey(uri, options);
CachedResponse response = get(key);
if (response != null && options != null) {
- Object[] pragma = options.getHeaders("Pragma");
- if (pragma != null) {
- for (Object o: pragma) {
- String s = (String)o;
- if (s.equalsIgnoreCase("no-cache")) {
- return CacheDisposition.TRANSPARENT;
- }
- }
- }
if (options.isNoCache())
- return CacheDisposition.TRANSPARENT;
+ return Disposition.TRANSPARENT;
else if (response.isNoCache())
- return CacheDisposition.STALE;
+ return Disposition.STALE;
else if (options != null && options.isOnlyIfCached())
- return CacheDisposition.FRESH;
+ return Disposition.FRESH;
else if (response.isMustRevalidate())
- return CacheDisposition.STALE;
+ return Disposition.STALE;
else if (response.getCachedTime() != -1) {
if (response.isFresh()) {
long maxAge = options.getMaxAge();
long currentAge = response.getCurrentAge();
- if (maxAge != -1) {
- return (maxAge > currentAge) ?
- CacheDisposition.FRESH:
- CacheDisposition.STALE;
- }
long minFresh = options.getMinFresh();
- if (minFresh != -1) {
- long lifetime = response.getFreshnessLifetime();
- long age = currentAge;
- return (lifetime < age + minFresh) ?
- CacheDisposition.TRANSPARENT :
- CacheDisposition.FRESH;
- }
- return CacheDisposition.FRESH;
+ if (maxAge != -1)
+ return (maxAge > currentAge) ?
+ Disposition.FRESH:
+ Disposition.STALE;
+ if (minFresh != -1)
+ return response.getFreshnessLifetime() < currentAge + minFresh ?
+ Disposition.TRANSPARENT :
+ Disposition.FRESH;
+ return Disposition.FRESH;
} else {
long maxStale = options.getMaxStale();
- if (maxStale != -1) {
- long howStale = response.getHowStale();
- return (maxStale < howStale) ?
- CacheDisposition.STALE :
- CacheDisposition.FRESH;
- }
- return CacheDisposition.STALE;
+ if (maxStale != -1)
+ return maxStale < response.getHowStale() ?
+ Disposition.STALE :
+ Disposition.FRESH;
+ return Disposition.STALE;
}
}
}
- return CacheDisposition.TRANSPARENT;
-
- }
-
- public void remove(String uri, RequestOptions options) {
- remove(getCacheKey(uri,options));
+ return Disposition.TRANSPARENT;
}
protected abstract void add(
- CacheKey key,
+ Object key,
CachedResponse response);
protected abstract CachedResponse createCachedResponse(
- ClientResponse response, CacheKey key) throws IOException;
+ ClientResponse response,
+ Object key)
+ throws IOException;
- protected abstract CacheKey getCacheKey(
- String uri,
- RequestOptions options,
- ClientResponse response);
-
- public CachedResponse getIfFreshEnough(
- String uri,
- RequestOptions options) {
- CacheKey key = getCacheKey(uri,options);
- CachedResponse response = get(key);
- if (!response.isFresh()) {
- // if the milk is only slightly sour, we'll still go ahead and take a drink
- long max_stale = (options != null) ? options.getMaxStale() : -1;
- if (max_stale != -1 && response.getHowStale() > max_stale)
- return null;
- } else {
- long min_fresh = (options != null) ? options.getMinFresh() : -1;
- if (min_fresh != -1 && response.getCurrentAge() < min_fresh)
- return null;
- }
- return response;
- }
-
private boolean shouldUpdateCache(
ClientResponse response,
- boolean allowedByDefault) {
- // TODO: we should probably include pragma: no-cache headers in here
+ boolean allowedByDefault) {
if (allowedByDefault) {
return !response.isNoCache() &&
!response.isNoStore() &&
@@ -146,6 +99,7 @@
}
public ClientResponse update(
+ Object key,
RequestOptions options,
ClientResponse response,
ClientResponse cached_response) {
@@ -155,7 +109,7 @@
// if the method changes state on the server, don't cache and
// clear what we already have
if (!CacheControlUtil.isIdempotent(method)) {
- remove(uri,options);
+ remove(uri);
return response;
}
// otherwise, base the decision on the response status code
@@ -163,8 +117,8 @@
case 200: case 203: case 300: case 301: case 410:
// rfc2616 says these are cacheable unless otherwise noted
if (shouldUpdateCache(response,true))
- return update(options, response);
- else remove(uri, options);
+ return update(key, options, response);
+ else remove(uri);
break;
case 304: case 412:
// if not revalidated, fall through
@@ -173,24 +127,24 @@
default:
// rfc2616 says are *not* cacheable unless otherwise noted
if (shouldUpdateCache(response,false))
- return update(options, response);
- else remove(uri, options);
+ return update(key, options, response);
+ else remove(uri);
break;
}
return response;
}
private ClientResponse update(
+ Object key,
RequestOptions options,
ClientResponse response) {
- String uri = response.getUri();
- CacheKey key = getCacheKey(uri, options,response);
try {
- CachedResponse cachedResponse = createCachedResponse(response, key);
+ CachedResponse cachedResponse =
+ createCachedResponse(response, key);
add(key, cachedResponse);
return cachedResponse;
} catch (IOException e) {
- throw new CacheException(e);
+ throw new RuntimeException(e);
}
}
Added: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCache.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCache.java?rev=603473&view=auto
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCache.java (added)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCache.java Tue Dec 11 21:59:20 2007
@@ -0,0 +1,40 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.client.cache;
+
+import org.apache.abdera.Abdera;
+
+@SuppressWarnings("serial")
+public class LRUCache
+ extends InMemoryCache
+ implements Cache {
+
+ private final static int DEFAULT_SIZE = 10;
+
+ public LRUCache(Abdera abdera) {
+ this(abdera,DEFAULT_SIZE);
+ }
+
+ public LRUCache(Abdera abdera, final int size) {
+ super(
+ abdera,
+ new LRUMap<Object,CachedResponse>(
+ size,0.75f));
+ }
+
+}
Added: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCacheFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCacheFactory.java?rev=603473&view=auto
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCacheFactory.java (added)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/cache/LRUCacheFactory.java Tue Dec 11 21:59:20 2007
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.client.cache;
+
+import org.apache.abdera.Abdera;
+
+public class LRUCacheFactory
+ implements CacheFactory {
+
+ public Cache getCache(Abdera abdera) {
+ return new LRUCache(abdera);
+ }
+
+}
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java Tue Dec 11 21:59:20 2007
@@ -23,15 +23,12 @@
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyStore;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
import org.apache.abdera.util.Messages;
import org.apache.commons.httpclient.ConnectTimeoutException;
@@ -41,15 +38,19 @@
public class ClientAuthSSLProtocolSocketFactory
implements SecureProtocolSocketFactory {
- private String protocol = "TLS";
- private String kmfFactory = "ibmX509";
- private TrustManager tm = null;
+ private static final String DEFAULT_PROTOCOL = "TLS";
+ private static final String DEFAULT_KMF_FACTORY = "ibmX509";
+ private final String protocol;
+ private final String kmfFactory;
+ private final TrustManager tm;
private final String keyStorePass;
private final KeyStore ks;
- public ClientAuthSSLProtocolSocketFactory(KeyStore ks, String keyStorePass) {
- this(ks,keyStorePass,"TLS","ibmX509",null);
+ public ClientAuthSSLProtocolSocketFactory(
+ KeyStore ks,
+ String keyStorePass) {
+ this(ks,keyStorePass,DEFAULT_PROTOCOL,DEFAULT_KMF_FACTORY,null);
}
public ClientAuthSSLProtocolSocketFactory(
@@ -61,9 +62,9 @@
if (ks == null) throw new IllegalArgumentException(Messages.get("INVALID.KEYSTORE"));
this.ks = ks;
this.keyStorePass = keyStorePass;
- if (protocol != null) this.protocol = protocol;
- if (kmfFactory != null) this.kmfFactory = kmfFactory;
- if (tm != null) this.tm = tm;
+ this.protocol = protocol != null ? protocol : DEFAULT_PROTOCOL;
+ this.kmfFactory = kmfFactory != null ? kmfFactory : DEFAULT_KMF_FACTORY;
+ this.tm = tm;
}
public ClientAuthSSLProtocolSocketFactory(
@@ -135,30 +136,16 @@
SSLSocket socket = null;
try {
KeyManagerFactory kmf;
-
context = SSLContext.getInstance(protocol);
kmf = KeyManagerFactory.getInstance(kmfFactory);
-
- TrustManager tm = (this.tm != null) ? this.tm : new X509TrustManager() {
- public void checkClientTrusted(X509Certificate[] arg0, String arg1)
- throws CertificateException {}
- public void checkServerTrusted(X509Certificate[] arg0, String arg1)
- throws CertificateException {}
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- };
-
+ TrustManager tm = (this.tm != null) ? this.tm : new NonOpTrustManager();
kmf.init(ks, keyStorePass.toCharArray());
- context.init(kmf.getKeyManagers(), new TrustManager[] {tm}, null);
-
+ context.init(kmf.getKeyManagers(), new TrustManager[] {tm}, null);
factory = context.getSocketFactory();
-
socket = (SSLSocket) factory.createSocket(host, port);
return socket;
} catch (Exception e) {
- e.printStackTrace();
+ throw new RuntimeException(e);
}
- return null;
}
}
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java Tue Dec 11 21:59:20 2007
@@ -156,7 +156,8 @@
HttpMethodParams.USE_EXPECT_CONTINUE, false);
// should we follow redirects, default is true
- httpMethod.setFollowRedirects(options.isFollowRedirects());
+ if (!(httpMethod instanceof EntityEnclosingMethod))
+ httpMethod.setFollowRedirects(options.isFollowRedirects());
return httpMethod;
}
Added: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/NonOpTrustManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/NonOpTrustManager.java?rev=603473&view=auto
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/NonOpTrustManager.java (added)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/NonOpTrustManager.java Tue Dec 11 21:59:20 2007
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.client.util;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.X509TrustManager;
+
+public class NonOpTrustManager
+ implements X509TrustManager {
+
+ public void checkClientTrusted(
+ X509Certificate[] arg0,
+ String arg1)
+ throws CertificateException {}
+
+ public void checkServerTrusted(
+ X509Certificate[] arg0,
+ String arg1)
+ throws CertificateException {}
+
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+}
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/SimpleSSLProtocolSocketFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/SimpleSSLProtocolSocketFactory.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/SimpleSSLProtocolSocketFactory.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/SimpleSSLProtocolSocketFactory.java Tue Dec 11 21:59:20 2007
@@ -21,12 +21,9 @@
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.params.HttpConnectionParams;
@@ -37,21 +34,13 @@
private SSLContext context = null;
- public SimpleSSLProtocolSocketFactory(TrustManager trustManager) {
- init(trustManager);
+ public SimpleSSLProtocolSocketFactory(
+ TrustManager trustManager) {
+ init(trustManager);
}
public SimpleSSLProtocolSocketFactory() {
- try {
- TrustManager tm = new X509TrustManager() {
- public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
- public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- };
- init(tm);
- } catch (Exception e) {}
+ this(new NonOpTrustManager());
}
private void init(TrustManager trustManager) {
Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java Tue Dec 11 21:59:20 2007
@@ -137,7 +137,7 @@
}
public String toString() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (wild) {
buf.append("*");
} else {
@@ -212,7 +212,7 @@
}
public static String toString(EntityTag... tags) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (EntityTag tag : tags) {
if (buf.length() > 0) buf.append(", ");
buf.append(tag.toString());
@@ -221,7 +221,7 @@
}
public static String toString(String ... tags) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (String tag : tags) {
if (buf.length() > 0) buf.append(", ");
EntityTag etag = new EntityTag(tag);
Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java Tue Dec 11 21:59:20 2007
@@ -248,7 +248,7 @@
}
private static String supplementaryToString(int c) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append((char)getHighSurrogate(c));
buf.append((char)getLowSurrogate(c));
return buf.toString();
Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java Tue Dec 11 21:59:20 2007
@@ -109,7 +109,7 @@
public Div setXhtmlClass(String[] classes) {
complete();
if (classes != null) {
- StringBuffer val = new StringBuffer();
+ StringBuilder val = new StringBuilder();
for (String s : classes) {
if (s.length() > 0)
val.append(" ");
Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Tue Dec 11 21:59:20 2007
@@ -526,7 +526,7 @@
}
public String getText() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
Iterator i = getChildren();
while (i.hasNext()) {
OMNode node = (OMNode) i.next();
Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java Tue Dec 11 21:59:20 2007
@@ -84,7 +84,17 @@
}
public boolean isNoCache() {
- return check(NOCACHE);
+ if (check(NOCACHE)) return true;
+ Object[] pragma = getHeaders("Pragma");
+ if (pragma != null) {
+ for (Object o: pragma) {
+ String s = (String)o;
+ if (s.equalsIgnoreCase("no-cache")) {
+ return true;
+ }
+ }
+ }
+ return false;
}
public boolean isNoStore() {
Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java Tue Dec 11 21:59:20 2007
@@ -28,20 +28,25 @@
*/
public class CacheControlUtil {
+ private static enum Idempotent { GET, HEAD, OPTIONS }
+
/**
* Idempotent methods are handled differently in caches than other methods
*/
public static boolean isIdempotent(String method) {
- return (method.equalsIgnoreCase("GET") ||
- method.equalsIgnoreCase("HEAD") ||
- method.equalsIgnoreCase("OPTIONS"));
+ try {
+ Idempotent.valueOf(method.toUpperCase());
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
}
private static long value(String val) {
return (val != null) ? Long.parseLong(val) : -1;
}
- private static void append(StringBuffer buf, String value) {
+ private static void append(StringBuilder buf, String value) {
if (buf.length() > 0) buf.append(", ");
buf.append(value);
}
@@ -50,7 +55,7 @@
* Construct the Cache-Control header from info in the request object
*/
public static String buildCacheControl(AbstractRequest request) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (request.isNoCache()) append(buf,"no-cache");
if (request.isNoStore()) append(buf,"no-store");
if (request.isNoTransform()) append(buf, "no-transform");
Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java Tue Dec 11 21:59:20 2007
@@ -92,7 +92,7 @@
}
public String getRequestString() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("DH ");
buf.append("p=");
buf.append(p.toString());
@@ -106,7 +106,7 @@
}
public String getResponseString() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("DH ");
buf.append("k=");
buf.append(Base64.encode(keyPair.getPublic().getEncoded()));
Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java Tue Dec 11 21:59:20 2007
@@ -134,7 +134,7 @@
}
protected String combine(String... vals) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for(String val : vals) {
if (buf.length() > 0) buf.append(", ");
buf.append(val);
Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java Tue Dec 11 21:59:20 2007
@@ -150,13 +150,13 @@
return headers.keySet().toArray(new String[headers.size()]);
}
- private void append(StringBuffer buf, String value) {
+ private void append(StringBuilder buf, String value) {
if (buf.length() > 0) buf.append(", ");
buf.append(value);
}
public String getCacheControl() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (isPublic()) append(buf,"public");
if (isPrivate()) append(buf,"private");
if (private_headers != null && private_headers.length > 0) {
@@ -287,7 +287,7 @@
}
public ResponseContext setAllow(String... methods) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for(String method : methods) {
if (buf.length() > 0) buf.append(", ");
buf.append(method);
Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java Tue Dec 11 21:59:20 2007
@@ -193,7 +193,7 @@
}
protected String combine(String... vals) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for(String val : vals) {
if (buf.length() > 0) buf.append(", ");
buf.append(val);
Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java?rev=603473&r1=603472&r2=603473&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java Tue Dec 11 21:59:20 2007
@@ -205,8 +205,8 @@
private static IRI initBaseUri(
ServiceContext context,
HttpServletRequest request) {
- StringBuffer buffer =
- new StringBuffer(
+ StringBuilder buffer =
+ new StringBuilder(
(request.isSecure())?
"https":"http");
buffer.append("://");
@@ -224,8 +224,8 @@
private static IRI initRequestUri(HttpServletRequest request) {
IRI uri = null;
- StringBuffer buf =
- new StringBuffer(
+ StringBuilder buf =
+ new StringBuilder(
request.getRequestURI());
String qs = request.getQueryString();
if (qs != null && qs.length() != 0)