Merge branch 'master' of git@github.com:jclouds/jclouds

* 'master' of git@github.com:jclouds/jclouds:
  added additional properties to Payload for content disposition management
This commit is contained in:
Adrian Cole 2010-09-15 09:59:09 -07:00
commit c3e44cb7af
4 changed files with 196 additions and 0 deletions

View File

@ -72,6 +72,54 @@ public interface Payload extends InputSupplier<InputStream>, WriteTo, Closeable
@Nullable
String getContentType();
/**
* Set Content Disposition of the payload
* <p/>
* Not all providers may support it
*
* @param contentDisposition
*/
void setContentDisposition(@Nullable String contentDisposition);
/**
* Get Content Disposition of the payload
* <p/>
* Not all providers may support it
*/
@Nullable String getContentDisposition();
/**
* Set Content Language of the payload
* <p/>
* Not all providers may support it
*
* @param contentLanguage
*/
void setContentLanguage(@Nullable String contentLanguage);
/**
* Get Content Language of the payload
* <p/>
* Not all providers may support it
*/
@Nullable String getContentLanguage();
/**
* Set Content Encoding of the payload
* <p/>
* Not all providers may support it
*
* @param contentEncoding
*/
void setContentEncoding(@Nullable String contentEncoding);
/**
* Get Content Encoding of the payload
* <p/>
* Not all providers may support it
*/
@Nullable String getContentEncoding();
/**
* release resources used by this entity. This should be called when data is
* discarded.

View File

@ -40,6 +40,9 @@ public abstract class BasePayload<V> implements Payload {
protected String contentType;
protected Long contentLength;
protected byte[] contentMD5;
protected String contentDisposition;
protected String contentLanguage;
protected String contentEncoding;
protected transient volatile boolean written;
protected BasePayload(V content, @Nullable String contentType,
@ -118,6 +121,54 @@ public abstract class BasePayload<V> implements Payload {
this.contentType = contentType;
}
/**
* {@inheritDoc}
*/
@Override
public void setContentDisposition(@Nullable String contentDisposition) {
this.contentDisposition = contentDisposition;
}
/**
* {@inheritDoc}
*/
@Override
public String getContentDisposition() {
return this.contentDisposition;
}
/**
* {@inheritDoc}
*/
@Override
public void setContentLanguage(@Nullable String contentLanguage) {
this.contentLanguage = contentLanguage;
}
/**
* {@inheritDoc}
*/
@Override
public String getContentLanguage() {
return this.contentLanguage;
}
/**
* {@inheritDoc}
*/
@Override
public void setContentEncoding(@Nullable String contentEncoding) {
this.contentEncoding = contentEncoding;
}
/**
* {@inheritDoc}
*/
@Override
public String getContentEncoding() {
return this.contentEncoding;
}
/**
* {@inheritDoc}
*/

View File

@ -119,6 +119,54 @@ public class DelegatingPayload implements Payload {
delegate.setContentType(md5);
}
/**
* {@inheritDoc}
*/
@Override
public void setContentDisposition(String contentDisposition) {
delegate.setContentDisposition(contentDisposition);
}
/**
* {@inheritDoc}
*/
@Override
public String getContentDisposition() {
return delegate.getContentDisposition();
}
/**
* {@inheritDoc}
*/
@Override
public void setContentLanguage(String contentLanguage) {
delegate.setContentLanguage(contentLanguage);
}
/**
* {@inheritDoc}
*/
@Override
public String getContentLanguage() {
return delegate.getContentLanguage();
}
/**
* {@inheritDoc}
*/
@Override
public void setContentEncoding(String contentEncoding) {
delegate.setContentEncoding(contentEncoding);
}
/**
* {@inheritDoc}
*/
@Override
public String getContentEncoding() {
return delegate.getContentEncoding();
}
/**
* {@inheritDoc}
*/

View File

@ -112,6 +112,54 @@ public class StreamingPayload implements Payload {
this.contentType = contentType;
}
/**
* {@inheritDoc}
*/
@Override
public void setContentDisposition(String contentDisposition) {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@Override
public String getContentDisposition() {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@Override
public void setContentLanguage(String contentLanguage) {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@Override
public String getContentLanguage() {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@Override
public void setContentEncoding(String contentEncoding) {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@Override
public String getContentEncoding() {
throw new UnsupportedOperationException("this payload is for streaming writes only");
}
/**
* {@inheritDoc}
*/
@ -172,4 +220,5 @@ public class StreamingPayload implements Payload {
public void close() {
release();
}
}