本文整理了Java中org.apache.james.mailbox.model.Attachment.getType()
方法的一些代码示例,展示了Attachment.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attachment.getType()
方法的具体详情如下:
包路径:org.apache.james.mailbox.model.Attachment
类名称:Attachment
方法名:getType
暂无
代码示例来源:origin: org.apache.james/james-server-jmap
private ContentTypeField contentTypeField(MessageAttachment att) {
Builder<String, String> parameters = ImmutableMap.builder();
if (att.getName().isPresent()) {
parameters.put("name", encode(att.getName().get()));
}
String type = att.getAttachment().getType();
if (type.contains(FIELD_PARAMETERS_SEPARATOR)) {
return Fields.contentType(contentTypeWithoutParameters(type), parameters.build());
}
return Fields.contentType(type, parameters.build());
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-store
private Stream<String> toAttachmentContent(Attachment attachment) {
try {
return OptionalUtils.toStream(
textExtractor
.extractContent(
attachment.getStream(),
attachment.getType())
.getTextualContent());
} catch (Exception e) {
LOGGER.error("Error while parsing attachment content", e);
return Stream.of();
}
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-cassandra
public static DAOAttachment from(Attachment attachment, BlobId blobId) {
return new DAOAttachment(
attachment.getAttachmentId(),
blobId,
attachment.getType(),
attachment.getSize());
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-cassandra
public CompletableFuture<Void> storeAttachment(Attachment attachment) throws IOException {
return cassandraAsyncExecutor.executeVoid(
insertStatement.bind()
.setString(ID, attachment.getAttachmentId().getId())
.setLong(SIZE, attachment.getSize())
.setString(TYPE, attachment.getType())
.setBytes(PAYLOAD, ByteBuffer.wrap(attachment.getBytes())));
}
代码示例来源:origin: org.apache.james/james-server-jmap
private UploadResponse uploadContent(String contentType, InputStream inputStream, MailboxSession session) throws IOException, MailboxException {
Attachment attachment = Attachment.builder()
.bytes(ByteStreams.toByteArray(inputStream))
.type(contentType)
.build();
attachmentManager.storeAttachment(attachment, session);
return UploadResponse.builder()
.blobId(attachment.getAttachmentId().getId())
.type(attachment.getType())
.size(attachment.getSize())
.build();
}
代码示例来源:origin: org.apache.james/james-server-jmap
private Attachment fromMailboxAttachment(MessageAttachment attachment) {
return Attachment.builder()
.blobId(BlobId.of(attachment.getAttachmentId().getId()))
.type(attachment.getAttachment().getType())
.size(attachment.getAttachment().getSize())
.name(attachment.getName())
.cid(attachment.getCid().map(Cid::getValue))
.isInline(attachment.isInline())
.build();
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
private String uploadTextAttachment(Attachment attachment) throws IOException {
return with()
.header("Authorization", accessToken.serialize())
.contentType(attachment.getType())
.body(new String(IOUtils.toByteArray(attachment.getStream()), StandardCharsets.UTF_8))
.post("/upload")
.then()
.extract()
.body()
.jsonPath()
.getString("blobId");
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedAttachment1 + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + "}," +
" {\"blobId\" : \"" + uploadedAttachment2 + "\", " +
" \"type\" : \"" + attachment2.getType() + "\", " +
" \"size\" : " + attachment2.getSize() + ", " +
" \"isInline\" : true }" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedAttachment1 + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + "}," +
" {\"blobId\" : \"" + uploadedAttachment2 + "\", " +
" \"type\" : \"" + attachment2.getType() + "\", " +
" \"size\" : " + attachment2.getSize() + ", " +
" \"cid\" : \"123456789\", " +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
private String uploadAttachment(Attachment attachment) throws IOException {
return with()
.header("Authorization", accessToken.serialize())
.contentType(attachment.getType())
.body(attachment.getStream())
.post("/upload")
.then()
.extract()
.body()
.jsonPath()
.getString("blobId");
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" {" +
" \"blobId\" : \"" + uploadedAttachment1 + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + "," +
" \"name\" : \"ديناصور.png\", " +
" {" +
" \"blobId\" : \"" + uploadedAttachment2 + "\", " +
" \"type\" : \"" + attachment2.getType() + "\", " +
" \"size\" : " + attachment2.getSize() + "," +
" \"name\" : \"эволюционировать.png\", " +
" {" +
" \"blobId\" : \"" + uploadedAttachment3 + "\", " +
" \"type\" : \"" + attachment3.getType() + "\", " +
" \"size\" : " + attachment3.getSize() + "," +
" \"name\" : \"进化还是不.png\"," +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + nonIndexableAttachment.getType() + "\", " +
" \"name\" : \"nonIndexableAttachment.html\", " +
" \"size\" : " + nonIndexableAttachment.getSize() + "}" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedAttachment + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + ", " +
" \"cid\" : \"123456789\", " +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedAttachment + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + ", " +
" \"cid\" : \"123456789\", " +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + ", " +
" \"isInline\" : false }" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + ", " +
" \"isInline\" : false }" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + attachment.getType() + "\"," +
" \"size\" : " + attachment.getSize() + "}" +
" ]," +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + nonIndexableAttachment.getType() + "\", " +
" \"name\" : \"nonIndexableAttachment.html\", " +
" \"size\" : " + nonIndexableAttachment.getSize() + "}" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + attachment.getType() + "\", " +
" \"size\" : " + attachment.getSize() + ", " +
" \"isInline\" : false }" +
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
" \"attachments\": [" +
" {\"blobId\" : \"" + uploadedBlobId + "\", " +
" \"type\" : \"" + nonIndexableAttachment.getType() + "\", " +
" \"name\" : \"nonIndexableAttachment.html\", " +
" \"size\" : " + nonIndexableAttachment.getSize() + "}" +
内容来源于网络,如有侵权,请联系作者删除!