You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by mw...@apache.org on 2007/09/14 16:54:51 UTC

svn commit: r575711 - /mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/

Author: mwebb
Date: Fri Sep 14 07:54:50 2007
New Revision: 575711

URL: http://svn.apache.org/viewvc?rev=575711&view=rev
Log:
updated the formatting based on the latest source code formatting guidelines

Modified:
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/AsyncHttpClientException.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/Cookie.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateParseException.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateUtil.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/EncodingUtil.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpDecoder.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpMessage.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpProtocolCodecFactory.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestEncoder.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestMessage.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseDecoder.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseMessage.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/LangUtils.java
    mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/NameValuePair.java

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/AsyncHttpClientException.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/AsyncHttpClientException.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/AsyncHttpClientException.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/AsyncHttpClientException.java Fri Sep 14 07:54:50 2007
@@ -19,37 +19,27 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 /**
  * TODO AsyncHttpClientException.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class AsyncHttpClientException extends Error
-{
+public class AsyncHttpClientException extends Error {
     private static final long serialVersionUID = 1L;
 
-
-    public AsyncHttpClientException()
-    {
+    public AsyncHttpClientException() {
     }
 
-
-    public AsyncHttpClientException( String string )
-    {
-        super( string );
+    public AsyncHttpClientException(String string) {
+        super(string);
     }
 
-
-    public AsyncHttpClientException( String string, Throwable throwable )
-    {
-        super( string, throwable );
+    public AsyncHttpClientException(String string, Throwable throwable) {
+        super(string, throwable);
     }
 
-
-    public AsyncHttpClientException( Throwable throwable )
-    {
-        super( throwable );
+    public AsyncHttpClientException(Throwable throwable) {
+        super(throwable);
     }
 }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/Cookie.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/Cookie.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/Cookie.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/Cookie.java Fri Sep 14 07:54:50 2007
@@ -19,128 +19,98 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import java.util.Date;
 
-
 /**
  * TODO Cookie.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class Cookie
-{
+public class Cookie {
 
     private String comment;
+
     private String domain;
+
     private String name;
+
     private String value;
+
     private String path;
+
     private boolean secure;
+
     private int version = 0;
-    private Date expires;
 
+    private Date expires;
 
-    public Cookie( String name, String value )
-    {
+    public Cookie(String name, String value) {
         this.name = name;
         this.value = value;
     }
 
-
-    public String getComment()
-    {
+    public String getComment() {
         return comment;
     }
 
-
-    public void setComment( String comment )
-    {
+    public void setComment(String comment) {
         this.comment = comment;
     }
 
-
-    public String getDomain()
-    {
+    public String getDomain() {
         return domain;
     }
 
-
-    public void setDomain( String domain )
-    {
+    public void setDomain(String domain) {
         this.domain = domain;
     }
 
-
-    public String getName()
-    {
+    public String getName() {
         return name;
     }
 
-
-    public void setName( String name )
-    {
+    public void setName(String name) {
         this.name = name;
     }
 
-
-    public String getValue()
-    {
+    public String getValue() {
         return value;
     }
 
-
-    public void setValue( String value )
-    {
+    public void setValue(String value) {
         this.value = value;
     }
 
-
-    public String getPath()
-    {
+    public String getPath() {
         return path;
     }
 
-
-    public void setPath( String path )
-    {
+    public void setPath(String path) {
         this.path = path;
     }
 
-
-    public boolean isSecure()
-    {
+    public boolean isSecure() {
         return secure;
     }
 
-
-    public void setSecure( boolean secure )
-    {
+    public void setSecure(boolean secure) {
         this.secure = secure;
     }
 
-
-    public int getVersion()
-    {
+    public int getVersion() {
         return version;
     }
 
-
-    public void setVersion( int version )
-    {
+    public void setVersion(int version) {
         this.version = version;
     }
 
-
-    public Date getExpires()
-    {
+    public Date getExpires() {
         return expires;
     }
 
-
-    public void setExpires( Date expires )
-    {
+    public void setExpires(Date expires) {
         this.expires = expires;
     }
 }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateParseException.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateParseException.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateParseException.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateParseException.java Fri Sep 14 07:54:50 2007
@@ -19,7 +19,6 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 /**
  * An exception to indicate an error parsing a date string.
  *
@@ -46,4 +45,3 @@
     }
 
 }
-

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateUtil.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateUtil.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateUtil.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/DateUtil.java Fri Sep 14 07:54:50 2007
@@ -29,7 +29,6 @@
 import java.util.Locale;
 import java.util.TimeZone;
 
-
 /**
  * A utility class for parsing and formatting HTTP dates as used in cookies and
  * other headers.  This class handles dates as defined by RFC 2616 section
@@ -56,8 +55,9 @@
      */
     public static final String PATTERN_ASCTIME = "EEE MMM d HH:mm:ss yyyy";
 
-    private static final Collection<String> DEFAULT_PATTERNS = Arrays.asList(
-    		new String[] { PATTERN_ASCTIME, PATTERN_RFC1036, PATTERN_RFC1123 } );
+    private static final Collection<String> DEFAULT_PATTERNS = Arrays
+            .asList(new String[] { PATTERN_ASCTIME, PATTERN_RFC1036,
+                    PATTERN_RFC1123 });
 
     private static final Date DEFAULT_TWO_DIGIT_YEAR_START;
 
@@ -94,8 +94,8 @@
      *
      * @throws DateParseException if none of the dataFormats could parse the dateValue
      */
-    public static Date parseDate(String dateValue, Collection<String> dateFormats)
-        throws DateParseException {
+    public static Date parseDate(String dateValue,
+            Collection<String> dateFormats) throws DateParseException {
         return parseDate(dateValue, dateFormats, null);
     }
 
@@ -113,28 +113,24 @@
      *
      * @throws DateParseException if none of the dataFormats could parse the dateValue
      */
-    public static Date parseDate(
-        String dateValue,
-        Collection<String> dateFormats,
-        Date startDate
-    ) throws DateParseException {
+    public static Date parseDate(String dateValue,
+            Collection<String> dateFormats, Date startDate)
+            throws DateParseException {
 
         if (dateValue == null) {
             throw new IllegalArgumentException("dateValue is null");
         }
         if (dateFormats == null) {
-        	dateFormats = DEFAULT_PATTERNS;
+            dateFormats = DEFAULT_PATTERNS;
         }
         if (startDate == null) {
             startDate = DEFAULT_TWO_DIGIT_YEAR_START;
         }
         // trim single quotes around date if present
         // see issue #5279
-        if (dateValue.length() > 1
-            && dateValue.startsWith("'")
-            && dateValue.endsWith("'")
-        ) {
-            dateValue = dateValue.substring (1, dateValue.length() - 1);
+        if (dateValue.length() > 1 && dateValue.startsWith("'")
+                && dateValue.endsWith("'")) {
+            dateValue = dateValue.substring(1, dateValue.length() - 1);
         }
 
         SimpleDateFormat dateParser = null;
@@ -186,8 +182,10 @@
      * @see SimpleDateFormat
      */
     public static String formatDate(Date date, String pattern) {
-        if (date == null) throw new IllegalArgumentException("date is null");
-        if (pattern == null) throw new IllegalArgumentException("pattern is null");
+        if (date == null)
+            throw new IllegalArgumentException("date is null");
+        if (pattern == null)
+            throw new IllegalArgumentException("pattern is null");
 
         SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.US);
         formatter.setTimeZone(GMT);
@@ -195,6 +193,7 @@
     }
 
     /** This class should not be instantiated. */
-    private DateUtil() { }
+    private DateUtil() {
+    }
 
 }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/EncodingUtil.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/EncodingUtil.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/EncodingUtil.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/EncodingUtil.java Fri Sep 14 07:54:50 2007
@@ -63,7 +63,7 @@
      *
      * @since 2.0 final
      */
-     public static String formUrlEncode(NameValuePair[] pairs, String charset) {
+    public static String formUrlEncode(NameValuePair[] pairs, String charset) {
         try {
             return doFormUrlEncode(pairs, charset);
         } catch (UnsupportedEncodingException e) {
@@ -72,8 +72,8 @@
                 return doFormUrlEncode(pairs, DEFAULT_CHARSET);
             } catch (UnsupportedEncodingException fatal) {
                 // Should never happen. ISO-8859-1 must be supported on all JVMs
-                throw new AsyncHttpClientException("Encoding not supported: " +
-                    DEFAULT_CHARSET);
+                throw new AsyncHttpClientException("Encoding not supported: "
+                        + DEFAULT_CHARSET);
             }
         }
     }
@@ -98,9 +98,8 @@
      *
      * @since 2.0 final
      */
-     private static String doFormUrlEncode(NameValuePair[] pairs, String charset)
-        throws UnsupportedEncodingException
-     {
+    private static String doFormUrlEncode(NameValuePair[] pairs, String charset)
+            throws UnsupportedEncodingException {
         StringBuffer buf = new StringBuffer();
         for (int i = 0; i < pairs.length; i++) {
             URLCodec codec = new URLCodec();
@@ -132,19 +131,16 @@
      *
      * @since 3.0
      */
-    public static String getString(
-        final byte[] data,
-        int offset,
-        int length,
-        String charset
-    ) {
+    public static String getString(final byte[] data, int offset, int length,
+            String charset) {
 
         if (data == null) {
             throw new IllegalArgumentException("Parameter may not be null");
         }
 
         if (charset == null || charset.length() == 0) {
-            throw new IllegalArgumentException("charset may not be null or empty");
+            throw new IllegalArgumentException(
+                    "charset may not be null or empty");
         }
 
         try {
@@ -152,13 +148,13 @@
         } catch (UnsupportedEncodingException e) {
 
             if (LOG.isWarnEnabled()) {
-                LOG.warn("Unsupported encoding: " + charset + ". System encoding used");
+                LOG.warn("Unsupported encoding: " + charset
+                        + ". System encoding used");
             }
             return new String(data, offset, length);
         }
     }
 
-
     /**
      * Converts the byte array of HTTP content characters to a string. If
      * the specified charset is not supported, default system encoding
@@ -191,7 +187,8 @@
         }
 
         if (charset == null || charset.length() == 0) {
-            throw new IllegalArgumentException("charset may not be null or empty");
+            throw new IllegalArgumentException(
+                    "charset may not be null or empty");
         }
 
         try {
@@ -199,7 +196,8 @@
         } catch (UnsupportedEncodingException e) {
 
             if (LOG.isWarnEnabled()) {
-                LOG.warn("Unsupported encoding: " + charset + ". System encoding used.");
+                LOG.warn("Unsupported encoding: " + charset
+                        + ". System encoding used.");
             }
 
             return data.getBytes();
@@ -223,7 +221,8 @@
         try {
             return data.getBytes("US-ASCII");
         } catch (UnsupportedEncodingException e) {
-            throw new AsyncHttpClientException("HttpClient requires ASCII support");
+            throw new AsyncHttpClientException(
+                    "HttpClient requires ASCII support");
         }
     }
 
@@ -238,7 +237,8 @@
      * @return The string representation of the byte array
      *
      */
-    public static String getAsciiString(final byte[] data, int offset, int length) {
+    public static String getAsciiString(final byte[] data, int offset,
+            int length) {
 
         if (data == null) {
             throw new IllegalArgumentException("Parameter may not be null");
@@ -247,7 +247,8 @@
         try {
             return new String(data, offset, length, "US-ASCII");
         } catch (UnsupportedEncodingException e) {
-            throw new AsyncHttpClientException("HttpClient requires ASCII support");
+            throw new AsyncHttpClientException(
+                    "HttpClient requires ASCII support");
         }
     }
 
@@ -271,4 +272,3 @@
     }
 
 }
-

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpDecoder.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpDecoder.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpDecoder.java Fri Sep 14 07:54:50 2007
@@ -19,7 +19,6 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import java.io.IOException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
@@ -27,15 +26,13 @@
 
 import org.apache.mina.common.ByteBuffer;
 
-
 /**
  * TODO HttpDecoder.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpDecoder
-{
+public class HttpDecoder {
     /**
      * Carriage return character
      */
@@ -47,38 +44,39 @@
     private static final byte LF = 10;
 
     public final static String COOKIE_COMMENT = "comment";
+
     public final static String COOKIE_DOMAIN = "domain";
+
     public final static String COOKIE_EXPIRES = "expires";
+
     public final static String COOKIE_MAX_AGE = "max-age";
+
     public final static String COOKIE_PATH = "path";
+
     public final static String COOKIE_SECURE = "secure";
+
     public final static String COOKIE_VERSION = "version";
 
     public final static String SET_COOKIE = "Set-Cookie";
+
     public final static String TRANSFER_ENCODING = "Transfer-Encoding";
+
     public final static String CHUNKED = "chunked";
 
     private CharsetDecoder decoder = Charset.defaultCharset().newDecoder();
 
-
-    public String decodeLine( ByteBuffer in ) throws Exception
-    {
+    public String decodeLine(ByteBuffer in) throws Exception {
         int beginPos = in.position();
         int limit = in.limit();
         boolean lastIsCR = false;
         int terminatorPos = -1;
 
-        for ( int i = beginPos; i < limit; i++ )
-        {
-            byte b = in.get( i );
-            if ( b == CR )
-            {
+        for (int i = beginPos; i < limit; i++) {
+            byte b = in.get(i);
+            if (b == CR) {
                 lastIsCR = true;
-            }
-            else
-            {
-                if ( b == LF && lastIsCR )
-                {
+            } else {
+                if (b == LF && lastIsCR) {
                     terminatorPos = i;
                     break;
                 }
@@ -87,159 +85,139 @@
         }
 
         //Check if we don't have enough data to process or found a full readable line
-        if ( terminatorPos == -1 )
+        if (terminatorPos == -1)
             return null;
 
         String result = null;
-        if ( terminatorPos > 1 )
-        {
+        if (terminatorPos > 1) {
             ByteBuffer line = in.slice();
-            line.limit( terminatorPos - beginPos - 1 );
-            result = line.getString( decoder );
+            line.limit(terminatorPos - beginPos - 1);
+            result = line.getString(decoder);
         }
 
-        in.position( terminatorPos + 1 );
+        in.position(terminatorPos + 1);
 
         return result;
     }
 
+    public void decodeStatus(String line, HttpResponseMessage msg)
+            throws Exception {
+        String magic = line.substring(0, 8);
+        if (!magic.equals("HTTP/1.1") && !magic.equals("HTTP/1.0"))
+            throw new IOException("Invalid HTTP response");
 
-    public void decodeStatus( String line, HttpResponseMessage msg ) throws Exception
-    {
-        String magic = line.substring( 0, 8 );
-        if ( !magic.equals( "HTTP/1.1" ) && !magic.equals( "HTTP/1.0" ) )
-            throw new IOException( "Invalid HTTP response" );
-
-        String status = line.substring( 9, 12 );
-        msg.setStatusCode( Integer.parseInt( status ) );
-        msg.setStatusMessage( line.substring( 13 ) );
+        String status = line.substring(9, 12);
+        msg.setStatusCode(Integer.parseInt(status));
+        msg.setStatusMessage(line.substring(13));
     }
 
+    public void decodeHeader(String line, HttpResponseMessage msg)
+            throws Exception {
+        int pos = line.indexOf(": ");
+        String name = line.substring(0, pos);
+        String value = line.substring(pos + 2);
+        msg.addHeader(name, value);
 
-    public void decodeHeader( String line, HttpResponseMessage msg ) throws Exception
-    {
-        int pos = line.indexOf( ": " );
-        String name = line.substring( 0, pos );
-        String value = line.substring( pos + 2 );
-        msg.addHeader( name, value );
-
-        if ( name.equalsIgnoreCase( SET_COOKIE ) )
-        {
-            Cookie cookie = decodeCookie( value );
-            if ( cookie != null )
-                msg.addCookie( cookie );
+        if (name.equalsIgnoreCase(SET_COOKIE)) {
+            Cookie cookie = decodeCookie(value);
+            if (cookie != null)
+                msg.addCookie(cookie);
         }
 
-        if ( name.equalsIgnoreCase( HttpMessage.CONTENT_TYPE ) )
-        {
-            msg.setContentType( value );
+        if (name.equalsIgnoreCase(HttpMessage.CONTENT_TYPE)) {
+            msg.setContentType(value);
         }
 
-        if ( name.equalsIgnoreCase( HttpMessage.CONTENT_LENGTH ) )
-        {
-            msg.setContentLength( Integer.parseInt( value ) );
+        if (name.equalsIgnoreCase(HttpMessage.CONTENT_LENGTH)) {
+            msg.setContentLength(Integer.parseInt(value));
         }
 
-        if ( name.equalsIgnoreCase( TRANSFER_ENCODING ) && value != null && value.equalsIgnoreCase( CHUNKED ) )
-        {
-            msg.setChunked( true );
+        if (name.equalsIgnoreCase(TRANSFER_ENCODING) && value != null
+                && value.equalsIgnoreCase(CHUNKED)) {
+            msg.setChunked(true);
         }
 
     }
 
-
-    public int decodeSize( String line ) throws Exception
-    {
+    public int decodeSize(String line) throws Exception {
         String strippedLine = line.trim().toLowerCase();
-        for ( int i = 0; i < strippedLine.length(); i++ )
-        {
-            char ch = strippedLine.charAt( i );
+        for (int i = 0; i < strippedLine.length(); i++) {
+            char ch = strippedLine.charAt(i);
             //Once we hit a non-numeric character, parse the number we have
-            if ( ( ch < '0' || ( ch > '9' && ch < 'a' ) || ch > 'f' ) )
-            {
-                return Integer.parseInt( strippedLine.substring( 0, i ), 16 );
+            if ((ch < '0' || (ch > '9' && ch < 'a') || ch > 'f')) {
+                return Integer.parseInt(strippedLine.substring(0, i), 16);
             }
         }
 
         //We got here, so the entire line passes
-        return Integer.parseInt( strippedLine, 16 );
+        return Integer.parseInt(strippedLine, 16);
     }
 
-
-    public void decodeContent( ByteBuffer in, HttpResponseMessage msg ) throws Exception
-    {
+    public void decodeContent(ByteBuffer in, HttpResponseMessage msg)
+            throws Exception {
         byte content[] = new byte[msg.getContentLength()];
-        in.get( content );
-        msg.addContent( content );
+        in.get(content);
+        msg.addContent(content);
     }
 
-
-    public void decodeChunkedContent( ByteBuffer in, HttpResponseMessage msg ) throws Exception
-    {
+    public void decodeChunkedContent(ByteBuffer in, HttpResponseMessage msg)
+            throws Exception {
         int toRead = msg.getExpectedToRead();
-        if ( ( in.get( in.position() + toRead ) != CR ) && ( in.get( in.position() + toRead + 1 ) != LF ) )
-        {
-            throw new IOException( "Invalid HTTP response - chunk does not end with CRLF" );
+        if ((in.get(in.position() + toRead) != CR)
+                && (in.get(in.position() + toRead + 1) != LF)) {
+            throw new IOException(
+                    "Invalid HTTP response - chunk does not end with CRLF");
 
         }
         byte content[] = new byte[toRead];
-        in.get( content );
-        msg.addContent( content );
+        in.get(content);
+        msg.addContent(content);
 
         //Pop the CRLF
         in.get();
         in.get();
     }
 
-
-    public Cookie decodeCookie( String cookieStr ) throws Exception
-    {
+    public Cookie decodeCookie(String cookieStr) throws Exception {
 
         Cookie cookie = null;
 
-        String pairs[] = cookieStr.split( ";" );
-        for ( int i = 0; i < pairs.length; i++ )
-        {
-            String nameValue[] = pairs[i].trim().split( "=" );
+        String pairs[] = cookieStr.split(";");
+        for (int i = 0; i < pairs.length; i++) {
+            String nameValue[] = pairs[i].trim().split("=");
             String name = nameValue[0].trim();
 
             //First one is the cookie name/value pair
-            if ( i == 0 )
-            {
-                cookie = new Cookie( name, nameValue[1].trim() );
+            if (i == 0) {
+                cookie = new Cookie(name, nameValue[1].trim());
                 continue;
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_COMMENT ) )
-            {
-                cookie.setComment( nameValue[1].trim() );
+            if (name.equalsIgnoreCase(COOKIE_COMMENT)) {
+                cookie.setComment(nameValue[1].trim());
                 continue;
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_PATH ) )
-            {
-                cookie.setPath( nameValue[1].trim() );
+            if (name.equalsIgnoreCase(COOKIE_PATH)) {
+                cookie.setPath(nameValue[1].trim());
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_SECURE ) )
-            {
-                cookie.setSecure( true );
+            if (name.equalsIgnoreCase(COOKIE_SECURE)) {
+                cookie.setSecure(true);
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_VERSION ) )
-            {
-                cookie.setVersion( Integer.parseInt( nameValue[1] ) );
+            if (name.equalsIgnoreCase(COOKIE_VERSION)) {
+                cookie.setVersion(Integer.parseInt(nameValue[1]));
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_MAX_AGE ) )
-            {
-                int age = Integer.parseInt( nameValue[1] );
-                cookie.setExpires( new Date( System.currentTimeMillis() + age * 1000L ) );
+            if (name.equalsIgnoreCase(COOKIE_MAX_AGE)) {
+                int age = Integer.parseInt(nameValue[1]);
+                cookie.setExpires(new Date(System.currentTimeMillis() + age
+                        * 1000L));
             }
 
-            if ( name.equalsIgnoreCase( COOKIE_EXPIRES ) )
-            {
-                cookie.setExpires( DateUtil.parseDate( nameValue[1] ) );
+            if (name.equalsIgnoreCase(COOKIE_EXPIRES)) {
+                cookie.setExpires(DateUtil.parseDate(nameValue[1]));
             }
 
             if (name.equalsIgnoreCase(COOKIE_DOMAIN)) {

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpMessage.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpMessage.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpMessage.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpMessage.java Fri Sep 14 07:54:50 2007
@@ -19,122 +19,95 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-
-
 /**
  * TODO HttpMessage.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpMessage
-{
+public class HttpMessage {
 
     public final static String CONTENT_TYPE = "Content-Type";
+
     public final static String CONTENT_LENGTH = "Content-Length";
 
     protected List<NameValuePair> headers = new ArrayList<NameValuePair>();
+
     protected List<Cookie> cookies = new ArrayList<Cookie>();
+
     protected String contentType;
+
     protected int contentLength;
-    protected ByteArrayOutputStream content;
 
+    protected ByteArrayOutputStream content;
 
-    public String getStringContent()
-    {
-        if ( content == null )
+    public String getStringContent() {
+        if (content == null)
             return null;
 
-        return new String( content.toByteArray() );
+        return new String(content.toByteArray());
     }
 
-
-    public byte[] getContent()
-    {
-        if ( content == null )
+    public byte[] getContent() {
+        if (content == null)
             return null;
 
         return content.toByteArray();
     }
 
-
-    public void addContent( byte[] content ) throws IOException
-    {
-        if ( this.content == null )
+    public void addContent(byte[] content) throws IOException {
+        if (this.content == null)
             this.content = new ByteArrayOutputStream();
 
-        this.content.write( content );
+        this.content.write(content);
     }
 
-
-    public List<Cookie> getCookies()
-    {
+    public List<Cookie> getCookies() {
         return cookies;
     }
 
-
-    public void setCookies( List<Cookie> cookies )
-    {
+    public void setCookies(List<Cookie> cookies) {
         this.cookies = cookies;
     }
 
-
-    public void addCookie( Cookie cookie )
-    {
-        this.cookies.add( cookie );
+    public void addCookie(Cookie cookie) {
+        this.cookies.add(cookie);
     }
 
-
-    public List<NameValuePair> getHeaders()
-    {
+    public List<NameValuePair> getHeaders() {
         return headers;
     }
 
-
-    public void setHeaders( List<NameValuePair> headers )
-    {
+    public void setHeaders(List<NameValuePair> headers) {
         this.headers = headers;
     }
 
-
-    public void addHeader( NameValuePair header )
-    {
-        headers.add( header );
+    public void addHeader(NameValuePair header) {
+        headers.add(header);
     }
 
-
-    public void addHeader( String name, String value )
-    {
-        headers.add( new NameValuePair( name, value ) );
+    public void addHeader(String name, String value) {
+        headers.add(new NameValuePair(name, value));
     }
 
-
-    public String getContentType()
-    {
+    public String getContentType() {
         return contentType;
     }
 
-
-    public void setContentType( String contentType )
-    {
+    public void setContentType(String contentType) {
         this.contentType = contentType;
     }
 
-
-    public int getContentLength()
-    {
+    public int getContentLength() {
         return contentLength;
     }
 
-
-    public void setContentLength( int contentLength )
-    {
+    public void setContentLength(int contentLength) {
         this.contentLength = contentLength;
     }
 

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpProtocolCodecFactory.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpProtocolCodecFactory.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpProtocolCodecFactory.java Fri Sep 14 07:54:50 2007
@@ -19,42 +19,34 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.filter.codec.ProtocolDecoder;
 
 import java.net.URL;
 
-
 /**
  * TODO HttpProtocolCodecFactory.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpProtocolCodecFactory implements ProtocolCodecFactory
-{
+public class HttpProtocolCodecFactory implements ProtocolCodecFactory {
 
     private final ProtocolEncoder encoder;
-    private final ProtocolDecoder decoder;
 
+    private final ProtocolDecoder decoder;
 
-    public HttpProtocolCodecFactory( URL url )
-    {
-        encoder = new HttpRequestEncoder( url );
+    public HttpProtocolCodecFactory(URL url) {
+        encoder = new HttpRequestEncoder(url);
         decoder = new HttpResponseDecoder();
     }
 
-
-    public ProtocolEncoder getEncoder() throws Exception
-    {
+    public ProtocolEncoder getEncoder() throws Exception {
         return encoder;
     }
 
-
-    public ProtocolDecoder getDecoder() throws Exception
-    {
+    public ProtocolDecoder getDecoder() throws Exception {
         return decoder;
     }
 }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestEncoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestEncoder.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestEncoder.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestEncoder.java Fri Sep 14 07:54:50 2007
@@ -19,7 +19,6 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import java.net.URL;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
@@ -33,94 +32,89 @@
 import org.apache.mina.filter.codec.ProtocolEncoderAdapter;
 import org.apache.mina.filter.codec.ProtocolEncoderOutput;
 
-
 /**
  * TODO HttpRequestEncoder.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpRequestEncoder extends ProtocolEncoderAdapter
-{
-    private static final byte[] CRLF = new byte[]
-        { 0x0D, 0x0A };
+public class HttpRequestEncoder extends ProtocolEncoderAdapter {
+    private static final byte[] CRLF = new byte[] { 0x0D, 0x0A };
+
     private static final String POST_CONTENT_TYPE = "application/x-www-form-urlencoded";
+
     private URL url;
 
-    public HttpRequestEncoder( URL url )
-    {
+    public HttpRequestEncoder(URL url) {
         this.url = url;
     }
 
+    public void encode(IoSession ioSession, Object message,
+            ProtocolEncoderOutput out) throws Exception {
+        HttpRequestMessage msg = (HttpRequestMessage) message;
 
-    public void encode( IoSession ioSession, Object message, ProtocolEncoderOutput out ) throws Exception
-    {
-        HttpRequestMessage msg = ( HttpRequestMessage ) message;
-
-        ByteBuffer buf = ByteBuffer.allocate( 256 );
+        ByteBuffer buf = ByteBuffer.allocate(256);
 
         // Enable auto-expand for easier encoding
-        buf.setAutoExpand( true );
+        buf.setAutoExpand(true);
 
-        try
-        {
+        try {
             //If we have content, lets create the query string
             int attrCount = msg.getParameters().size();
             String urlAttrs = "";
-            if ( attrCount > 0 )
-            {
+            if (attrCount > 0) {
                 NameValuePair attrs[] = new NameValuePair[attrCount];
-                Set<Map.Entry<String, String>> set = msg.getParameters().entrySet();
+                Set<Map.Entry<String, String>> set = msg.getParameters()
+                        .entrySet();
                 int i = 0;
-                for ( Map.Entry<String, String> entry : set )
-                {
-                    attrs[i++] = new NameValuePair( entry.getKey(), entry.getValue() );
+                for (Map.Entry<String, String> entry : set) {
+                    attrs[i++] = new NameValuePair(entry.getKey(), entry
+                            .getValue());
                 }
-                urlAttrs = EncodingUtil.formUrlEncode( attrs, Charset.defaultCharset().toString() );
+                urlAttrs = EncodingUtil.formUrlEncode(attrs, Charset
+                        .defaultCharset().toString());
             }
 
             CharsetEncoder encoder = Charset.defaultCharset().newEncoder();
-            buf.putString( msg.getRequestMethod(), encoder );
-            buf.putString( " ", encoder );
-            buf.putString( msg.getPath(), encoder );
+            buf.putString(msg.getRequestMethod(), encoder);
+            buf.putString(" ", encoder);
+            buf.putString(msg.getPath(), encoder);
             //If its a GET, append the attributes
-            if ( msg.getRequestMethod().equals( HttpRequestMessage.REQUEST_GET ) && attrCount > 0 )
-            {
+            if (msg.getRequestMethod().equals(HttpRequestMessage.REQUEST_GET)
+                    && attrCount > 0) {
                 //If there is not already a ? in the query, append one, otherwise append a &
-                if ( !msg.getPath().contains( "?" ) )
-                {
-                    buf.putString( "?", encoder );
-                }
-                else
-                {
-                    buf.putString( "&", encoder );
+                if (!msg.getPath().contains("?")) {
+                    buf.putString("?", encoder);
+                } else {
+                    buf.putString("&", encoder);
                 }
-                buf.putString( urlAttrs, encoder );
+                buf.putString(urlAttrs, encoder);
             }
-            buf.putString( " HTTP/1.1", encoder );
-            buf.put( CRLF );
+            buf.putString(" HTTP/1.1", encoder);
+            buf.put(CRLF);
 
             //This header is required for HTTP/1.1
-            buf.putString( "Host: ", encoder );
-            buf.putString( url.getHost(), encoder );
-            if ((url.getProtocol().equals("http") && url.getPort() != 80 && url.getPort() != -1) &&
-                    (url.getProtocol().equals("https") && url.getPort() != 443 && url.getPort() != -1)) {
+            buf.putString("Host: ", encoder);
+            buf.putString(url.getHost(), encoder);
+            if ((url.getProtocol().equals("http") && url.getPort() != 80 && url
+                    .getPort() != -1)
+                    && (url.getProtocol().equals("https")
+                            && url.getPort() != 443 && url.getPort() != -1)) {
                 buf.putString(":", encoder);
                 buf.putString(url.getPort() + "", encoder);
             }
-            buf.put( CRLF );
+            buf.put(CRLF);
 
             //Process any headers we have
             List<NameValuePair> headers = msg.getHeaders();
-            for ( NameValuePair header : headers )
-            {
+            for (NameValuePair header : headers) {
                 String name = header.getName();
                 String value = header.getValue();
 
-                buf.putString( name, encoder );
-                buf.putString( ": ", encoder );
-                buf.putString( value, encoder );
-                buf.put( CRLF );
+                buf.putString(name, encoder);
+                buf.putString(": ", encoder);
+                buf.putString(value, encoder);
+                buf.put(CRLF);
             }
 
             //Process cookies
@@ -128,56 +122,49 @@
             //As that will be left up to the user.  A possible enhancement is to make use of a CookieManager
             //to handle these issues for the request
             List<Cookie> cookies = msg.getCookies();
-            if ( cookies.size() > 0 )
-            {
-                buf.putString( "Cookie: ", encoder );
-                for ( Cookie cookie : cookies )
-                {
+            if (cookies.size() > 0) {
+                buf.putString("Cookie: ", encoder);
+                for (Cookie cookie : cookies) {
                     String name = cookie.getName();
                     String value = cookie.getValue();
 
-                    buf.putString( name, encoder );
-                    buf.putString( "=", encoder );
-                    buf.putString( value, encoder );
-                    buf.putString( "; ", encoder );
+                    buf.putString(name, encoder);
+                    buf.putString("=", encoder);
+                    buf.putString(value, encoder);
+                    buf.putString("; ", encoder);
                 }
-                buf.put( CRLF );
+                buf.put(CRLF);
             }
 
             //If this is a POST, then we need a content length and type
-            if ( msg.getRequestMethod().equals( HttpRequestMessage.REQUEST_POST ) )
-            {
+            if (msg.getRequestMethod().equals(HttpRequestMessage.REQUEST_POST)) {
                 byte content[] = urlAttrs.getBytes();
 
                 //Type
-                buf.putString( HttpMessage.CONTENT_TYPE, encoder );
-                buf.putString( ": ", encoder );
-                buf.putString( POST_CONTENT_TYPE, encoder );
-                buf.put( CRLF );
+                buf.putString(HttpMessage.CONTENT_TYPE, encoder);
+                buf.putString(": ", encoder);
+                buf.putString(POST_CONTENT_TYPE, encoder);
+                buf.put(CRLF);
 
                 //Length
-                buf.putString( HttpMessage.CONTENT_LENGTH, encoder );
-                buf.putString( ": ", encoder );
-                buf.putString( content.length + "", encoder );
-                buf.put( CRLF );
+                buf.putString(HttpMessage.CONTENT_LENGTH, encoder);
+                buf.putString(": ", encoder);
+                buf.putString(content.length + "", encoder);
+                buf.put(CRLF);
                 //Blank line
-                buf.put( CRLF );
-                buf.put( content );
-            }
-            else
-            {
+                buf.put(CRLF);
+                buf.put(content);
+            } else {
                 //Blank line
-                buf.put( CRLF );
+                buf.put(CRLF);
             }
 
-        }
-        catch ( CharacterCodingException ex )
-        {
+        } catch (CharacterCodingException ex) {
             ex.printStackTrace();
         }
 
         buf.flip();
-        out.write( buf );
+        out.write(buf);
 
     }
 

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestMessage.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestMessage.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestMessage.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpRequestMessage.java Fri Sep 14 07:54:50 2007
@@ -19,95 +19,84 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import java.net.ProtocolException;
 import java.util.Map;
 import java.util.HashMap;
 
-
 /**
  * TODO HttpRequestMessage.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpRequestMessage extends HttpMessage
-{
+public class HttpRequestMessage extends HttpMessage {
 
     public static String REQUEST_GET = "GET";
+
     public static String REQUEST_POST = "POST";
+
     public static String REQUEST_HEAD = "HEAD";
+
     public static String REQUEST_OPTIONS = "OPTIONS";
+
     public static String REQUEST_PUT = "PUT";
+
     public static String REQUEST_DELETE = "DELETE";
+
     public static String REQUEST_TRACE = "TRACE";
 
     private String requestMethod = REQUEST_GET;
+
     private String path;
-    private Map<String, String> parameters = new HashMap<String, String>();
 
+    private Map<String, String> parameters = new HashMap<String, String>();
 
-    public HttpRequestMessage( String path )
-    {
+    public HttpRequestMessage(String path) {
         this.path = path;
     }
 
-
-    public String getRequestMethod()
-    {
+    public String getRequestMethod() {
         return requestMethod;
     }
 
-
-    public void setRequestMethod( String requestMethod ) throws ProtocolException
-    {
-        if ( requestMethod.equals( REQUEST_GET ) || requestMethod.equals( REQUEST_POST )
-            || requestMethod.equals( REQUEST_HEAD ) || requestMethod.equals( REQUEST_OPTIONS )
-            || requestMethod.equals( REQUEST_PUT ) || requestMethod.equals( REQUEST_DELETE )
-            || requestMethod.equals( REQUEST_TRACE ) )
-        {
+    public void setRequestMethod(String requestMethod) throws ProtocolException {
+        if (requestMethod.equals(REQUEST_GET)
+                || requestMethod.equals(REQUEST_POST)
+                || requestMethod.equals(REQUEST_HEAD)
+                || requestMethod.equals(REQUEST_OPTIONS)
+                || requestMethod.equals(REQUEST_PUT)
+                || requestMethod.equals(REQUEST_DELETE)
+                || requestMethod.equals(REQUEST_TRACE)) {
             this.requestMethod = requestMethod;
             return;
         }
 
-        throw new ProtocolException( "Invalid request method type." );
+        throw new ProtocolException("Invalid request method type.");
     }
 
-
-    public String getPath()
-    {
+    public String getPath() {
         return path;
     }
 
-
-    public void setPath( String path )
-    {
-        if ( path == null || path.trim().length() == 0 )
+    public void setPath(String path) {
+        if (path == null || path.trim().length() == 0)
             path = "/";
         this.path = path;
     }
 
-
-    public String getParameter( String name )
-    {
-        return parameters.get( name );
+    public String getParameter(String name) {
+        return parameters.get(name);
     }
 
-
-    public Map<String, String> getParameters()
-    {
+    public Map<String, String> getParameters() {
         return parameters;
     }
 
-
-    public void setParameters( Map<String, String> parameters )
-    {
-        this.parameters.putAll( parameters );
+    public void setParameters(Map<String, String> parameters) {
+        this.parameters.putAll(parameters);
     }
 
-
-    public void setParameter( String name, String value )
-    {
-        parameters.put( name, value );
+    public void setParameter(String name, String value) {
+        parameters.put(name, value);
     }
 }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseDecoder.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseDecoder.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseDecoder.java Fri Sep 14 07:54:50 2007
@@ -19,77 +19,64 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
 
-
 /**
  * TODO HttpResponseDecoder.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpResponseDecoder extends CumulativeProtocolDecoder
-{
+public class HttpResponseDecoder extends CumulativeProtocolDecoder {
 
     public final static String CURRENT_RESPONSE = "CURRENT_RESPONSE";
 
     private HttpDecoder httpDecoder = new HttpDecoder();
 
+    protected boolean doDecode(IoSession ioSession, ByteBuffer in,
+            ProtocolDecoderOutput out) throws Exception {
 
-    protected boolean doDecode( IoSession ioSession, ByteBuffer in, ProtocolDecoderOutput out ) throws Exception
-    {
-
-        HttpResponseMessage response = ( HttpResponseMessage ) ioSession.getAttribute( CURRENT_RESPONSE );
-        if ( response == null )
-        {
+        HttpResponseMessage response = (HttpResponseMessage) ioSession
+                .getAttribute(CURRENT_RESPONSE);
+        if (response == null) {
             response = new HttpResponseMessage();
-            ioSession.setAttribute( CURRENT_RESPONSE, response );
+            ioSession.setAttribute(CURRENT_RESPONSE, response);
         }
 
         //Test if we need the response...
-        if ( response.getState() == HttpResponseMessage.STATE_START )
-        {
+        if (response.getState() == HttpResponseMessage.STATE_START) {
 
-            if ( !processStatus( response, in ) )
-            {
+            if (!processStatus(response, in)) {
                 return false;
             }
 
             //Handle HTTP/1.1 100 Continue
-            if ( response.getStatusCode() == 100 )
-            {
-                response.setState( HttpResponseMessage.STATE_STATUS_CONTINUE );
-            }
-            else
-            {
-                response.setState( HttpResponseMessage.STATE_STATUS_READ );
+            if (response.getStatusCode() == 100) {
+                response.setState(HttpResponseMessage.STATE_STATUS_CONTINUE);
+            } else {
+                response.setState(HttpResponseMessage.STATE_STATUS_READ);
             }
         }
 
         //If we are in a 100 Continue, read until we get the real header
-        if ( response.getState() == HttpResponseMessage.STATE_STATUS_CONTINUE )
-        {
+        if (response.getState() == HttpResponseMessage.STATE_STATUS_CONTINUE) {
             //Continue reading until we get a blank line
-            while ( true )
-            {
-                String line = httpDecoder.decodeLine( in );
+            while (true) {
+                String line = httpDecoder.decodeLine(in);
 
                 //Check if the entire response has been read
-                if ( line == null )
+                if (line == null)
                     return false;
 
                 //Check if the entire response headers have been read
-                if ( line.length() == 0 )
-                {
-                    response.setState( HttpResponseMessage.STATE_STATUS_READ );
+                if (line.length() == 0) {
+                    response.setState(HttpResponseMessage.STATE_STATUS_READ);
 
                     //The next line should be a header
-                    if ( !processStatus( response, in ) )
-                    {
+                    if (!processStatus(response, in)) {
                         return false;
                     }
                     break;
@@ -98,100 +85,88 @@
         }
 
         //Are we reading headers?
-        if ( response.getState() == HttpResponseMessage.STATE_STATUS_READ )
-        {
-            if ( processHeaders( response, in ) == false )
+        if (response.getState() == HttpResponseMessage.STATE_STATUS_READ) {
+            if (processHeaders(response, in) == false)
                 return false;
         }
 
         //Are we reading content?
-        if ( response.getState() == HttpResponseMessage.STATE_HEADERS_READ )
-        {
-            if ( processContent( response, in ) == false )
+        if (response.getState() == HttpResponseMessage.STATE_HEADERS_READ) {
+            if (processContent(response, in) == false)
                 return false;
         }
 
         //If we are chunked and we have read all the content, then read the footers if there are any
-        if ( response.isChunked() && response.getState() == HttpResponseMessage.STATE_CONTENT_READ )
-        {
-            if ( processFooters( response, in ) == false )
+        if (response.isChunked()
+                && response.getState() == HttpResponseMessage.STATE_CONTENT_READ) {
+            if (processFooters(response, in) == false)
                 return false;
         }
 
-        response.setState( HttpResponseMessage.STATE_FINISHED );
+        response.setState(HttpResponseMessage.STATE_FINISHED);
 
-        out.write( response );
+        out.write(response);
 
-        ioSession.removeAttribute( CURRENT_RESPONSE );
+        ioSession.removeAttribute(CURRENT_RESPONSE);
 
         return true;
     }
 
-
-    private boolean processHeaders( HttpResponseMessage response, ByteBuffer in ) throws Exception
-    {
-        if ( !findHeaders( response, in ) )
+    private boolean processHeaders(HttpResponseMessage response, ByteBuffer in)
+            throws Exception {
+        if (!findHeaders(response, in))
             return false;
 
-        response.setState( HttpResponseMessage.STATE_HEADERS_READ );
+        response.setState(HttpResponseMessage.STATE_HEADERS_READ);
         return true;
     }
 
-
-    private boolean processFooters( HttpResponseMessage response, ByteBuffer in ) throws Exception
-    {
-        if ( !findHeaders( response, in ) )
+    private boolean processFooters(HttpResponseMessage response, ByteBuffer in)
+            throws Exception {
+        if (!findHeaders(response, in))
             return false;
 
-        response.setState( HttpResponseMessage.STATE_FOOTERS_READ );
+        response.setState(HttpResponseMessage.STATE_FOOTERS_READ);
         return true;
     }
 
-
-    private boolean findHeaders( HttpResponseMessage response, ByteBuffer in ) throws Exception
-    {
+    private boolean findHeaders(HttpResponseMessage response, ByteBuffer in)
+            throws Exception {
         //Read the headers and process them
-        while ( true )
-        {
-            String line = httpDecoder.decodeLine( in );
+        while (true) {
+            String line = httpDecoder.decodeLine(in);
 
             //Check if the entire response has been read
-            if ( line == null )
+            if (line == null)
                 return false;
 
             //Check if the entire response headers have been read
-            if ( line.length() == 0 )
-            {
+            if (line.length() == 0) {
                 break;
             }
 
-            httpDecoder.decodeHeader( line, response );
+            httpDecoder.decodeHeader(line, response);
         }
         return true;
     }
 
-
-    private boolean processContent( HttpResponseMessage response, ByteBuffer in ) throws Exception
-    {
-        if ( response.isChunked() )
-        {
-            while ( true )
-            {
+    private boolean processContent(HttpResponseMessage response, ByteBuffer in)
+            throws Exception {
+        if (response.isChunked()) {
+            while (true) {
                 //Check what kind of record we are reading (content or size)
-                if ( response.getExpectedToRead() == HttpResponseMessage.EXPECTED_NOT_READ )
-                {
+                if (response.getExpectedToRead() == HttpResponseMessage.EXPECTED_NOT_READ) {
                     //We haven't read the size, so we are expecting a size
-                    String line = httpDecoder.decodeLine( in );
+                    String line = httpDecoder.decodeLine(in);
 
                     //Check if the entire line has been read
-                    if ( line == null )
+                    if (line == null)
                         return false;
 
-                    response.setExpectedToRead( httpDecoder.decodeSize( line ) );
+                    response.setExpectedToRead(httpDecoder.decodeSize(line));
 
                     //Are we done reading the chunked content? (A zero means we are done)
-                    if ( response.getExpectedToRead() == 0 )
-                    {
+                    if (response.getExpectedToRead() == 0) {
                         break;
                     }
                 }
@@ -199,43 +174,40 @@
                 //Now read the content chunk
 
                 //Be sure all of the data is there for us to retrieve + the CRLF...
-                if ( response.getExpectedToRead() + 2 > in.remaining() )
-                {
+                if (response.getExpectedToRead() + 2 > in.remaining()) {
                     //Need more data
                     return false;
                 }
 
                 //Read the content
-                httpDecoder.decodeChunkedContent( in, response );
+                httpDecoder.decodeChunkedContent(in, response);
 
                 //Flag that it's time to read a size record
-                response.setExpectedToRead( HttpResponseMessage.EXPECTED_NOT_READ );
+                response
+                        .setExpectedToRead(HttpResponseMessage.EXPECTED_NOT_READ);
 
             }
 
-        }
-        else if ( response.getContentLength() > 0 )
-        {
+        } else if (response.getContentLength() > 0) {
             //Do we have enough data?
-            if ( ( response.getContentLength() ) > in.remaining() )
+            if ((response.getContentLength()) > in.remaining())
                 return false;
-            httpDecoder.decodeContent( in, response );
+            httpDecoder.decodeContent(in, response);
         }
 
-        response.setState( HttpResponseMessage.STATE_CONTENT_READ );
+        response.setState(HttpResponseMessage.STATE_CONTENT_READ);
 
         return true;
     }
 
-
-    private boolean processStatus( HttpResponseMessage response, ByteBuffer in ) throws Exception
-    {
+    private boolean processStatus(HttpResponseMessage response, ByteBuffer in)
+            throws Exception {
         //Read the status header
-        String header = httpDecoder.decodeLine( in );
-        if ( header == null )
+        String header = httpDecoder.decodeLine(in);
+        if (header == null)
             return false;
 
-        httpDecoder.decodeStatus( header, response );
+        httpDecoder.decodeStatus(header, response);
 
         return true;
     }

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseMessage.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseMessage.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseMessage.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/HttpResponseMessage.java Fri Sep 14 07:54:50 2007
@@ -19,90 +19,77 @@
  */
 package org.apache.mina.filter.codec.http;
 
-
 /**
  * TODO HttpResponseMessage.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HttpResponseMessage extends HttpMessage
-{
+public class HttpResponseMessage extends HttpMessage {
 
     static final int EXPECTED_NOT_READ = -1;
 
     static final int STATE_START = 0;
+
     static final int STATE_STATUS_CONTINUE = 1;
+
     static final int STATE_STATUS_READ = 2;
+
     static final int STATE_HEADERS_READ = 3;
+
     static final int STATE_CONTENT_READ = 4;
+
     static final int STATE_FOOTERS_READ = 5;
+
     static final int STATE_FINISHED = 6;
 
     private int statusCode;
+
     private String statusMessage;
 
     private boolean chunked = false;
+
     private int expectedToRead = -1;
-    private int state = STATE_START;
 
+    private int state = STATE_START;
 
-    public int getStatusCode()
-    {
+    public int getStatusCode() {
         return statusCode;
     }
 
-
-    public void setStatusCode( int statusCode )
-    {
+    public void setStatusCode(int statusCode) {
         this.statusCode = statusCode;
     }
 
-
-    public String getStatusMessage()
-    {
+    public String getStatusMessage() {
         return statusMessage;
     }
 
-
-    public void setStatusMessage( String statusMessage )
-    {
+    public void setStatusMessage(String statusMessage) {
         this.statusMessage = statusMessage;
     }
 
-
-    boolean isChunked()
-    {
+    boolean isChunked() {
         return chunked;
     }
 
-
-    void setChunked( boolean chunked )
-    {
+    void setChunked(boolean chunked) {
         this.chunked = chunked;
     }
 
-
-    int getExpectedToRead()
-    {
+    int getExpectedToRead() {
         return expectedToRead;
     }
 
-
-    void setExpectedToRead( int expectedToRead )
-    {
+    void setExpectedToRead(int expectedToRead) {
         this.expectedToRead = expectedToRead;
     }
 
-
-    int getState()
-    {
+    int getState() {
         return state;
     }
 
-
-    void setState( int state )
-    {
+    void setState(int state) {
         this.state = state;
     }
 

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/LangUtils.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/LangUtils.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/LangUtils.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/LangUtils.java Fri Sep 14 07:54:50 2007
@@ -29,6 +29,7 @@
 class LangUtils {
 
     public static final int HASH_SEED = 17;
+
     public static final int HASH_OFFSET = 37;
 
     private LangUtils() {
@@ -52,4 +53,3 @@
     }
 
 }
-

Modified: mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/NameValuePair.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/NameValuePair.java?rev=575711&r1=575710&r2=575711&view=diff
==============================================================================
--- mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/NameValuePair.java (original)
+++ mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/NameValuePair.java Fri Sep 14 07:54:50 2007
@@ -21,11 +21,10 @@
 
 import java.io.Serializable;
 
-
-public class NameValuePair  implements Serializable {
+public class NameValuePair implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    
+
     // ----------------------------------------------------------- Constructors
 
     /**
@@ -33,7 +32,7 @@
      *
      */
     public NameValuePair() {
-        this (null, null);
+        this(null, null);
     }
 
     /**
@@ -70,7 +69,6 @@
         this.name = name;
     }
 
-
     /**
      * Return the name.
      *
@@ -81,7 +79,6 @@
         return name;
     }
 
-
     /**
      * Set the value.
      *
@@ -91,7 +88,6 @@
         this.value = value;
     }
 
-
     /**
      * Return the current value.
      *
@@ -112,12 +108,14 @@
     }
 
     public boolean equals(final Object object) {
-        if (object == null) return false;
-        if (this == object) return true;
+        if (object == null)
+            return false;
+        if (this == object)
+            return true;
         if (object instanceof NameValuePair) {
             NameValuePair that = (NameValuePair) object;
             return LangUtils.equals(this.name, that.name)
-                  && LangUtils.equals(this.value, that.value);
+                    && LangUtils.equals(this.value, that.value);
         } else {
             return false;
         }
@@ -130,4 +128,3 @@
         return hash;
     }
 }
-