org.apache.cxf.jaxrs.ext.multipart.Multipart.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(163)

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

Multipart.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/cxf

@POST
@Path("/books")
@Produces("multipart/related")
@Consumes("multipart/related")
@Multipart(type = "application/xml")
public Book echoBookMultipart(@Multipart(type = "application/xml") Book book) {
  return book;
}
@POST

代码示例来源:origin: apache/cxf

@POST
@Path("/booksList")
@Produces("multipart/related")
@Consumes("multipart/related")
@Multipart(type = "application/xml")
public List<Book> echoBooksMultipart(@Multipart(type = "application/xml") List<Book> books) {
  return books;
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/image")
@Consumes("multipart/mixed")
@Produces("multipart/mixed")
@Multipart(type = "application/stream")
public byte[] addBookImage(@Multipart byte[] image) throws Exception {
  return image;
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/testnullparts")
@Consumes("multipart/form-data")
@Produces("text/plain")
public String testNullParts(@Multipart(value = "someid") String value,
              @Multipart(value = "someid2", required = false) String value2) {
  if (value2 != null) {
    return value + value2;
  }
  return "nobody home2";
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/testnullpartprimitive")
@Consumes("multipart/form-data")
@Produces("text/plain")
public int testNullPart2(@Multipart(value = "someid", required = false) int value) {
  return value;
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/mismatch2")
@Produces("text/xml")
public Response addBookMismatched2(@Multipart(value = "rootPart", type = "f/b") Book b) {
  throw new WebApplicationException();
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/mismatch1")
@Consumes("multipart/related;type=\"bar/foo\"")
@Produces("text/xml")
public Response addBookMismatched(@Multipart Book b) {
  throw new WebApplicationException();
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/jaxbjsonconsumes")
@Consumes("multipart/related")
@Produces("text/xml")
public Book addBookJaxbJsonWithConsumes(
  @Multipart(value = "rootPart", type = "text/xml") Book2 b1,
  @Multipart(value = "book2", type = "application/json") Book b2) throws Exception {
  return addBookJaxbJson(b1, b2);
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/jsonjaxbformencoded")
@Produces("text/xml")
@Consumes("multipart/form-data")
public Response addBookJaxbJsonFormEncoded(@Multipart("jsonPart") Book b1,
                  @Multipart("bookXML") Book b2)
  throws Exception {
  return addBookJaxbJsonForm(b1, b2);
}

代码示例来源:origin: apache/cxf

@POST
@Path("/booksModified")
@Produces("multipart/related")
@Consumes("multipart/related")
@Multipart(type = "application/xml")
public Book echoBookMultipartModified(@Multipart(type = "application/xml") Book book) {
  throw new InternalServerErrorException("Failure to detect the payload has been modified");
}
@POST

代码示例来源:origin: apache/cxf

@POST
@Path("/books/stream")
@Produces("text/xml")
public Response addBookFromStream(@Multipart StreamSource source) throws Exception {
  JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
  Unmarshaller u = c.createUnmarshaller();
  Book b = (Book)u.unmarshal(source);
  b.setId(124);
  return Response.ok(b).build();
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/jaxbonly")
@Consumes("multipart/related")
@Produces("text/xml")
public Book2 addBookJaxbOnlyWithConsumes(
  @Multipart(value = "rootPart", type = "text/xml") Book2 b1) throws Exception {
  if (!"CXF in Action".equals(b1.getName())) {
    throw new WebApplicationException();
  }
  return b1;
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/jaxbform")
@Produces("text/xml")
@Consumes("multipart/form-data")
public Response addBookJaxbFromForm(@Multipart Book b1)
  throws Exception {
  b1.setId(124);
  return Response.ok(b1).build();
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/jsonform")
@Produces("text/xml")
@Consumes("multipart/form-data")
public Response addBookJsonFromForm(@Multipart Book b1)
  throws Exception {
  b1.setId(124);
  return Response.ok(b1).build();
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/filesform/mixup")
@Produces("text/xml")
@Consumes("multipart/form-data")
public Response addBookFilesFormMixUp(@FormParam("owner") String name,
                   @Multipart("files") List<Book> books)
  throws Exception {
  return addBookFilesForm(name, books);
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/dsource")
@Produces("text/xml")
public Response addBookFromDataSource(@Multipart DataSource ds) throws Exception {
  return readBookFromInputStream(ds.getInputStream());
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/dhandler")
@Produces("text/xml")
public Response addBookFromDataHandler(@Multipart DataHandler dh) throws Exception {
  return readBookFromInputStream(dh.getInputStream());
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/filesform2")
@Produces("text/xml")
@Consumes("multipart/form-data")
public Response addBookFilesFormNoOwnerParam(@Multipart("files") List<Book> books)
  throws Exception {
  Attachment attOwner = AttachmentUtils.getFirstMatchingPart(context, "owner");
  return addBookFilesForm(attOwner.getObject(String.class), books);
}

代码示例来源:origin: apache/cxf

@Path("/books/file/semicolon")
@Consumes("multipart/form-data")
@Produces("text/plain")
@POST
public String addBookFileNameSemicolon(@Multipart("a") Attachment att) {
  return att.getObject(String.class)
    + ", filename:" + att.getContentDisposition().getParameter("filename");
}

代码示例来源:origin: apache/cxf

@POST
@Path("/books/attachment")
@Produces("text/xml")
public Response addBookFromAttachment(@Multipart Attachment a) throws Exception {
  return readBookFromInputStream(a.getDataHandler().getInputStream());
}

相关文章