You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jg...@apache.org on 2007/09/25 23:41:15 UTC
svn commit: r579396 - in
/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc:
codec/Cookie.java codec/HttpDecoder.java codec/package.html ssl/package.html
Author: jgenender
Date: Tue Sep 25 14:41:15 2007
New Revision: 579396
URL: http://svn.apache.org/viewvc?rev=579396&view=rev
Log:
Some more javadoc
Added:
geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/package.html
Modified:
geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/Cookie.java
geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpDecoder.java
geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/ssl/package.html
Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/Cookie.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/Cookie.java?rev=579396&r1=579395&r2=579396&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/Cookie.java (original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/Cookie.java Tue Sep 25 14:41:15 2007
@@ -27,18 +27,33 @@
*/
public class Cookie {
+ /** The comment. */
private String comment;
+
+ /** The domain. */
private String domain;
+
+ /** The name. */
private String name;
+
+ /** The value. */
private String value;
+
+ /** The path. */
private String path;
+
+ /** The secure. */
private boolean secure;
+
+ /** The version. */
private int version;
+
+ /** The expires. */
private Date expires;
/**
* Constructs a cookie identified by a name and value.
- *
+ *
* @param name the cookie name
* @param value the cookie value
*/
@@ -49,6 +64,7 @@
/**
* Returns a cookie's comment or <code>null</code> if no comment exists.
+ *
* @return The cookie comment
*/
public String getComment() {
@@ -57,6 +73,7 @@
/**
* Sets a comment which describes the cookie.
+ *
* @param comment the comment to set
*/
public void setComment(String comment) {
@@ -65,6 +82,7 @@
/**
* Returns a cookie's domain is one is available or <code>null</code> if it does not exist.
+ *
* @return the cookie's domain.
*/
public String getDomain() {
@@ -72,7 +90,8 @@
}
/**
- * Sets a cookie's domain as specified by RFC 2109
+ * Sets a cookie's domain as specified by RFC 2109.
+ *
* @param domain the cookie's domain to set
*/
public void setDomain(String domain) {
@@ -81,7 +100,8 @@
/**
- * Returns the name of the cookie
+ * Returns the name of the cookie.
+ *
* @return the name of the cookie
*/
public String getName() {
@@ -89,7 +109,8 @@
}
/**
- * Sets the name of the cookie
+ * Sets the name of the cookie.
+ *
* @param name the name of the cookie
*/
public void setName(String name) {
@@ -97,7 +118,8 @@
}
/**
- * Returns the cookie's value
+ * Returns the cookie's value.
+ *
* @return the cookie's value
*/
public String getValue() {
@@ -105,7 +127,8 @@
}
/**
- * Sets the cookie's value
+ * Sets the cookie's value.
+ *
* @param value the cookie value
*/
public void setValue(String value) {
@@ -114,6 +137,7 @@
/**
* Returns the cookie path. The path represents all paths, and sub-paths that this cookie is valid.
+ *
* @return the cookie path
*/
public String getPath() {
@@ -122,32 +146,63 @@
/**
* Set the cookie's path. The path represents all paths, and sub-paths that this cookie is valid.
+ *
* @param path the cookie path
*/
public void setPath(String path) {
this.path = path;
}
+ /**
+ * Returns if the cookie is secure.
+ *
+ * @return true, if is secure
+ */
public boolean isSecure() {
return secure;
}
+ /**
+ * Sets the cookie secure flag.
+ *
+ * @param secure the new secure value (<code>true</code>/<code>false</code>)
+ */
public void setSecure(boolean secure) {
this.secure = secure;
}
+ /**
+ * Gets the cookie version.
+ *
+ * @return the cookie version
+ */
public int getVersion() {
return version;
}
+ /**
+ * Sets the cookie version.
+ *
+ * @param version the cookie version
+ */
public void setVersion(int version) {
this.version = version;
}
+ /**
+ * Gets the cookie expiration <code>Date</code>.
+ *
+ * @return the expiration <code>Date</code>
+ */
public Date getExpires() {
return expires;
}
+ /**
+ * Sets the cookie expiration <code>Date</code>.
+ *
+ * @param expires the new expiration <code>Date</code>
+ */
public void setExpires(Date expires) {
this.expires = expires;
}
Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpDecoder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpDecoder.java?rev=579396&r1=579395&r2=579396&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpDecoder.java (original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpDecoder.java Tue Sep 25 14:41:15 2007
@@ -28,44 +28,63 @@
import org.apache.mina.common.ByteBuffer;
/**
- * Utility class for helping to decode the HTTP Protocol
+ * Utility class for helping to decode the HTTP Protocol.
*/
public class HttpDecoder {
+ /** The Constant CHUNKED. */
public static final String CHUNKED = "chunked";
+ /** The Constant CONNECTION. */
public static final String CONNECTION = "Connection";
+ /** The Constant COOKIE_COMMENT. */
public static final String COOKIE_COMMENT = "comment";
+
+ /** The Constant COOKIE_DOMAIN. */
public static final String COOKIE_DOMAIN = "domain";
+
+ /** The Constant COOKIE_EXPIRES. */
public static final String COOKIE_EXPIRES = "expires";
+
+ /** The Constant COOKIE_MAX_AGE. */
public static final String COOKIE_MAX_AGE = "max-age";
+
+ /** The Constant COOKIE_PATH. */
public static final String COOKIE_PATH = "path";
+
+ /** The Constant COOKIE_SECURE. */
public static final String COOKIE_SECURE = "secure";
+
+ /** The Constant COOKIE_VERSION. */
public static final String COOKIE_VERSION = "version";
+ /** The Constant LOCATION. */
public static final String LOCATION = "Location";
+
+ /** The Constant SET_COOKIE. */
public static final String SET_COOKIE = "Set-Cookie";
+
+ /** The Constant TRANSFER_ENCODING. */
public static final String TRANSFER_ENCODING = "Transfer-Encoding";
- /**
- * Carriage return character
- */
+ /** Carriage return character. */
private static final byte CR = 13;
- /**
- * Line feed character
- */
+ /** Line feed character. */
private static final byte LF = 10;
+ /** The decoder. */
private CharsetDecoder decoder = Charset.defaultCharset().newDecoder();
/**
- * Finds a line from a ByteBuffer that ends with a CR/LF and returns the line as a String
- *
+ * Finds a line from a ByteBuffer that ends with a CR/LF and returns the line as a String.
+ *
* @param in ByteBuffer containing data
+ *
* @return a <code>String</code> representing the decoded line
+ *
* @throws Exception for any Exception that is encountered
*/
public String decodeLine(ByteBuffer in) throws Exception {
@@ -106,10 +125,13 @@
/**
* Decodes the status code and message from a HTTP response and places the values in a
- * <code>HttpResponseMessage</code> object.
+ * {@link HttpResponseMessage} object.
+ *
* @param line <code>String</code> containing <code>HTTP/1.<i>X</i> <i>Message</i></code>
* @param msg the <code>HttpResponseMessage</code> for which to place the result
+ *
* @throws Exception on any Exception that may occur
+ *
* @see HttpResponseMessage
*/
public void decodeStatus(String line, HttpResponseMessage msg) throws Exception {
@@ -123,6 +145,14 @@
msg.setStatusMessage(line.substring(13));
}
+ /**
+ * Decodes headers and footers (for HTTP/1.1) and stuffs them into a {@link HttpResponseMessage} response.
+ *
+ * @param line the <code>String</code> line containing the header or footer
+ * @param msg the {@link HttpResponseMessage} response message
+ *
+ * @throws Exception if any exception occurs
+ */
public void decodeHeader(String line, HttpResponseMessage msg) throws Exception {
int pos = line.indexOf(": ");
String name = line.substring(0, pos);
@@ -158,6 +188,15 @@
}
+ /**
+ * Decodes size records for chunked HTTP transcoding.
+ *
+ * @param line the line containing the size
+ *
+ * @return the <code>int</code> representing the size
+ *
+ * @throws Exception if any exception occurs
+ */
public int decodeSize(String line) throws Exception {
String strippedLine = line.trim().toLowerCase();
for (int i = 0; i < strippedLine.length(); i++) {
@@ -172,12 +211,28 @@
return Integer.parseInt(strippedLine, 16);
}
+ /**
+ * Decodes content from non-chunked transcoding.
+ *
+ * @param in the <code>ByteBuffer</code> containing the content at the the current position
+ * @param msg the <code>HttpResponseMessage</code> message to place the decoded content
+ *
+ * @throws Exception if any exception occurs
+ */
public void decodeContent(ByteBuffer in, HttpResponseMessage msg) throws Exception {
byte content[] = new byte[msg.getContentLength()];
in.get(content);
msg.addContent(content);
}
+ /**
+ * Decodes content from chunked transcoding.
+ *
+ * @param in the <code>ByteBuffer</code> containing the content at the the current position
+ * @param msg the <code>HttpResponseMessage</code> message to place the decoded content
+ *
+ * @throws Exception if any exception occurs
+ */
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)) {
@@ -193,6 +248,16 @@
in.get();
}
+ /**
+ * Decodes a cookie header and returns the decoded cookie.
+ *
+ * @param cookieStr the cookie <code>String</code> header line
+ *
+ * @return the decoded <code>Cookie</cookie>
+ *
+ * @throws Exception if any exception occurs
+ * @see Cookie
+ */
public Cookie decodeCookie(String cookieStr) throws Exception {
Cookie cookie = null;
Added: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/package.html
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/package.html?rev=579396&view=auto
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/package.html (added)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/package.html Tue Sep 25 14:41:15 2007
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+</head>
+<body bgcolor="white">
+Contains the classes that support messages, encoding, and decoding the HTTP protocol.
+</body>
+</html>
Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/ssl/package.html
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/ssl/package.html?rev=579396&r1=579395&r2=579396&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/ssl/package.html (original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/ssl/package.html Tue Sep 25 14:41:15 2007
@@ -21,6 +21,6 @@
-->
</head>
<body bgcolor="white">
-<h2>SSL utility classes.</h2>
+SSL utility classes.
</body>
</html>