You are viewing a plain text version of this content. The canonical link for it is here.
Posted to awf-commits@incubator.apache.org by jm...@apache.org on 2011/09/26 22:41:37 UTC
svn commit: r1176107 - in
/incubator/deft/trunk/src/main/java/org/apache/deft: io/ io/buffer/ web/
web/handler/ web/http/
Author: jmeehan
Date: Mon Sep 26 22:41:36 2011
New Revision: 1176107
URL: http://svn.apache.org/viewvc?rev=1176107&view=rev
Log:
DEFT-166 - Tidied Javadoc for problems reported during build, to reduce noise.
Modified:
incubator/deft/trunk/src/main/java/org/apache/deft/io/AsynchronousSocket.java
incubator/deft/trunk/src/main/java/org/apache/deft/io/IOLoop.java
incubator/deft/trunk/src/main/java/org/apache/deft/io/buffer/DynamicByteBuffer.java
incubator/deft/trunk/src/main/java/org/apache/deft/web/HttpServer.java
incubator/deft/trunk/src/main/java/org/apache/deft/web/handler/RequestHandler.java
incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpRequest.java
incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponse.java
incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponseImpl.java
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/io/AsynchronousSocket.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/io/AsynchronousSocket.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/io/AsynchronousSocket.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/io/AsynchronousSocket.java Mon Sep 26 22:41:36 2011
@@ -74,11 +74,11 @@ public class AsynchronousSocket implemen
* <p>
* Support for three non-blocking asynchronous methods that take callbacks:
* <p>
- * {@link #readUntil(String, AsyncResult)}
+ * {@link #readUntil(byte[], AsyncResult)}
* <p>
* {@link #readBytes(int, AsyncResult)} and
* <p>
- * {@link #write(String, AsyncCallback)}
+ * {@link #write(byte[], AsyncCallback)}
* <p>
* The {@link SelectableChannel} should be the result of either
* {@link SocketChannel#open()} (client operations, connected or
@@ -356,7 +356,7 @@ public class AsynchronousSocket implemen
writeBuffer.flip(); // prepare for write
written = channel.write(writeBuffer.getByteBuffer());
// make room for more data be "read" in
- writeBuffer.compact();
+ writeBuffer.compact();
}
} catch (IOException e) {
logger.error("IOException during write: {}", e.getMessage());
@@ -374,4 +374,4 @@ public class AsynchronousSocket implemen
}
}
-}
\ No newline at end of file
+}
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/io/IOLoop.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/io/IOLoop.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/io/IOLoop.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/io/IOLoop.java Mon Sep 26 22:41:36 2011
@@ -234,8 +234,9 @@ public class IOLoop implements IOLoopMXB
}
/**
- * Checks wether this IOLoop is running or not
- * @return
+ * Checks whether this IOLoop is running or not.
+ *
+ * @return <code>true</code> if running; <code>false</code> otherwise.
*/
public boolean isRunning() {
return running;
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/io/buffer/DynamicByteBuffer.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/io/buffer/DynamicByteBuffer.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/io/buffer/DynamicByteBuffer.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/io/buffer/DynamicByteBuffer.java Mon Sep 26 22:41:36 2011
@@ -37,7 +37,7 @@ public class DynamicByteBuffer {
}
/**
- * Allocate a new {@code DynamicByteBuffer} that will be using a {@ByteBuffer} internally.
+ * Allocate a new {@code DynamicByteBuffer} that will be using a {@code ByteBuffer} internally.
* @param capacity initial capacity
*/
public static DynamicByteBuffer allocate(int capacity) {
@@ -110,8 +110,8 @@ public class DynamicByteBuffer {
}
/**
- * Returns the {@code ByteBuffer} that is used internally by this {@DynamicByteBufer}.
- * Changes made to the returned {@code ByteBuffer} will be incur modifications in this {@DynamicByteBufer}.
+ * Returns the {@code ByteBuffer} that is used internally by this {@code DynamicByteBufer}.
+ * Changes made to the returned {@code ByteBuffer} will be incur modifications in this {@code DynamicByteBufer}.
*/
public ByteBuffer getByteBuffer() {
return backend;
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/web/HttpServer.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/web/HttpServer.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/web/HttpServer.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/web/HttpServer.java Mon Sep 26 22:41:36 2011
@@ -49,13 +49,12 @@ public class HttpServer {
private final Application application;
-
public HttpServer(Configuration configuration) {
application = createApplication(configuration.getHandlerPackage());
application.setStaticContentDir(configuration.getStaticDirectory());
application.setConfiguration(configuration);
-
+
}
protected Application createApplication(String packageName) {
@@ -69,8 +68,6 @@ public class HttpServer {
* {@link #bind(int)} then {@link #start(int)} instead of
* {@link #listen(int)} (listen starts Deft http server on a single thread
* with the default IOLoop instance: {@code IOLoop.INSTANCE}).
- *
- * @return this for chaining purposes
*/
public void listen(int port) {
bind(port);
@@ -129,16 +126,16 @@ public class HttpServer {
}
/**
- * Unbinds the port and shutdown the HTTP server
- * using a callback to execute the stop from the IOLoop thread
- *
+ * Unbinds the port and shutdown the HTTP server using a callback to execute
+ * the stop from the IOLoop thread
+ *
*/
public void stop() {
logger.debug("Stopping HTTP server");
final CountDownLatch loopsLatch = new CountDownLatch(ioLoops.size());
for (final IOLoop ioLoop : ioLoops) {
// Use a callback to stop the loops from theire Threads
- ioLoop.addCallback(new AsyncCallback(){
+ ioLoop.addCallback(new AsyncCallback() {
@Override
public void onCallback() {
Closeables.closeQuietly(ioLoop, serverChannel);
@@ -150,7 +147,7 @@ public class HttpServer {
try {
loopsLatch.await();
} catch (InterruptedException e) {
- logger.error("Interrupted while waiting for all IOLoop to stop",e);
+ logger.error("Interrupted while waiting for all IOLoop to stop", e);
}
}
@@ -160,10 +157,11 @@ public class HttpServer {
}
/**
- * Added for test purpose
- * @return
+ * Added for test purposes.
+ *
+ * @return a <code>List</code> of current <code>IOLoop</code>s.
*/
- protected List<IOLoop> getIoLoops(){
+ protected List<IOLoop> getIoLoops() {
return ioLoops;
}
}
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/web/handler/RequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/web/handler/RequestHandler.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/web/handler/RequestHandler.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/web/handler/RequestHandler.java Mon Sep 26 22:41:36 2011
@@ -97,7 +97,7 @@ public abstract class RequestHandler imp
return null;
}
- /** @{inheritDoc */
+ /** {@inheritDoc} */
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpRequest.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpRequest.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpRequest.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpRequest.java Mon Sep 26 22:41:36 2011
@@ -39,7 +39,7 @@ public interface HttpRequest {
* GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
* </pre>
*
- * @return
+ * @return the current request line.
*/
public String getRequestLine();
@@ -134,21 +134,21 @@ public interface HttpRequest {
/**
* The TCP port of the client which issued this request.
*
- * @return
+ * @return the remote port number.
*/
public int getRemotePort();
/**
* The address of the server which received this request.
*
- * @return
+ * @return an <code>InetAddress</code> representing the server address.
*/
public InetAddress getServerHost();
/**
* The TCP port of the server which received this request.
*
- * @return
+ * @return the server port number.
*/
public int getServerPort();
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponse.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponse.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponse.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponse.java Mon Sep 26 22:41:36 2011
@@ -56,8 +56,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @throws IllegalArgumentException if cookie name, or value, is not valid
@@ -67,8 +66,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @param expiration expiration of cookie in seconds
@@ -79,8 +77,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @param domain cookie domain
@@ -91,8 +88,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @param domain cookie domain
@@ -104,8 +100,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @param expiration expiration of cookie in seconds
@@ -117,8 +112,7 @@ public interface HttpResponse {
/**
* Add a cookie to response.
*
- * @see #setCookie(String, String, Integer, String, String, boolean,
- * boolean)
+ * @see #setCookie(String, String, long, String, String, boolean, boolean)
* @param name name of cookie
* @param value value of cookie
* @param expiration expiration of cookie in seconds
Modified: incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponseImpl.java
URL: http://svn.apache.org/viewvc/incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponseImpl.java?rev=1176107&r1=1176106&r2=1176107&view=diff
==============================================================================
--- incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponseImpl.java (original)
+++ incubator/deft/trunk/src/main/java/org/apache/deft/web/http/HttpResponseImpl.java Mon Sep 26 22:41:36 2011
@@ -21,13 +21,14 @@ package org.apache.deft.web.http;
import static org.apache.deft.web.http.HttpServerDescriptor.WRITE_BUFFER_SIZE;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
-import java.nio.channels.FileChannel.MapMode;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -45,7 +46,6 @@ import com.google.common.base.CharMatche
import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
-import sun.nio.ch.FileChannelImpl;
public class HttpResponseImpl implements HttpResponse {
@@ -76,7 +76,7 @@ public class HttpResponseImpl implements
this.status = status;
}
- /** @{inheritDoc */
+ /** {@inheritDoc} */
@Override
public void setCreateETag(boolean create) {
createETag = create;
@@ -287,17 +287,19 @@ public class HttpResponseImpl implements
FileInputStream in = null;
try {
- in = new FileInputStream(file);
+ in = new FileInputStream(file);
FileChannel fileChannel = in.getChannel();
long sizeNeeded = fileChannel.size();
bytesWritten = fileChannel.transferTo(0, sizeNeeded, ((SocketChannel) key.channel()));
- if (bytesWritten < sizeNeeded){
- // Set channel Position to write rest of data from good starting offset
+ if (bytesWritten < sizeNeeded) {
+ // Set channel Position to write rest of data from good starting
+ // offset
fileChannel.position(bytesWritten);
key.attach(in);
- }else{
- // Only close channel when file is totally transferred to SocketChannel
+ } else {
+ // Only close channel when file is totally transferred to
+ // SocketChannel
com.google.common.io.Closeables.closeQuietly(in);
}