You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by kg...@apache.org on 2011/12/06 08:49:43 UTC
svn commit: r1210810 - in
/felix/trunk/httplite/src/main/java/org/apache/felix/httplite:
server/Connection.java server/ThreadPool.java
servlet/HttpServletResponseImpl.java servlet/ServletContextImpl.java
servlet/ServletPrintWriter.java
Author: kgilmer
Date: Tue Dec 6 07:49:43 2011
New Revision: 1210810
URL: http://svn.apache.org/viewvc?rev=1210810&view=rev
Log:
httplite: cleanup and correct javadoc comments.
Modified:
felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java
felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/ThreadPool.java
felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/HttpServletResponseImpl.java
felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletContextImpl.java
felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletPrintWriter.java
Modified: felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java?rev=1210810&r1=1210809&r2=1210810&view=diff
==============================================================================
--- felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java (original)
+++ felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java Tue Dec 6 07:49:43 2011
@@ -43,7 +43,13 @@ import org.apache.felix.httplite.servlet
**/
public class Connection
{
+ /**
+ * Connection timeout
+ */
public static final int DEFAULT_CONNECTION_TIMEOUT = 10000;
+ /**
+ * Requests per request
+ */
public static final int DEFAULT_CONNECTION_REQUESTLIMIT = 50;
private final Socket m_socket;
@@ -70,11 +76,11 @@ public class Connection
/**
* Constructs a connection with the specified inactivity timeout and request limit.
- * @param server The web server associated with the connection.
* @param socket The client socket.
* @param timeout The inactivity timeout of the connection in milliseconds.
* @param requestLimit The maximum number of consecutive requests.
* @param resolver resolves a request URI to a client or servlet registration via the HTTP Service.
+ * @param logger logger instance.
* @throws java.io.IOException If any I/O error occurs.
*/
public Connection(final Socket socket, final int timeout, final int requestLimit, final ServiceRegistrationResolver resolver, final Logger logger) throws IOException
@@ -169,7 +175,7 @@ public class Connection
}
m_requestCount++;
- // Keep track of whether we have errored or not,
+ // Keep track of whether we have failed or not,
// because we still want to read the bytes to clear
// the input stream so we can service more requests.
boolean error = false;
@@ -207,8 +213,8 @@ public class Connection
response.setConnectionType("close");
}
- // We only service GET and/or HEAD requests, so send
- // a "not implemented" error otherwise.
+ // We do not support OPTIONS method so send
+ // a "not implemented" error in that case.
if (!HttpServletRequestImpl.isSupportedMethod(request.getMethod()))
{
error = true;
@@ -216,7 +222,7 @@ public class Connection
response.sendNotImplementedResponse();
}
- // Ignore if we have already errored, otherwise send error message
+ // Ignore if we have already failed, otherwise send error message
// if an HTTP/1.1 client did not include HOST header.
if (!error && request.getProtocol().equals(HttpConstants.HTTP11_VERSION)
&& (request.getHeader(HttpConstants.HOST_HEADER) == null))
Modified: felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/ThreadPool.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/ThreadPool.java?rev=1210810&r1=1210809&r2=1210810&view=diff
==============================================================================
--- felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/ThreadPool.java (original)
+++ felix/trunk/httplite/src/main/java/org/apache/felix/httplite/server/ThreadPool.java Tue Dec 6 07:49:43 2011
@@ -34,23 +34,27 @@ import org.apache.felix.httplite.osgi.Lo
**/
public class ThreadPool
{
+ /**
+ * Default thread timeout
+ */
public static final int DEFAULT_THREAD_TIMEOUT = 60000;
- private int m_threadTimeout;
+ private final int m_threadTimeout;
- private ThreadGroup m_group = new ThreadGroup("ThreadPoolGroup");
+ private final ThreadGroup m_group = new ThreadGroup("ThreadPoolGroup");
private int m_state;
private ThreadGate m_shutdownGate;
private int m_threadName = 0;
private int m_threadLimit = 0;
private int m_threadCount = 0;
private int m_threadAvailable = 0;
- private List m_connectionList = new ArrayList();
+ private final List m_connectionList = new ArrayList();
private final Logger m_logger;
/**
* Constructs a thread pool with the specified thread limit and with
* the default inactivity timeout.
* @param threadLimit The maximum number of threads in the pool.
+ * @param logger Logger instance.
**/
public ThreadPool(final int threadLimit, final Logger logger)
{
@@ -62,6 +66,7 @@ public class ThreadPool
* timeout.
* @param threadLimit The maximum number of threads in the pool.
* @param threadTimeout The inactivity timeout for threads in milliseconds.
+ * @param logger Logger instance.
**/
public ThreadPool(int threadLimit, int threadTimeout, Logger logger)
{
Modified: felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/HttpServletResponseImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/HttpServletResponseImpl.java?rev=1210810&r1=1210809&r2=1210810&view=diff
==============================================================================
--- felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/HttpServletResponseImpl.java (original)
+++ felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/HttpServletResponseImpl.java Tue Dec 6 07:49:43 2011
@@ -68,8 +68,7 @@ public class HttpServletResponseImpl imp
/**
* Constructs an HTTP response for the specified server and request.
- * @param server The web server associated with the response.
- * @param request The HTTP request associated with the response.
+ * @param outputStream The output stream for the client.
**/
public HttpServletResponseImpl(OutputStream outputStream)
{
@@ -652,6 +651,7 @@ public class HttpServletResponseImpl imp
* Build a response given input parameters.
*
* @param code HTTP code
+ * @param headers Map of HTTP headers
* @param userMessage user message
* @param htmlStartTag custom HTML document start
* @return byte array of response.
Modified: felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletContextImpl.java?rev=1210810&r1=1210809&r2=1210810&view=diff
==============================================================================
--- felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletContextImpl.java (original)
+++ felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletContextImpl.java Tue Dec 6 07:49:43 2011
@@ -292,6 +292,9 @@ public class ServletContextImpl implemen
/* (non-Javadoc)
* @see javax.servlet.ServletContext#getContextPath()
*/
+ /**
+ * @return the context path.
+ */
public String getContextPath() {
return m_name;
}
Modified: felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletPrintWriter.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletPrintWriter.java?rev=1210810&r1=1210809&r2=1210810&view=diff
==============================================================================
--- felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletPrintWriter.java (original)
+++ felix/trunk/httplite/src/main/java/org/apache/felix/httplite/servlet/ServletPrintWriter.java Tue Dec 6 07:49:43 2011
@@ -34,7 +34,7 @@ public class ServletPrintWriter extends
/**
* @param outputStream OutputStream
* @param characterEncoding character encoding
- * @throws UnknownCharacterException if the character encoding is not supported.
+ * @throws CharConversionException if the character encoding is not supported.
*/
public ServletPrintWriter(OutputStream outputStream, String characterEncoding) throws CharConversionException
{