Permalink
Browse files

savings.

  • Loading branch information...
1 parent dfcc84d commit 0dfe9f352a5f7294017d3eb2c9cff245597cf3a6 Neil committed Aug 5, 2009
@@ -1207,7 +1207,7 @@ public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusC
if(torrent.exists()) {
long torrentLength = torrent.length();
sendObject(request.getChannel(), httpResponse, bucketName, torrentFile, torrentLength, null,
- DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN),
+ DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN) + ".000Z",
null, null, request.getIsCompressed());
//TODO: this should reflect params for the torrent?
reply.setEtag("");
@@ -1249,17 +1249,17 @@ public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusC
} else {
//support for large objects
sendObject(request.getChannel(), httpResponse, bucketName, objectName, objectInfo.getSize(), objectInfo.getEtag(),
- DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN + ".000Z"),
+ DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN) + ".000Z",
objectInfo.getContentType(), objectInfo.getContentDisposition(), request.getIsCompressed());
}
} else {
sendHeaders(request.getChannel(), httpResponse, objectInfo.getSize(), objectInfo.getEtag(),
- DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN + ".000Z"),
+ DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN) + ".000Z",
objectInfo.getContentType(), objectInfo.getContentDisposition());
}
reply.setEtag(objectInfo.getEtag());
- reply.setLastModified(DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN + ".000Z"));
+ reply.setLastModified(DateUtils.format(objectInfo.getLastModified().getTime(), DateUtils.ISO8601_DATETIME_PATTERN) + ".000Z");
reply.setSize(objectInfo.getSize());
reply.setContentType(objectInfo.getContentType());
reply.setContentDisposition(objectInfo.getContentDisposition());
@@ -1313,9 +1313,8 @@ private void sendObject(Channel channel, MappingHttpResponse httpResponse, Strin
httpResponse.addHeader( HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(size));
}
channel.write(httpResponse);
- channel.write(file);
- /*ChannelFuture writeFuture = channel.write(file);
- writeFuture.addListener(ChannelFutureListener.CLOSE);*/
+ ChannelFuture writeFuture = channel.write(file);
+ writeFuture.addListener(ChannelFutureListener.CLOSE);
} catch(Exception ex) {
LOG.error(ex, ex);
}
@@ -3,6 +3,7 @@
import org.apache.log4j.Logger;
import org.jboss.netty.channel.ChannelDownstreamHandler;
import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
@@ -62,7 +63,8 @@ public void handleUpstream( ChannelHandlerContext ctx, ChannelEvent e ) throws E
MappingHttpResponse response = new MappingHttpResponse( message.getProtocolVersion( ) );
response.setMessage( reply );
if(!(reply instanceof WalrusDataGetResponseType)) {
- Channels.write( ctx.getChannel( ), response );
+ ChannelFuture writeFuture = Channels.write( ctx.getChannel( ), response );;
+ writeFuture.addListener(ChannelFutureListener.CLOSE);
}
}
}
@@ -10,8 +10,11 @@
import com.eucalyptus.ws.MappingHttpResponse;
import org.apache.log4j.Logger;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.http.HttpHeaders;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
@@ -69,6 +72,7 @@ public void outgoingMessage( ChannelHandlerContext ctx, MessageEvent event ) thr
if ( event.getMessage( ) instanceof MappingHttpResponse ) {
MappingHttpResponse httpResponse = ( MappingHttpResponse ) event.getMessage( );
EucalyptusMessage msg = (EucalyptusMessage) httpResponse.getMessage( );
+
if(msg instanceof PutObjectResponseType) {
PutObjectResponseType putObjectResponse = (PutObjectResponseType) msg;
httpResponse.addHeader(HttpHeaders.Names.ETAG, '\"' + putObjectResponse.getEtag() + '\"');
@@ -190,7 +190,7 @@ public Object bind( final String userId, final boolean admin, final MappingHttpR
//TODO: add userinfo
//FIXME: this is a hack for now
- UserInfo user = new UserInfo(EucalyptusProperties.NAME);
+ UserInfo user = new UserInfo("admin");
user.setIsAdministrator(Boolean.TRUE);
setRequiredParams (eucaMsg, user);

0 comments on commit 0dfe9f3

Please sign in to comment.