本文整理了Java中org.glassfish.jersey.media.multipart.MultiPart.getBodyParts()
方法的一些代码示例,展示了MultiPart.getBodyParts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiPart.getBodyParts()
方法的具体详情如下:
包路径:org.glassfish.jersey.media.multipart.MultiPart
类名称:MultiPart
方法名:getBodyParts
[英]Return a mutable list of BodyParts nested in this MultiPart.
[中]返回嵌套在此多部分中的车身部件的可变列表。
代码示例来源:origin: jersey/jersey
/**
* Builder pattern method to add the specified {@link BodyPart} to this
* {@link MultiPart}.
*
* @param bodyPart {@link BodyPart} to be added.
*/
public MultiPart bodyPart(BodyPart bodyPart) {
getBodyParts().add(bodyPart);
return this;
}
代码示例来源:origin: jersey/jersey
/**
* Performs any necessary cleanup at the end of processing this
* {@link MultiPart}.
*/
@Override
public void cleanup() {
for (BodyPart bp : getBodyParts()) {
bp.cleanup();
}
}
代码示例来源:origin: jersey/jersey
if ((entity.getBodyParts() == null) || (entity.getBodyParts().size() < 1)) {
throw new IllegalArgumentException(LocalizationMessages.MUST_SPECIFY_BODY_PART());
for (final BodyPart bodyPart : entity.getBodyParts()) {
代码示例来源:origin: OryxProject/oryx
protected final Response getFormPostResponse(String data,
String endpoint,
Class<? extends OutputStream> compressingClass,
String encoding) throws IOException {
byte[] bytes;
if (compressingClass == null) {
bytes = data.getBytes(StandardCharsets.UTF_8);
} else {
bytes = compress(data, compressingClass);
}
MediaType type =
encoding == null ? MediaType.TEXT_PLAIN_TYPE : new MediaType("application", encoding);
InputStream in = new ByteArrayInputStream(bytes);
StreamDataBodyPart filePart = new StreamDataBodyPart("data", in, "data", type);
try (MultiPart multiPart = new MultiPart(MediaType.MULTIPART_FORM_DATA_TYPE)) {
multiPart.getBodyParts().add(filePart);
return target(endpoint).request().post(
Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE));
}
}
代码示例来源:origin: jersey/jersey
multiPart.getBodyParts().add(bodyPart);
代码示例来源:origin: stackoverflow.com
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public void postHotel(MultiPart hotelParams)
throws SQLException, FileNotFoundException, IOException {
stmt.executeUpdate("insert into hotel(user_name,password)values('"
+hotelParams.getBodyParts().get(0)
+ "','"
+ hotelParams.getBodyParts().get(1)
+ "'");
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Builder pattern method to add the specified {@link BodyPart} to this
* {@link MultiPart}.
*
* @param bodyPart {@link BodyPart} to be added.
*/
public MultiPart bodyPart(BodyPart bodyPart) {
getBodyParts().add(bodyPart);
return this;
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-multipart
/**
* Builder pattern method to add the specified {@link BodyPart} to this
* {@link MultiPart}.
*
* @param bodyPart {@link BodyPart} to be added.
*/
public MultiPart bodyPart(BodyPart bodyPart) {
getBodyParts().add(bodyPart);
return this;
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Builder pattern method to add the specified {@link BodyPart} to this
* {@link MultiPart}.
*
* @param bodyPart {@link BodyPart} to be added.
*/
public MultiPart bodyPart(BodyPart bodyPart) {
getBodyParts().add(bodyPart);
return this;
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Builder pattern method to add the specified {@link BodyPart} to this
* {@link MultiPart}.
*
* @param bodyPart {@link BodyPart} to be added.
*/
public MultiPart bodyPart(BodyPart bodyPart) {
getBodyParts().add(bodyPart);
return this;
}
代码示例来源:origin: com.github.jakimli.pandaria/pandaria-core
private boolean hasAttachment() {
return !attachments.getBodyParts().isEmpty();
}
代码示例来源:origin: JakimLi/pandaria
private boolean hasAttachment() {
return !attachments.getBodyParts().isEmpty();
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-multipart
/**
* Performs any necessary cleanup at the end of processing this
* {@link MultiPart}.
*/
@Override
public void cleanup() {
for (BodyPart bp : getBodyParts()) {
bp.cleanup();
}
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Performs any necessary cleanup at the end of processing this
* {@link MultiPart}.
*/
@Override
public void cleanup() {
for (BodyPart bp : getBodyParts()) {
bp.cleanup();
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Performs any necessary cleanup at the end of processing this
* {@link MultiPart}.
*/
@Override
public void cleanup() {
for (BodyPart bp : getBodyParts()) {
bp.cleanup();
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Performs any necessary cleanup at the end of processing this
* {@link MultiPart}.
*/
@Override
public void cleanup() {
for (BodyPart bp : getBodyParts()) {
bp.cleanup();
}
}
代码示例来源:origin: stackoverflow.com
@POST
@Consumes(MultiPartMediaTypes.MULTIPART_MIXED)
public Response post(MultiPart multiPart) {
for(BodyPart part : multiPart.getBodyParts()) {
System.out.println(part.getMediaType());
}
return Response.status(Response.Status.ACCEPTED).
entity("Attachements processed successfully.").
type(MediaType.TEXT_PLAIN).build();
}
代码示例来源:origin: stackoverflow.com
@POST
@Consumes("multipart/*")
public String create(MultiPart multiPart) throws Exception {
String message;
try (BodyPartEntity bpe
= (BodyPartEntity) multiPart.getBodyParts().get(0).getEntity()) {
message = getString(bpe.getInputStream());
}
return message;
}
private String getString(InputStream is) throws Exception {
StringBuilder builder = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line;
while((line = reader.readLine()) != null) {
builder.append(line).append("\n");
}
}
return builder.toString();
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-commons-rest-client
/**
* POST a multipart object streaming
*
* @param path the path to access
* @param name the name of the param the endpoint is expecting
* @param fileName the name of the file
* @param stream the stream itself
* @param returnType the type to return from the post
* @return the response of type T
*/
public <T> T postMultiPartStream(String path, String name, String fileName, InputStream stream, Class<T> returnType) {
WebTarget target = buildTarget(path, null);
MultiPart multiPart = new MultiPart(MediaType.MULTIPART_FORM_DATA_TYPE);
StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart(name, stream, fileName, MediaType.APPLICATION_OCTET_STREAM_TYPE);
multiPart.getBodyParts().add(streamDataBodyPart);
MediaType contentType = MediaType.MULTIPART_FORM_DATA_TYPE;
contentType = Boundary.addBoundary(contentType);
return target.request().post(
Entity.entity(multiPart, contentType), returnType);
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-multipart
multiPart.getBodyParts().add(bodyPart);
内容来源于网络,如有侵权,请联系作者删除!