本文整理了Java中org.apache.cxf.jaxrs.ext.multipart.Attachment.getContentId()
方法的一些代码示例,展示了Attachment.getContentId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attachment.getContentId()
方法的具体详情如下:
包路径:org.apache.cxf.jaxrs.ext.multipart.Attachment
类名称:Attachment
方法名:getContentId
暂无
代码示例来源:origin: apache/cxf
public static boolean matchAttachmentId(Attachment at, String value) {
if (value.isEmpty()) {
return true;
}
if (at.getContentId().equals(value)) {
return true;
}
ContentDisposition cd = at.getContentDisposition();
return cd != null && value.equals(cd.getParameter("name"));
}
代码示例来源:origin: apache/cxf
public Attachment getAttachment(String contentId) {
for (Attachment a : atts) {
if (contentId.equalsIgnoreCase(a.getContentId())) {
return a;
}
ContentDisposition cd = a.getContentDisposition();
if (cd != null && contentId.equals(cd.getParameter("name"))) {
return a;
}
}
return null;
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public static boolean matchAttachmentId(Attachment at, String value) {
if (value.isEmpty()) {
return true;
}
if (at.getContentId().equals(value)) {
return true;
}
ContentDisposition cd = at.getContentDisposition();
if (cd != null && value.equals(cd.getParameter("name"))) {
return true;
}
return false;
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public Attachment getAttachment(String contentId) {
for (Attachment a : atts) {
if (contentId.equalsIgnoreCase(a.getContentId())) {
return a;
}
ContentDisposition cd = a.getContentDisposition();
if (cd != null && contentId.equals(cd.getParameter("name"))) {
return a;
}
}
return null;
}
代码示例来源:origin: apache/cxf
private static Map<String, Attachment> fromListToMap(List<Attachment> atts,
boolean preferContentDisposition) {
Map<String, Attachment> map = new LinkedHashMap<>();
for (Attachment a : atts) {
String contentId = null;
if (preferContentDisposition) {
ContentDisposition cd = a.getContentDisposition();
if (cd != null) {
contentId = cd.getParameter("name");
}
}
if (contentId == null) {
contentId = a.getContentId();
}
map.put(contentId, a);
}
return map;
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
private static Map<String, Attachment> fromListToMap(List<Attachment> atts,
boolean preferContentDisposition) {
Map<String, Attachment> map = new LinkedHashMap<String, Attachment>();
for (Attachment a : atts) {
String contentId = null;
if (preferContentDisposition) {
ContentDisposition cd = a.getContentDisposition();
if (cd != null) {
contentId = cd.getParameter("name");
}
}
if (contentId == null) {
contentId = a.getContentId();
}
map.put(contentId, a);
}
return map;
}
代码示例来源:origin: apache/cxf
att.getObject().getClass(), new Annotation[]{},
att.getContentType().toString(), id);
return new Attachment(att.getContentId(), dh, att.getHeaders());
} else if (byte[].class.isAssignableFrom(obj.getClass())) {
ByteDataSource source = new ByteDataSource((byte[])obj);
代码示例来源:origin: apache/cxf
@POST
@Path("/books/attachments")
@Produces("text/xml")
public Response addBookFromAttachments() throws Exception {
Collection<Attachment> handlers = AttachmentUtils.getChildAttachments(context);
for (Attachment a : handlers) {
if ("book2".equals(a.getContentId())) {
return readBookFromInputStream(a.getDataHandler().getInputStream());
}
}
throw new WebApplicationException(500);
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
att.getObject().getClass(), new Annotation[]{},
att.getContentType().toString(), id);
return new Attachment(att.getContentId(), dh, att.getHeaders());
} else if (byte[].class.isAssignableFrom(obj.getClass())) {
ByteDataSource source = new ByteDataSource((byte[])obj);
代码示例来源:origin: apache/cxf
@POST
@Path("/books/formimage")
@Consumes("multipart/form-data")
@Produces("multipart/form-data")
public MultipartBody addBookFormImage(MultipartBody image) throws Exception {
List<Attachment> atts = image.getAllAttachments();
if (atts.size() != 1) {
throw new WebApplicationException();
}
List<Attachment> newAtts = new ArrayList<>();
Attachment at = atts.get(0);
MultivaluedMap<String, String> headers = at.getHeaders();
if (!"http://host/bar".equals(headers.getFirst("Content-Location"))) {
throw new WebApplicationException();
}
if (!"custom".equals(headers.getFirst("Custom-Header"))) {
throw new WebApplicationException();
}
headers.putSingle("Content-Location", "http://host/location");
newAtts.add(new Attachment(at.getContentId(), at.getDataHandler(), headers));
return new MultipartBody(newAtts);
}
代码示例来源:origin: apache/cxf
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
for (String key : handler.getHeaders().keySet()) {
att.setHeader(key, handler.getHeader(key));
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
for (String key : handler.getHeaders().keySet()) {
att.setHeader(key, handler.getHeader(key));
代码示例来源:origin: apache/cxf
String contentId = a.getContentId();
String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
if (StringUtils.isEmpty(name)) {
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
String contentId = a.getContentId();
String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
if (StringUtils.isEmpty(name)) {
内容来源于网络,如有侵权,请联系作者删除!