You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/11/06 09:54:18 UTC
svn commit: r592334 - in /mina/sandbox/asyncweb:
core/src/main/java/org/safehaus/asyncweb/codec/
core/src/main/java/org/safehaus/asyncweb/codec/decoder/
core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/
core/src/main/java/org/safehaus/asy...
Author: trustin
Date: Tue Nov 6 00:54:15 2007
New Revision: 592334
URL: http://svn.apache.org/viewvc?rev=592334&view=rev
Log:
Fixed all compilation errors and warnings against mina-trunk
Modified:
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/HttpCodecUtils.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/CRLFDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/ChunkedBodyDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpHeaderDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestLineDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToCRLFDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToDynamicTerminatorDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToTerminatorDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingStateMachine.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/FixedLengthDecodingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/SkippingState.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/StateMachineProtocolDecoder.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CompatibilityCookieEncoder.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CookieEncoder.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/OneShotHttpResponseEncoder.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/common/content/ByteBufferContent.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/BasicServiceContainer.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/HttpServiceHandler.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/CSS.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/StandardResponseFormatter.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/CompositeResolver.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/ExactMatchURIServiceResolver.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/session/BasicSessionStore.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/transport/mina/MinaTransport.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/HttpDateFormat.java
mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/LinkedPermitIssuer.java
mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/cookie/CookieExample.java
mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/helloworld/HelloWorldHttpService.java
mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/HttpProtocolHandler.java
mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/Main.java
mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/session/SessionExample.java
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/HttpCodecUtils.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/HttpCodecUtils.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/HttpCodecUtils.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/HttpCodecUtils.java Tue Nov 6 00:54:15 2007
@@ -21,7 +21,7 @@
import java.io.UnsupportedEncodingException;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderException;
import org.safehaus.asyncweb.codec.decoder.HttpDecoderException;
import org.safehaus.asyncweb.common.HttpResponseStatus;
@@ -208,7 +208,7 @@
*
* @param buffer The buffer to "push back" to
*/
- public static void pushBack(ByteBuffer buffer) {
+ public static void pushBack(IoBuffer buffer) {
buffer.position(buffer.position() - 1);
}
@@ -266,7 +266,7 @@
}
/**
- * Appends a string to a specified {@link ByteBuffer}.
+ * Appends a string to a specified {@link IoBuffer}.
* This method assumes ascii encoding and is primarily used for encoding
* http header names and values.<br/>
* Note that encoding header values this way is not stricly correct
@@ -277,7 +277,7 @@
* @param buffer The buffer to append to
* @param string The string to append
*/
- public static void appendString(ByteBuffer buffer, String string) {
+ public static void appendString(IoBuffer buffer, String string) {
if (string == null) {
return;
}
@@ -297,7 +297,7 @@
*
* @param buffer The buffer
*/
- public static void appendCRLF(ByteBuffer buffer) {
+ public static void appendCRLF(IoBuffer buffer) {
buffer.put(CRLF_BYTES);
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/CRLFDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/CRLFDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/CRLFDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/CRLFDecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.safehaus.asyncweb.codec.HttpCodecUtils;
import org.safehaus.asyncweb.codec.decoder.support.DecodingState;
@@ -42,7 +42,7 @@
private boolean hasCR;
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
boolean found = false;
boolean finished = false;
while (in.hasRemaining()) {
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/ChunkedBodyDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/ChunkedBodyDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/ChunkedBodyDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/ChunkedBodyDecodingState.java Tue Nov 6 00:54:15 2007
@@ -22,7 +22,7 @@
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.safehaus.asyncweb.codec.HttpCodecUtils;
import org.safehaus.asyncweb.codec.decoder.support.ConsumeToDynamicTerminatorDecodingState;
@@ -92,7 +92,7 @@
private final DecodingState READ_CHUNK_LENGTH = new ConsumeToDynamicTerminatorDecodingState() {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
if (!product.hasRemaining()) {
HttpCodecUtils.throwDecoderException("Expected a chunk length.");
}
@@ -102,7 +102,7 @@
if (chunkHasExtension) {
return SKIP_CHUNK_EXTENSION;
}
- return AFTER_SKIP_CHUNK_EXTENSION.decode( ByteBuffer.wrap( new byte[] { HttpCodecUtils.CR } ), out );
+ return AFTER_SKIP_CHUNK_EXTENSION.decode( IoBuffer.wrap( new byte[] { HttpCodecUtils.CR } ), out );
}
@Override
@@ -144,7 +144,7 @@
} else {
return new FixedLengthDecodingState(lastChunkLength) {
@Override
- protected DecodingState finishDecode(ByteBuffer readData, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer readData, ProtocolDecoderOutput out) throws Exception {
out.write(readData);
// Reset the state.
lastChunkLength = 0;
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpHeaderDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpHeaderDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpHeaderDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpHeaderDecodingState.java Tue Nov 6 00:54:15 2007
@@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.safehaus.asyncweb.codec.decoder.support.ConsumeToCRLFDecodingState;
import org.safehaus.asyncweb.codec.decoder.support.ConsumeToTerminatorDecodingState;
@@ -84,7 +84,7 @@
private final DecodingState READ_HEADER_NAME = new ConsumeToTerminatorDecodingState((byte) ':') {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
lastHeaderName = product.getString(asciiDecoder);
return AFTER_READ_HEADER_NAME;
}
@@ -100,7 +100,7 @@
private final DecodingState READ_HEADER_VALUE = new ConsumeToCRLFDecodingState() {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
String value = product.getString(utf8Decoder);
if (lastHeaderValue.length() == 0) {
lastHeaderValue.append(value);
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestDecodingState.java Tue Nov 6 00:54:15 2007
@@ -23,7 +23,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderException;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.safehaus.asyncweb.codec.HttpCodecUtils;
@@ -33,9 +33,9 @@
import org.safehaus.asyncweb.common.DefaultHttpRequest;
import org.safehaus.asyncweb.common.HttpMethod;
import org.safehaus.asyncweb.common.HttpRequest;
+import org.safehaus.asyncweb.common.HttpResponseStatus;
import org.safehaus.asyncweb.common.HttpVersion;
import org.safehaus.asyncweb.common.MutableHttpRequest;
-import org.safehaus.asyncweb.common.HttpResponseStatus;
import org.safehaus.asyncweb.common.content.ByteBufferContent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -174,19 +174,19 @@
if (childProducts.size() != 1) {
int chunkSize = 0;
for (Object product: childProducts) {
- ByteBuffer chunk = (ByteBuffer) product;
+ IoBuffer chunk = (IoBuffer) product;
chunkSize += chunk.remaining();
}
- ByteBuffer body = ByteBuffer.allocate(chunkSize);
+ IoBuffer body = IoBuffer.allocate(chunkSize);
for (Object product: childProducts) {
- ByteBuffer chunk = (ByteBuffer) product;
+ IoBuffer chunk = (IoBuffer) product;
body.put(chunk);
}
body.flip();
request.setContent(new ByteBufferContent(body));
} else {
- request.setContent(new ByteBufferContent((ByteBuffer) childProducts.get(0)));
+ request.setContent(new ByteBufferContent((IoBuffer) childProducts.get(0)));
}
out.write(request);
@@ -201,7 +201,7 @@
}
nextState = new FixedLengthDecodingState(length) {
@Override
- protected DecodingState finishDecode(ByteBuffer readData, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer readData, ProtocolDecoderOutput out) throws Exception {
request.setContent(new ByteBufferContent(readData));
out.write(request);
return null;
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestLineDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestLineDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestLineDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/HttpRequestLineDecodingState.java Tue Nov 6 00:54:15 2007
@@ -23,7 +23,7 @@
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.safehaus.asyncweb.codec.HttpCodecUtils;
import org.safehaus.asyncweb.codec.decoder.support.ConsumeToDynamicTerminatorDecodingState;
@@ -64,7 +64,7 @@
private final DecodingState READ_METHOD = new ConsumeToLinearWhitespaceDecodingState() {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
HttpMethod method = HttpMethod.valueOf(product.getString(asciiDecoder));
if (method == null) {
@@ -87,7 +87,7 @@
private final DecodingState READ_REQUEST_URI = new ConsumeToLinearWhitespaceDecodingState() {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
out.write(new URI(product.getString(utf8Decoder)));
return AFTER_READ_REQUEST_URI;
}
@@ -102,7 +102,7 @@
private final DecodingState READ_PROTOCOL_VERSION = new ConsumeToDynamicTerminatorDecodingState() {
@Override
- protected DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception {
+ protected DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception {
String versionStr = product.getString(asciiDecoder);
HttpVersion version = HttpVersion.valueOf(versionStr);
if (version == null) {
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToCRLFDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToCRLFDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToCRLFDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToCRLFDecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -40,7 +40,7 @@
private static final byte LF = 10;
private boolean lastIsCR;
- private ByteBuffer buffer;
+ private IoBuffer buffer;
/**
@@ -49,7 +49,7 @@
public ConsumeToCRLFDecodingState() {
}
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
int beginPos = in.position();
int limit = in.limit();
int terminatorPos = -1;
@@ -68,7 +68,7 @@
}
if (terminatorPos >= 0) {
- ByteBuffer product;
+ IoBuffer product;
int endPos = terminatorPos - 1;
@@ -87,7 +87,7 @@
} else {
// When input contained only CR or LF rather than actual data...
if (buffer == null) {
- product = ByteBuffer.allocate(1);
+ product = IoBuffer.allocate(1);
product.limit(0);
} else {
product = buffer.flip();
@@ -99,7 +99,7 @@
} else {
in.position(beginPos);
if (buffer == null) {
- buffer = ByteBuffer.allocate(in.remaining());
+ buffer = IoBuffer.allocate(in.remaining());
buffer.setAutoExpand(true);
}
@@ -111,5 +111,5 @@
}
}
- protected abstract DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception;
+ protected abstract DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception;
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToDynamicTerminatorDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToDynamicTerminatorDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToDynamicTerminatorDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToDynamicTerminatorDecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -33,7 +33,7 @@
*/
public abstract class ConsumeToDynamicTerminatorDecodingState implements DecodingState {
- private ByteBuffer buffer;
+ private IoBuffer buffer;
/**
* Creates a new instance.
@@ -41,7 +41,7 @@
public ConsumeToDynamicTerminatorDecodingState() {
}
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
int beginPos = in.position();
int terminatorPos = -1;
int limit = in.limit();
@@ -55,7 +55,7 @@
}
if (terminatorPos >= 0) {
- ByteBuffer product;
+ IoBuffer product;
if (beginPos < terminatorPos) {
in.limit(terminatorPos);
@@ -72,7 +72,7 @@
} else {
// When input contained only terminator rather than actual data...
if (buffer == null) {
- product = ByteBuffer.allocate(1);
+ product = IoBuffer.allocate(1);
product.limit(0);
} else {
product = buffer.flip();
@@ -83,7 +83,7 @@
return finishDecode(product, out);
} else {
if (buffer == null) {
- buffer = ByteBuffer.allocate(in.remaining());
+ buffer = IoBuffer.allocate(in.remaining());
buffer.setAutoExpand(true);
}
buffer.put(in);
@@ -93,5 +93,5 @@
protected abstract boolean isTerminator(byte b);
- protected abstract DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception;
+ protected abstract DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception;
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToTerminatorDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToTerminatorDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToTerminatorDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/ConsumeToTerminatorDecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -34,7 +34,7 @@
public abstract class ConsumeToTerminatorDecodingState implements DecodingState {
private final byte terminator;
- private ByteBuffer buffer;
+ private IoBuffer buffer;
/**
* @param terminator The terminator character
@@ -43,12 +43,12 @@
this.terminator = terminator;
}
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
int terminatorPos = in.indexOf(terminator);
if (terminatorPos >= 0) {
int limit = in.limit();
- ByteBuffer product;
+ IoBuffer product;
if (in.position() < terminatorPos) {
in.limit(terminatorPos);
@@ -65,7 +65,7 @@
} else {
// When input contained only terminator rather than actual data...
if (buffer == null) {
- product = ByteBuffer.allocate(1);
+ product = IoBuffer.allocate(1);
product.limit(0);
} else {
product = buffer.flip();
@@ -76,7 +76,7 @@
return finishDecode(product, out);
} else {
if (buffer == null) {
- buffer = ByteBuffer.allocate(in.remaining());
+ buffer = IoBuffer.allocate(in.remaining());
buffer.setAutoExpand(true);
}
buffer.put(in);
@@ -84,5 +84,5 @@
}
}
- protected abstract DecodingState finishDecode(ByteBuffer product, ProtocolDecoderOutput out) throws Exception;
+ protected abstract DecodingState finishDecode(IoBuffer product, ProtocolDecoderOutput out) throws Exception;
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,10 +19,10 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
public interface DecodingState {
// TODO Find out the best way to provide init/destroy.
- DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception;
+ DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception;
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingStateMachine.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingStateMachine.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingStateMachine.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/DecodingStateMachine.java Tue Nov 6 00:54:15 2007
@@ -22,7 +22,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +45,7 @@
protected abstract DecodingState finishDecode(List<Object> childProducts, ProtocolDecoderOutput out) throws Exception;
protected abstract void destroy() throws Exception;
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
DecodingState state = this.currentState;
if (state == null) {
state = init();
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/FixedLengthDecodingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/FixedLengthDecodingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/FixedLengthDecodingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/FixedLengthDecodingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -34,7 +34,7 @@
public abstract class FixedLengthDecodingState implements DecodingState {
private final int length;
- private ByteBuffer buffer;
+ private IoBuffer buffer;
/**
* Constructs with a known decode length.
@@ -45,17 +45,17 @@
this.length = length;
}
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
if (buffer == null) {
if (in.remaining() >= length) {
int limit = in.limit();
in.limit(in.position() + length);
- ByteBuffer product = in.slice();
+ IoBuffer product = in.slice();
in.position(in.position() + length);
in.limit(limit);
return finishDecode(product, out);
} else {
- buffer = ByteBuffer.allocate(length);
+ buffer = IoBuffer.allocate(length);
buffer.put(in);
return this;
}
@@ -65,7 +65,7 @@
in.limit(in.position() + length - buffer.position());
buffer.put(in);
in.limit(limit);
- ByteBuffer product = this.buffer;
+ IoBuffer product = this.buffer;
this.buffer = null;
return finishDecode(product.flip(), out);
} else {
@@ -75,5 +75,5 @@
}
}
- protected abstract DecodingState finishDecode(ByteBuffer readData, ProtocolDecoderOutput out) throws Exception;
+ protected abstract DecodingState finishDecode(IoBuffer readData, ProtocolDecoderOutput out) throws Exception;
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/SkippingState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/SkippingState.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/SkippingState.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/SkippingState.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -39,7 +39,7 @@
public SkippingState() {
}
- public DecodingState decode(ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out) throws Exception {
int beginPos = in.position();
int limit = in.limit();
for (int i = beginPos; i < limit; i++) {
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/StateMachineProtocolDecoder.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/StateMachineProtocolDecoder.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/StateMachineProtocolDecoder.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/decoder/support/StateMachineProtocolDecoder.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.codec.decoder.support;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -36,7 +36,7 @@
this.stateMachine = stateMachine;
}
- public void decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
+ public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
DecodingState state = this.currentState;
if (state == null) {
state = stateMachine.init();
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CompatibilityCookieEncoder.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CompatibilityCookieEncoder.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CompatibilityCookieEncoder.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CompatibilityCookieEncoder.java Tue Nov 6 00:54:15 2007
@@ -19,13 +19,14 @@
*/
package org.safehaus.asyncweb.codec.encoder;
+import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.codec.HttpCodecUtils;
import org.safehaus.asyncweb.common.Cookie;
@@ -50,9 +51,9 @@
/**
* Thread-local DateFormat for old-style cookies
*/
- private static final ThreadLocal EXPIRY_FORMAT_LOACAL = new ThreadLocal() {
-
- protected Object initialValue() {
+ private static final ThreadLocal<DateFormat> EXPIRY_FORMAT_LOACAL = new ThreadLocal<DateFormat>() {
+ @Override
+ protected DateFormat initialValue() {
SimpleDateFormat format = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss z", Locale.US);
format.setTimeZone(FORMAT_TIME_ZONE);
return format;
@@ -65,7 +66,7 @@
*/
private static final String EXPIRED_DATE = getFormattedExpiry(0);
- public void encodeCookie(Collection<Cookie> cookies, ByteBuffer buffer) {
+ public void encodeCookie(Collection<Cookie> cookies, IoBuffer buffer) {
for (Cookie c: cookies) {
buffer.put(HEADER_BYTES);
encodeCookieValue(c, buffer);
@@ -78,7 +79,7 @@
return format.format(new Date(time));
}
- private void encodeCookieValue(Cookie cookie, ByteBuffer buffer) {
+ private void encodeCookieValue(Cookie cookie, IoBuffer buffer) {
HttpCodecUtils.appendString(buffer, cookie.getName());
buffer.put(HttpCodecUtils.EQUALS);
HttpCodecUtils.appendString(buffer, cookie.getValue());
@@ -106,7 +107,7 @@
* @param cookie The cookie
* @param buffer The buffer
*/
- private void encodeExpiry(Cookie cookie, ByteBuffer buffer) {
+ private void encodeExpiry(Cookie cookie, IoBuffer buffer) {
long expiry = cookie.getMaxAge();
int version = cookie.getVersion();
if (expiry >= 0) {
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CookieEncoder.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CookieEncoder.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CookieEncoder.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/CookieEncoder.java Tue Nov 6 00:54:15 2007
@@ -21,7 +21,7 @@
import java.util.Collection;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.Cookie;
/**
@@ -38,5 +38,5 @@
* @param cookies The cookies
* @param buffer The buffer
*/
- public void encodeCookie(Collection<Cookie> cookies, ByteBuffer buffer);
+ public void encodeCookie(Collection<Cookie> cookies, IoBuffer buffer);
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/OneShotHttpResponseEncoder.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/OneShotHttpResponseEncoder.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/OneShotHttpResponseEncoder.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/codec/encoder/OneShotHttpResponseEncoder.java Tue Nov 6 00:54:15 2007
@@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
@@ -49,7 +49,7 @@
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
asciiEncoder.reset();
HttpResponse response = (HttpResponse) message;
- ByteBuffer buffer = ByteBuffer.allocate(512);
+ IoBuffer buffer = IoBuffer.allocate(512);
buffer.setAutoExpand(true);
encodeStatusLine(response, buffer);
@@ -75,7 +75,7 @@
* @param buffer The buffer
* @throws CharacterCodingException
*/
- private void encodeStatusLine(HttpResponse response, ByteBuffer buffer) throws CharacterCodingException {
+ private void encodeStatusLine(HttpResponse response, IoBuffer buffer) throws CharacterCodingException {
// Write protocol version.
buffer.putString(response.getProtocolVersion().toString(), asciiEncoder);
buffer.put(HttpCodecUtils.SP);
@@ -100,7 +100,7 @@
* @param buffer The buffer
* @throws CharacterCodingException
*/
- private void encodeHeaders(HttpResponse response, ByteBuffer buffer) throws CharacterCodingException {
+ private void encodeHeaders(HttpResponse response, IoBuffer buffer) throws CharacterCodingException {
for (Map.Entry<String, List<String>> header: response.getHeaders().entrySet()) {
for (String value: header.getValue()) {
buffer.putString(header.getKey(), asciiEncoder );
@@ -123,7 +123,7 @@
* @param cookies The cookies to encode
* @param buffer The buffer to encode to
*/
- private void encodeCookies(Collection<Cookie> cookies, ByteBuffer buffer) {
+ private void encodeCookies(Collection<Cookie> cookies, IoBuffer buffer) {
cookieEncoderStrategy.encodeCookie(cookies, buffer);
}
@@ -133,11 +133,11 @@
* @param response The response
* @param buffer The buffer to write to
*/
- private void encodeBody(HttpResponse response, ByteBuffer buffer) {
+ private void encodeBody(HttpResponse response, IoBuffer buffer) {
// FIXME Should be able to handle contents of various types.
Content content = response.getContent();
if (content instanceof ByteBufferContent) {
- ByteBufferContent bbc = (ByteBufferContent) response.getContent();
+ ByteBufferContent bbc = (ByteBufferContent) response.getContent();
buffer.put(bbc.getByteBuffer());
}
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/common/content/ByteBufferContent.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/common/content/ByteBufferContent.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/common/content/ByteBufferContent.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/common/content/ByteBufferContent.java Tue Nov 6 00:54:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.asyncweb.common.content;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.Content;
/**
@@ -32,9 +32,9 @@
private static final long serialVersionUID = -3456547908555235715L;
- private final ByteBuffer buffer;
+ private final IoBuffer buffer;
- public ByteBufferContent(ByteBuffer buffer) {
+ public ByteBufferContent(IoBuffer buffer) {
if (buffer == null) {
throw new NullPointerException("buffer");
}
@@ -42,7 +42,7 @@
this.buffer = buffer;
}
- public ByteBuffer getByteBuffer() {
+ public IoBuffer getByteBuffer() {
return buffer.duplicate();
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/BasicServiceContainer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/BasicServiceContainer.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/BasicServiceContainer.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/BasicServiceContainer.java Tue Nov 6 00:54:15 2007
@@ -247,8 +247,8 @@
private void startHandlers() {
LOG.info("Starting handlers");
synchronized (filters) {
- for (Iterator iter=filters.iterator(); iter.hasNext(); ) {
- HttpServiceFilter handler = (HttpServiceFilter) iter.next();
+ for (Iterator<HttpServiceFilter> iter=filters.iterator(); iter.hasNext(); ) {
+ HttpServiceFilter handler = iter.next();
handler.start();
}
}
@@ -258,8 +258,8 @@
private void stopHandlers() {
LOG.info("Stopping handlers");
synchronized (filters) {
- for (Iterator iter=filters.iterator(); iter.hasNext(); ) {
- HttpServiceFilter handler = (HttpServiceFilter) iter.next();
+ for (Iterator<HttpServiceFilter> iter=filters.iterator(); iter.hasNext(); ) {
+ HttpServiceFilter handler = iter.next();
LOG.info("Stopping handler '" + handler + "'");
handler.stop();
LOG.info("Handler '" + handler + "' stopped");
@@ -282,8 +282,8 @@
private void startTransports() throws ContainerLifecycleException {
LOG.info("Starting transports");
synchronized (transports) {
- for (Iterator iter=transports.iterator(); iter.hasNext(); ) {
- Transport transport = (Transport) iter.next();
+ for (Iterator<Transport> iter=transports.iterator(); iter.hasNext(); ) {
+ Transport transport = iter.next();
LOG.info("Starting transport '" + transport + "'");
try {
transport.start();
@@ -301,8 +301,8 @@
LOG.info("Stopping transports");
boolean isError = false;
synchronized (transports) {
- for (Iterator iter=transports.iterator(); iter.hasNext(); ) {
- Transport transport = (Transport) iter.next();
+ for (Iterator<Transport> iter=transports.iterator(); iter.hasNext(); ) {
+ Transport transport = iter.next();
LOG.info("Stopping transport '" + transport + "'");
try {
transport.stop();
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/HttpServiceHandler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/HttpServiceHandler.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/HttpServiceHandler.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/HttpServiceHandler.java Tue Nov 6 00:54:15 2007
@@ -120,10 +120,10 @@
*/
public void start() {
LOG.info("HttpServiceHandler starting");
- for (Iterator iter=serviceMap.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- String serviceName = (String) entry.getKey();
- HttpService service = (HttpService) entry.getValue();
+ for (Iterator<Map.Entry<String, HttpService>> iter=serviceMap.entrySet().iterator(); iter.hasNext(); ) {
+ Map.Entry<String, HttpService> entry = iter.next();
+ String serviceName = entry.getKey();
+ HttpService service = entry.getValue();
LOG.info("Starting HttpService '" + serviceName + "'");
service.start();
LOG.info("HttpService '" + serviceName + "' started");
@@ -135,10 +135,10 @@
*/
public void stop() {
LOG.info("HttpServiceHandler stopping");
- for (Iterator iter=serviceMap.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- String serviceName = (String) entry.getKey();
- HttpService service = (HttpService) entry.getValue();
+ for (Iterator<Map.Entry<String, HttpService>> iter=serviceMap.entrySet().iterator(); iter.hasNext(); ) {
+ Map.Entry<String, HttpService> entry = iter.next();
+ String serviceName = entry.getKey();
+ HttpService service = entry.getValue();
LOG.info("Stopping HttpService '" + serviceName + "'");
service.stop();
LOG.info("HttpService '" + serviceName + "' stopped");
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/CSS.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/CSS.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/CSS.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/CSS.java Tue Nov 6 00:54:15 2007
@@ -21,7 +21,7 @@
import java.io.UnsupportedEncodingException;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
/**
* Manages the stylesheet info used for generated pages
@@ -60,7 +60,7 @@
}
}
- public static void writeTo(ByteBuffer buf) {
+ public static void writeTo(IoBuffer buf) {
buf.put(BYTES);
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/StandardResponseFormatter.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/StandardResponseFormatter.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/StandardResponseFormatter.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/errorReporting/StandardResponseFormatter.java Tue Nov 6 00:54:15 2007
@@ -21,7 +21,7 @@
import java.io.UnsupportedEncodingException;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.HttpRequest;
import org.safehaus.asyncweb.common.HttpResponseStatus;
import org.safehaus.asyncweb.common.MutableHttpResponse;
@@ -82,7 +82,7 @@
html.append("<HR size=\"1\" noshade=\"noshade\">");
html.append("<H2>AsyncWeb Server</H2>");
- ByteBuffer out = ByteBuffer.allocate(html.length());
+ IoBuffer out = IoBuffer.allocate(html.length());
// TODO: Need to sort this out when we start dealing with character encodings
try {
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/CompositeResolver.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/CompositeResolver.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/CompositeResolver.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/CompositeResolver.java Tue Nov 6 00:54:15 2007
@@ -77,11 +77,11 @@
*
* @param resolvers The resolvers
*/
- public void setResolvers(List resolvers) {
+ public void setResolvers(List<ServiceResolver> resolvers) {
this.resolvers.clear();
// Find bad types early
- for (Iterator iter = resolvers.iterator(); iter.hasNext(); ) {
- ServiceResolver resolver = (ServiceResolver) iter.next();
+ for (Iterator<ServiceResolver> iter = resolvers.iterator(); iter.hasNext(); ) {
+ ServiceResolver resolver = iter.next();
addResolver(resolver);
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/ExactMatchURIServiceResolver.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/ExactMatchURIServiceResolver.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/ExactMatchURIServiceResolver.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/resolver/ExactMatchURIServiceResolver.java Tue Nov 6 00:54:15 2007
@@ -67,12 +67,12 @@
* @throws ClassCastException If any element (key or value) in the map
* is not a <code>java.lang.String</code>
*/
- public void setMappings(Map map) {
+ public void setMappings(Map<String, String> map) {
serviceMap.clear();
- for (Iterator iter=map.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
+ for (Iterator<Map.Entry<String, String>> iter=map.entrySet().iterator(); iter.hasNext(); ) {
+ Map.Entry<String, String> entry = iter.next();
+ String key = entry.getKey();
+ String value = entry.getValue();
addURIMapping(key, value);
}
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/session/BasicSessionStore.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/session/BasicSessionStore.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/session/BasicSessionStore.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/session/BasicSessionStore.java Tue Nov 6 00:54:15 2007
@@ -27,13 +27,13 @@
import java.util.List;
import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.safehaus.asyncweb.service.HttpSession;
import org.safehaus.asyncweb.util.LinkedPermitIssuer;
import org.safehaus.asyncweb.util.PermitExpirationListener;
import org.safehaus.asyncweb.util.TimedPermit;
import org.safehaus.asyncweb.util.TimedPermitIssuer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A simple <code>SessionStore</code> implementation which holds all session
@@ -219,8 +219,8 @@
*/
private void fireCreated(HttpSession session) {
synchronized (listeners) {
- for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
- HttpSessionListener listener = (HttpSessionListener) iter.next();
+ for (Iterator<HttpSessionListener> iter = listeners.iterator(); iter.hasNext(); ) {
+ HttpSessionListener listener = iter.next();
listener.sessionCreated(session);
}
}
@@ -233,8 +233,8 @@
*/
private void fireDestroyed(HttpSession session) {
synchronized (listeners) {
- for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
- HttpSessionListener listener = (HttpSessionListener) iter.next();
+ for (Iterator<HttpSessionListener> iter = listeners.iterator(); iter.hasNext(); ) {
+ HttpSessionListener listener = iter.next();
listener.sessionDestroyed(session);
}
}
@@ -247,8 +247,8 @@
*/
private void fireExpiry(HttpSession session) {
synchronized (listeners) {
- for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
- HttpSessionListener listener = (HttpSessionListener) iter.next();
+ for (Iterator<HttpSessionListener> iter = listeners.iterator(); iter.hasNext(); ) {
+ HttpSessionListener listener = iter.next();
listener.sessionExpired(session);
}
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/transport/mina/MinaTransport.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/transport/mina/MinaTransport.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/transport/mina/MinaTransport.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/service/transport/mina/MinaTransport.java Tue Nov 6 00:54:15 2007
@@ -29,8 +29,8 @@
import org.apache.mina.common.IoFilter;
import org.apache.mina.filter.executor.ExecutorFilter;
import org.apache.mina.filter.logging.LoggingFilter;
-import org.apache.mina.transport.socket.SocketSessionConfig;
-import org.apache.mina.transport.socket.nio.SocketAcceptor;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.safehaus.asyncweb.service.ServiceContainer;
import org.safehaus.asyncweb.service.Transport;
import org.safehaus.asyncweb.service.TransportException;
@@ -150,14 +150,14 @@
ioThreads + 1, ioThreads + 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>() );
eventExecutor = new ThreadPoolExecutor(
eventThreads + 1, eventThreads + 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>() );
- acceptor = new SocketAcceptor(ioThreads, ioExecutor);
+ acceptor = new NioSocketAcceptor(ioThreads, ioExecutor);
try {
acceptor.getFilterChain().addLast(
"threadPool",
new ExecutorFilter(eventExecutor));
acceptor.setReuseAddress(true);
- ((SocketSessionConfig) acceptor.getSessionConfig()).setReuseAddress(true);
+ acceptor.getSessionConfig().setReuseAddress(true);
if (isLoggingTraffic) {
LOG.info("Configuring traffic logging filter");
IoFilter filter = new LoggingFilter();
@@ -191,7 +191,8 @@
/**
* @return A string representation of this transport
*/
- public String toString() {
+ @Override
+public String toString() {
return "NIOTransport [port=" + port + "]";
}
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/HttpDateFormat.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/HttpDateFormat.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/HttpDateFormat.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/HttpDateFormat.java Tue Nov 6 00:54:15 2007
@@ -42,8 +42,9 @@
/**
* Thread local <code>HttpDateFormat</code>
*/
- private static final ThreadLocal FORMAT_LOCAL = new ThreadLocal() {
- protected Object initialValue() {
+ private static final ThreadLocal<HttpDateFormat> FORMAT_LOCAL = new ThreadLocal<HttpDateFormat>() {
+ @Override
+ protected HttpDateFormat initialValue() {
return new HttpDateFormat();
}
};
@@ -75,7 +76,7 @@
* @return The formatted date
*/
public static String getCurrentHttpDate() {
- return ((HttpDateFormat) FORMAT_LOCAL.get()).getCurrentDate();
+ return (FORMAT_LOCAL.get()).getCurrentDate();
}
/**
Modified: mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/LinkedPermitIssuer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/LinkedPermitIssuer.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/LinkedPermitIssuer.java (original)
+++ mina/sandbox/asyncweb/core/src/main/java/org/safehaus/asyncweb/util/LinkedPermitIssuer.java Tue Nov 6 00:54:15 2007
@@ -183,8 +183,8 @@
*/
private void notifyExpiry(Object target) {
synchronized (listeners) {
- for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
- PermitExpirationListener listener = (PermitExpirationListener) iter.next();
+ for (Iterator<PermitExpirationListener> iter = listeners.iterator(); iter.hasNext(); ) {
+ PermitExpirationListener listener = iter.next();
listener.permitExpired(target);
}
}
Modified: mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/cookie/CookieExample.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/cookie/CookieExample.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/cookie/CookieExample.java (original)
+++ mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/cookie/CookieExample.java Tue Nov 6 00:54:15 2007
@@ -23,7 +23,7 @@
import java.io.StringWriter;
import java.nio.charset.Charset;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.DefaultCookie;
import org.safehaus.asyncweb.common.DefaultHttpResponse;
import org.safehaus.asyncweb.common.HttpRequest;
@@ -56,7 +56,7 @@
writer.println("</body></html>");
writer.flush();
- ByteBuffer bb = ByteBuffer.allocate(1024);
+ IoBuffer bb = IoBuffer.allocate(1024);
bb.setAutoExpand(true);
bb.putString(buf.toString(), Charset.forName("UTF-8").newEncoder());
bb.flip();
Modified: mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/helloworld/HelloWorldHttpService.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/helloworld/HelloWorldHttpService.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/helloworld/HelloWorldHttpService.java (original)
+++ mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/helloworld/HelloWorldHttpService.java Tue Nov 6 00:54:15 2007
@@ -27,7 +27,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.Cookie;
import org.safehaus.asyncweb.common.DefaultHttpResponse;
import org.safehaus.asyncweb.common.HttpRequest;
@@ -68,7 +68,7 @@
writeCookies(context.getRequest(), writer);
writer.flush();
- ByteBuffer bb = ByteBuffer.allocate(1024);
+ IoBuffer bb = IoBuffer.allocate(1024);
bb.setAutoExpand(true);
bb.putString(buf.toString(), Charset.forName("UTF-8").newEncoder());
bb.flip();
Modified: mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/HttpProtocolHandler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/HttpProtocolHandler.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/HttpProtocolHandler.java (original)
+++ mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/HttpProtocolHandler.java Tue Nov 6 00:54:15 2007
@@ -25,8 +25,8 @@
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.IoBuffer;
import org.apache.mina.common.IoFutureListener;
import org.apache.mina.common.IoHandler;
import org.apache.mina.common.IoSession;
@@ -42,7 +42,7 @@
public class HttpProtocolHandler implements IoHandler {
private static final int CONTENT_PADDING = 0; // 101
- private final Map<Integer, ByteBuffer> buffers = new ConcurrentHashMap<Integer, ByteBuffer>();
+ private final Map<Integer, IoBuffer> buffers = new ConcurrentHashMap<Integer, IoBuffer>();
private final Timer timer;
@@ -53,7 +53,7 @@
public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
if (!(cause instanceof IOException)) {
- IoSessionLogger.warn(session, "Unexpected exception:", cause);
+ IoSessionLogger.getLogger(session).warn(cause);
}
session.close();
}
@@ -96,9 +96,9 @@
res.setHeader("ETag", "W/\"" + size + "-1164091960000\"");
res.setHeader("Last-Modified", "Tue, 31 Nov 2006 06:52:40 GMT");
- ByteBuffer buf = buffers.get(size);
+ IoBuffer buf = buffers.get(size);
if (buf == null) {
- buf = ByteBuffer.allocate(size);
+ buf = IoBuffer.allocate(size);
buffers.put(size, buf);
}
Modified: mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/Main.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/Main.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/Main.java (original)
+++ mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/lightweight/Main.java Tue Nov 6 00:54:15 2007
@@ -24,29 +24,27 @@
import java.util.concurrent.Executors;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.apache.mina.transport.socket.SocketSessionConfig;
-import org.apache.mina.transport.socket.nio.SocketAcceptor;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.safehaus.asyncweb.codec.HttpServerCodecFactory;
public class Main {
public static void main(String[] args) throws Exception {
Executor threadPool = Executors.newCachedThreadPool();
- SocketAcceptor acceptor = new SocketAcceptor(
+ SocketAcceptor acceptor = new NioSocketAcceptor(
Runtime.getRuntime().availableProcessors() + 1,
threadPool);
acceptor.getFilterChain().addLast(
"codec",
new ProtocolCodecFilter(new HttpServerCodecFactory()));
-// acceptor.getFilterChain().addLast(
-// "threadPool",
-// new ExecutorFilter(threadPool));
+
acceptor.setReuseAddress(true);
- ((SocketSessionConfig) acceptor.getSessionConfig()).setReuseAddress(true);
- ((SocketSessionConfig) acceptor.getSessionConfig()).setReceiveBufferSize(1024);
- ((SocketSessionConfig) acceptor.getSessionConfig()).setSendBufferSize(1024);
- //((SocketSessionConfig) acceptor.getSessionConfig()).setTcpNoDelay(true);
- ((SocketSessionConfig) acceptor.getSessionConfig()).setSoLinger(-1);
+ acceptor.getSessionConfig().setReuseAddress(true);
+ acceptor.getSessionConfig().setReceiveBufferSize(1024);
+ acceptor.getSessionConfig().setSendBufferSize(1024);
+ acceptor.getSessionConfig().setTcpNoDelay(true);
+ acceptor.getSessionConfig().setSoLinger(-1);
acceptor.setBacklog(10240);
acceptor.setLocalAddress(new InetSocketAddress(9012));
Modified: mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/session/SessionExample.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/session/SessionExample.java?rev=592334&r1=592333&r2=592334&view=diff
==============================================================================
--- mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/session/SessionExample.java (original)
+++ mina/sandbox/asyncweb/example/src/main/java/org/safehaus/asyncweb/example/session/SessionExample.java Tue Nov 6 00:54:15 2007
@@ -23,7 +23,7 @@
import java.io.StringWriter;
import java.nio.charset.Charset;
-import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoBuffer;
import org.safehaus.asyncweb.common.DefaultHttpResponse;
import org.safehaus.asyncweb.common.MutableHttpResponse;
import org.safehaus.asyncweb.common.content.ByteBufferContent;
@@ -61,7 +61,7 @@
writer.println("</body></html>");
writer.flush();
- ByteBuffer bb = ByteBuffer.allocate(1024);
+ IoBuffer bb = IoBuffer.allocate(1024);
bb.setAutoExpand(true);
bb.putString(buf.toString(), Charset.forName("UTF-8").newEncoder());
bb.flip();