com.atlassian.jira.issue.attachment.Attachment.getMimetype()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中com.atlassian.jira.issue.attachment.Attachment.getMimetype()方法的一些代码示例,展示了Attachment.getMimetype()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attachment.getMimetype()方法的具体详情如下:
包路径:com.atlassian.jira.issue.attachment.Attachment
类名称:Attachment
方法名:getMimetype

Attachment.getMimetype介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin

@Override
  protected void modifyRequest(ApplicationLinkRequest request) {
    RequestFilePart requestFilePart = new RequestFilePart(attachment.getMimetype(), attachment.getFilename(), attachmentFile, "file");
    request.setFiles(ImmutableList.of(requestFilePart));
    request.addHeader("X-Atlassian-Token", "nocheck");
  }
});

代码示例来源:origin: com.atlassian.jira/jira-core

/**
 * Sets the content type, content length and "Content-Disposition" header
 * of the response based on the values of the attachement found.
 *
 * @param request  HTTP request
 * @param response HTTP response
 * @throws AttachmentNotFoundException
 * @throws IOException
 */
protected void setResponseHeaders(HttpServletRequest request, HttpServletResponse response)
    throws AttachmentNotFoundException, IOException
{
  final Attachment attachment = getAttachment(attachmentQuery(request));
  response.setContentType(attachment.getMimetype());
  response.setContentLength(attachment.getFilesize().intValue());
  getMimeSniffingKit().setAttachmentResponseHeaders(attachment, request.getHeader(USER_AGENT_HEADER), response);
  HttpResponseHeaders.cachePrivatelyForAboutOneYear(response);
}

代码示例来源:origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin

public RemoteAttachment(Attachment attachment)
{
  super(attachment.getId().toString());
  author = getUsernameFor(attachment.getAuthorObject());
  created = attachment.getCreated();
  filename = attachment.getFilename();
  filesize = attachment.getFilesize();
  mimetype = attachment.getMimetype();
}

代码示例来源:origin: com.atlassian.jira/jira-core

private RendererAttachment convertToRendererAttachment(Attachment attachment, RenderContext context, EmbeddedResource resource)
{
  return new RendererAttachment(attachment.getId().longValue(), attachment.getFilename(), attachment.getMimetype(),
      attachment.getAuthorKey(), null, buildAttachmentUrl(context, attachment), null, null, attachment.getCreated());
}

代码示例来源:origin: com.atlassian.jira/jira-core

private RendererAttachment convertToRendererAttachment(ThumbnailedImage thumbnail, Attachment attachment, RenderContext context, EmbeddedResource resource)
{
  return new RendererAttachment(thumbnail.getAttachmentId(), thumbnail.getFilename(), attachment.getMimetype(),
      attachment.getAuthorKey(), null, thumbnail.getImageURL(), null, null, attachment.getCreated());
}

代码示例来源:origin: com.atlassian.jira/jira-core

/**
 * Sets the appropriate HTTP response headers on an attachment download response. Depending on the JIRA security
 * settings and the browser making the request, this can contain headers such as {@code Content-Disposition} and
 * {@code X-Download-Options} to force downloading rather than opening attachments.
 *
 * @param attachment the Attachment in play
 * @param userAgent    the User-agent request header
 * @param httpServletResponse the attachment download response
 * @throws IOException if stuff goes wrong
 */
public void setAttachmentResponseHeaders(final Attachment attachment, final String userAgent,
    final HttpServletResponse httpServletResponse) throws IOException
{
  String filename = attachment.getFilename();
  BufferedInputStream inputStream = null;
  try
  {
    OpenAttachmentStrategy strategy = getOpenAttachmentStrategy(filename, attachment.getMimetype());
    strategy.setResponseHeaders(httpServletResponse);
  }
  finally
  {
    if (inputStream != null)
    {
      IOUtil.shutdownStream(inputStream);
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

@Override
public HumanReadableArchive format(final AttachmentArchive archive, final Attachment attachment)
{
  final Long id = attachment.getId();
  final List<AttachmentArchiveEntry> entries = archive.getEntries();
  final Collection<HumanReadableArchiveEntry> convertedEntries = convertEntries(entries);
  final String name = attachment.getFilename();
  final int totalEntryCount = archive.getTotalEntryCount();
  final String mediaType = attachment.getMimetype();
  return new HumanReadableArchive(id, name, convertedEntries, totalEntryCount, mediaType);
}

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

Timestamp created = attachment.getCreated();
Long size = attachment.getFilesize();
String mimeType = attachment.getMimetype();
HashMap<String, Object> properties = new PropertySetAdapter().marshal(attachment.getProperties());

代码示例来源:origin: com.atlassian.jira/jira-api

bean.filename = attachment.getFilename();
bean.size = FileSize.format(attachment.getFilesize());
bean.mimeType = attachment.getMimetype();
bean.author = ComponentAccessor.getComponent(UserBeanFactory.class).createBean(attachment.getAuthorObject(), loggedInUser, urls, emailFormatter, ComponentAccessor.getComponent(TimeZoneManager.class));
bean.content = attachment.getFilename();

代码示例来源:origin: com.atlassian.jira/jira-core

bean.setFilename(attachment.getFilename());
bean.setSize(attachment.getFilesize());
bean.setMimeType(attachment.getMimetype());
ApplicationUser author = attachment.getAuthorObject();
bean.setAuthor(userBeanFactory.createBean(author, authenticationContext.getUser(), urls, emailFormatter, timeZoneManager));

代码示例来源:origin: com.atlassian.jira/jira-core

FileSize.format(attachment.getFilesize()),
attachment.getFilename(),
attachment.getMimetype(),
created,
userDateTimeFormatter.format(createdTimestamp)

相关文章