You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/06/08 14:44:32 UTC

svn commit: r782607 - /webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/

Author: veithen
Date: Mon Jun  8 12:44:32 2009
New Revision: 782607

URL: http://svn.apache.org/viewvc?rev=782607&view=rev
Log:
Some design improvements.

Added:
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java   (with props)
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java   (with props)
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java   (with props)
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java   (with props)
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java   (with props)
Modified:
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoder.java
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/Headers.java
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/HttpFilter.java
    webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoder.java

Modified: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoder.java?rev=782607&r1=782606&r2=782607&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoder.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoder.java Mon Jun  8 12:44:32 2009
@@ -21,11 +21,21 @@
 import org.apache.ws.commons.tcpmon.core.filter.StreamUtil;
 
 public class ChunkedEncoder implements StreamFilter {
+    private Headers headers;
+    
+    public ChunkedEncoder(Headers headers) {
+        this.headers = headers;
+    }
+
     public boolean isReadOnly() {
         return false;
     }
 
     public void invoke(Stream stream) {
+        if (headers != null) {
+            headers.writeTo(stream);
+            headers = null;
+        }
         int av = stream.available();
         if (av > 0 || stream.isEndOfStream()) {
             StreamUtil.insertAsciiString(stream, "\r\n");

Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java?rev=782607&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java Mon Jun  8 12:44:32 2009
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.ws.commons.tcpmon.core.filter.http;
+
+import org.apache.ws.commons.tcpmon.core.filter.EntityProcessor;
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+
+/**
+ * Implementation of the chunked transfer encoding.
+ */
+public class ChunkedEncoding implements TransferEncoding {
+    public EntityProcessor createDecoder(Headers headers) {
+        return new ChunkedDecoder();
+    }
+
+    public StreamFilter createEncoder(Headers headers) {
+        return new ChunkedEncoder(headers);
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ChunkedEncoding.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java?rev=782607&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java Mon Jun  8 12:44:32 2009
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.ws.commons.tcpmon.core.filter.http;
+
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+
+/**
+ * Represents a particular content encoding as specified by the <tt>Content-Encoding</tt>
+ * header.
+ */
+public interface ContentEncoding {
+    /**
+     * Create a decoder for the content encoding.
+     * 
+     * @return a stream filter able to decode the content encoding
+     */
+    StreamFilter createDecoder();
+    
+    /**
+     * Create an encoder for the content encoding.
+     * 
+     * @return a stream filter able to encode the content encoding
+     */
+    StreamFilter createEncoder();
+}

Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/ContentEncoding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java?rev=782607&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java Mon Jun  8 12:44:32 2009
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.ws.commons.tcpmon.core.filter.http;
+
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+import org.apache.ws.commons.tcpmon.core.filter.zip.GZIPDecoder;
+import org.apache.ws.commons.tcpmon.core.filter.zip.GZIPEncoder;
+
+/**
+ * Implementation of the GZIP content encoding.
+ */
+public class GZIPEncoding implements ContentEncoding {
+    public StreamFilter createDecoder() {
+        return new GZIPDecoder();
+    }
+
+    public StreamFilter createEncoder() {
+        return new GZIPEncoder();
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/GZIPEncoding.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/Headers.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/Headers.java?rev=782607&r1=782606&r2=782607&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/Headers.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/Headers.java Mon Jun  8 12:44:32 2009
@@ -21,6 +21,10 @@
 import java.util.List;
 import java.util.ListIterator;
 
+import org.apache.ws.commons.tcpmon.core.filter.HeaderParser;
+import org.apache.ws.commons.tcpmon.core.filter.Stream;
+import org.apache.ws.commons.tcpmon.core.filter.StreamUtil;
+
 public class Headers implements Iterable<Header> {
     private final List<Header> headers = new LinkedList<Header>();
     
@@ -59,4 +63,17 @@
     public Iterator<Header> iterator() {
         return headers.iterator();
     }
+    
+    /**
+     * Write the headers to a given stream.
+     * 
+     * @param stream the stream to write to
+     */
+    public void writeTo(Stream stream) {
+        HeaderParser p = new HeaderParser(stream);
+        for (Header header : headers) {
+            p.insert(header.getName(), header.getValue());
+        }
+        StreamUtil.insertAsciiString(stream, "\r\n");
+    }
 }

Modified: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/HttpFilter.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/HttpFilter.java?rev=782607&r1=782606&r2=782607&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/HttpFilter.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/HttpFilter.java Mon Jun  8 12:44:32 2009
@@ -16,20 +16,20 @@
 
 package org.apache.ws.commons.tcpmon.core.filter.http;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
 import org.apache.ws.commons.tcpmon.core.filter.EntityProcessor;
 import org.apache.ws.commons.tcpmon.core.filter.HeaderParser;
 import org.apache.ws.commons.tcpmon.core.filter.ReadOnlyEntityProcessorWrapper;
-import org.apache.ws.commons.tcpmon.core.filter.ReadOnlyStream;
 import org.apache.ws.commons.tcpmon.core.filter.Stream;
 import org.apache.ws.commons.tcpmon.core.filter.StreamException;
 import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
 import org.apache.ws.commons.tcpmon.core.filter.StreamUtil;
 import org.apache.ws.commons.tcpmon.core.filter.mime.ContentFilterFactory;
-import org.apache.ws.commons.tcpmon.core.filter.zip.GZIPDecoder;
-import org.apache.ws.commons.tcpmon.core.filter.zip.GZIPEncoder;
 
 /**
  * Base class for {@link HttpRequestFilter} and {@link HttpResponseFilter}.
@@ -40,6 +40,16 @@
     private static final int STATE_CONTENT = 2;
     private static final int STATE_COMPLETE = 3;
 
+    private static final Map<String,TransferEncoding> transferEncodings;
+    private static final Map<String,ContentEncoding> contentEncodings;
+    
+    static {
+        transferEncodings = new HashMap<String,TransferEncoding>();
+        transferEncodings.put("chunked", new ChunkedEncoding());
+        contentEncodings = new HashMap<String,ContentEncoding>();
+        contentEncodings.put("gzip", new GZIPEncoding());
+    }
+    
     private final boolean decode;
     private int state = STATE_FIRST_LINE;
     private final Headers headers = new Headers();
@@ -92,7 +102,8 @@
                         headerParser.discard();
                     }
                     if (headerParser.noMoreHeaders()) {
-                        processHeaders(headerParser, stream);
+                        headerParser.discard();
+                        processHeaders(stream);
                     } else {
                         return;
                     }
@@ -126,29 +137,21 @@
     protected abstract void processHeaders(Headers headers);
     protected abstract void completed();
 
-    private void processHeaders(HeaderParser headerParser, Stream stream) {
+    private void processHeaders(Stream stream) {
         processHeaders(headers);
         
         boolean hasEntity = false;
-        boolean discardHeaders = false;
-        StreamFilter transferEncoder = null;
-        StreamFilter contentDecoder = null;
-        StreamFilter contentEncoder = null;
+        TransferEncoding transferEncoding = null;
+        ContentEncoding contentEncoding = null;
         for (Header header : headers) {
             String name = header.getName();
             String value = header.getValue();
             if (name.equalsIgnoreCase("Content-Length")) {
                 hasEntity = true;
-                transferDecoder = new IdentityDecoder(Integer.parseInt(value));
-                transferEncoder = new IdentityEncoder(headers);
-                discardHeaders = true;
+                transferEncoding = new IdentityEncoding();
             } else if (name.equalsIgnoreCase("Transfer-Encoding")) {
                 hasEntity = true;
-                if (value.equals("chunked")) {
-                    transferDecoder = new ChunkedDecoder();
-                    transferEncoder = new ChunkedEncoder();
-                    discardHeaders = false;
-                }
+                transferEncoding = transferEncodings.get(value);
             } else if (name.equalsIgnoreCase("Content-Type")) {
                 hasEntity = true;
                 if (contentFilterFactory != null) {
@@ -159,42 +162,38 @@
                     }
                 }
             } else if (name.equalsIgnoreCase("Content-Encoding")) {
-                if (value.equals("gzip")) {
-                    contentDecoder = new GZIPDecoder();
-                    contentEncoder = new GZIPEncoder();
-                }
+                contentEncoding = contentEncodings.get(value);
             }
         }
         
-        if (discardHeaders && contentFilterChain != null) {
-            headerParser.discard();
-        } else {
-            for (Header header : headers) {
-                headerParser.insert(header.getName(), header.getValue());
-            }
-            headerParser.skip();
+        if (transferEncoding == null || contentFilterChain == null) {
+            headers.writeTo(stream);
+        }
+        
+        if (transferEncoding != null) {
+            transferDecoder = transferEncoding.createDecoder(headers);
         }
         
         if (hasEntity) {
             if (contentFilterChain != null) {
                 if (!decode) {
-                    if (transferEncoder != null) {
-                        stream.pushFilter(transferEncoder);
+                    if (transferEncoding != null) {
+                        stream.pushFilter(transferEncoding.createEncoder(headers));
                     }
-                    if (contentEncoder != null) {
-                        stream.pushFilter(contentEncoder);
+                    if (contentEncoding != null) {
+                        stream.pushFilter(contentEncoding.createEncoder());
                     }
                 }
                 for (int i=contentFilterChain.length-1; i>=0; i--) {
                     stream.pushFilter(contentFilterChain[i]);
                 }
-                if (contentDecoder != null) {
-                    stream.pushFilter(contentDecoder);
+                if (contentEncoding != null) {
+                    stream.pushFilter(contentEncoding.createDecoder());
                 }
             } else {
                 if (decode) {
-                    if (contentDecoder != null) {
-                        stream.pushFilter(contentDecoder);
+                    if (contentEncoding != null) {
+                        stream.pushFilter(contentEncoding.createDecoder());
                     }
                 } else {
                     if (transferDecoder != null) {

Modified: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoder.java?rev=782607&r1=782606&r2=782607&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoder.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoder.java Mon Jun  8 12:44:32 2009
@@ -19,11 +19,9 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import org.apache.ws.commons.tcpmon.core.filter.HeaderParser;
 import org.apache.ws.commons.tcpmon.core.filter.Stream;
 import org.apache.ws.commons.tcpmon.core.filter.StreamException;
 import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
-import org.apache.ws.commons.tcpmon.core.filter.StreamUtil;
 
 public class IdentityEncoder implements StreamFilter {
     private final Headers headers;
@@ -47,11 +45,7 @@
         if (stream.isEndOfStream()) {
             byte[] data = buffer.toByteArray();
             headers.set("Content-Length", String.valueOf(data.length));
-            HeaderParser p = new HeaderParser(stream);
-            for (Header header : headers) {
-                p.insert(header.getName(), header.getValue());
-            }
-            StreamUtil.insertAsciiString(stream, "\r\n");
+            headers.writeTo(stream);
             stream.insert(data, 0, data.length);
         }
     }

Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java?rev=782607&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java Mon Jun  8 12:44:32 2009
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.ws.commons.tcpmon.core.filter.http;
+
+import org.apache.ws.commons.tcpmon.core.filter.EntityProcessor;
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+
+/**
+ * Implementation of the identity transfer encoding.
+ */
+public class IdentityEncoding implements TransferEncoding {
+    public EntityProcessor createDecoder(Headers headers) {
+        int contentLength = Integer.parseInt(headers.getFirst("Content-Length").getValue());
+        return new IdentityDecoder(contentLength);
+    }
+
+    public StreamFilter createEncoder(Headers headers) {
+        return new IdentityEncoder(headers);
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/IdentityEncoding.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java?rev=782607&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java Mon Jun  8 12:44:32 2009
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.ws.commons.tcpmon.core.filter.http;
+
+import org.apache.ws.commons.tcpmon.core.filter.EntityProcessor;
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+
+/**
+ * Represents a particular transfer encoding as specified by the <tt>Transfer-Encoding</tt>
+ * header.
+ */
+public interface TransferEncoding {
+    /**
+     * Create a decoder for the transfer encoding.
+     * 
+     * @param headers The HTTP headers of the request or response. The implementation may
+     *                use this object to extract additional information.
+     * @return a stream filter able to decode the transfer encoding
+     */
+    EntityProcessor createDecoder(Headers headers);
+
+    /**
+     * Create an encoder for the transfer encoding.
+     * 
+     * @param headers The HTTP headers for the request or response to encode. It is the
+     *                responsibility of the implementation to write these headers to the
+     *                stream. This gives the implementation the opportunity to modify
+     *                some headers.
+     * @return a stream filter able to encode the transfer encoding
+     */
+    StreamFilter createEncoder(Headers headers);
+}

Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/http/TransferEncoding.java
------------------------------------------------------------------------------
    svn:eol-style = native