
com.github.gkutiel.flip.web.res.Bin Maven / Gradle / Ivy
package com.github.gkutiel.flip.web.res;
import java.util.Map;
import com.github.gkutiel.flip.Response;
public class Bin implements Response {
private String mime;
@Override
public byte[] getBytes(final Object obj) {
if (!(obj instanceof byte[])) throw new IllegalArgumentException("only byte[] can be returned");
return (byte[]) obj;
}
@Override
public String getMimeType() {
return mime;
}
@Override
public void setProps(final Map props) {
final String mime = props.get("mime");
if (mime == null) throw new IllegalStateException("'mime' property must be specified for BinaryResponse");
this.mime = mime;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy