engineRequest.setPrefix(request.getParameter("prefix"));
engineRequest.setVersionIdMarker( versionIdMarker );
int maxKeys = Converter.toInt(request.getParameter("max-keys"), 1000);
engineRequest.setMaxKeys(maxKeys);
S3ListBucketResponse engineResponse = ServiceProvider.getInstance().getS3Engine().listBucketContents( engineRequest, true );
// -> the SOAP version produces different XML
StringBuffer xml = new StringBuffer();
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
xml.append( "<ListVersionsResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" );
xml.append( "<Name>" ).append( engineResponse.getBucketName()).append( "</Name>" );
if ( null == keyMarker )
xml.append( "<KeyMarker/>" );
else xml.append( "<KeyMarker>" ).append( keyMarker ).append( "</KeyMarker" );
if ( null == versionIdMarker )
xml.append( "<VersionIdMarker/>" );
else xml.append( "<VersionIdMarker>" ).append( keyMarker ).append( "</VersionIdMarker" );
xml.append( "<MaxKeys>" ).append( engineResponse.getMaxKeys()).append( "</MaxKeys>" );
xml.append( "<IsTruncated>" ).append( engineResponse.isTruncated()).append( "</IsTruncated>" );
S3ListBucketObjectEntry[] versions = engineResponse.getContents();
for( int i=0; null != versions && i < versions.length; i++ )
{
S3CanonicalUser owner = versions[i].getOwner();
boolean isDeletionMarker = versions[i].getIsDeletionMarker();
String displayName = owner.getDisplayName();