ByteArrayDataSource baDataSource =
new ByteArrayDataSource(byte[], contentType);
DataHandler dh = new DataHandler(baDataSource);
attachments.addDataHandler(id, dh);
___________________________________________________
public class ResponseWithAttachments<R, A>
{
private R response;
private A attachments;
/**
* <默认构造函数>
* @param response 返回对像
* @param attachments 附件
*/
public ResponseWithAttachments(R response, A attachments)
{
this.response = response;
this.attachments = attachments;
}
public R getResponse()
{
return this.response;
}
public A getAttachments()
{
return this.attachments;
}
}
________________________________________________________________
new ByteArrayDataSource(byte[], contentType);
DataHandler dh = new DataHandler(baDataSource);
attachments.addDataHandler(id, dh);
___________________________________________________
public class ResponseWithAttachments<R, A>
{
private R response;
private A attachments;
/**
* <默认构造函数>
* @param response 返回对像
* @param attachments 附件
*/
public ResponseWithAttachments(R response, A attachments)
{
this.response = response;
this.attachments = attachments;
}
public R getResponse()
{
return this.response;
}
public A getAttachments()
{
return this.attachments;
}
}
________________________________________________________________