Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.multipart
Class MultiPart

    java.lang.Object
      com.sun.jersey.multipart.BodyPart
          com.sun.jersey.multipart.MultiPart

All Implemented Interfaces:
  java.io.Closeable

Direct Known Subclasses:
  FormDataMultiPart

    public class MultiPart

extends BodyPart
implements java.io.Closeable

A mutable model representing a MIME MultiPart entity. This class extends `BodyPart` because MultiPart entities can be nested inside other MultiPart entities to an arbitrary depth.

Field Summary

Fields inherited from class com.sun.jersey.multipart.BodyPart
`cd`

Constructor Summary
`MultiPart()` Instantiate a new `MultiPart` with a `mediaType` of `multipart/mixed`.
`MultiPart(MediaType mediaType)` Instantiate a new `MultiPart` with the specified characteristics.

Method Summary
`MultiPart` | `bodyPart(BodyPart bodyPart)` Builder pattern method to add the specified `BodyPart` to this `MultiPart`.
`MultiPart` | `bodyPart(java.lang.Object entity, MediaType mediaType)` Builder pattern method to add a newly configured `BodyPart` to this `MultiPart`.
`void` | `cleanup()` Perform any necessary cleanup at the end of processing this `MultiPart`.
`void` | `close()`
`BodyPart` | `entity(java.lang.Object entity)` Override the entity set operation on a `MultiPart` to throw `IllegalArgumentException`.
`java.util.List<BodyPart>` | `getBodyParts()` Return a mutable list of `BodyPart`s nested in this `MultiPart`.
`java.lang.Object` | `getEntity()` Disable access to the entity for a `MultiPart`.
`void` | `setEntity(java.lang.Object entity)` Disable access to the entity for a `MultiPart`.
`void` | `setMediaType(MediaType mediaType)` Set the `MediaType` for this `MultiPart`.
`MultiPart` | `type(MediaType type)` Builder pattern method to return this `MultiPart` after additional configuration.

Methods inherited from class com.sun.jersey.multipart.BodyPart
`contentDisposition, getContentDisposition, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setContentDisposition, setParent, setProviders`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MultiPart

    public MultiPart()

  Instantiate a new `MultiPart` with a `mediaType` of `multipart/mixed`.

### MultiPart

    public MultiPart(MediaType mediaType)

  Instantiate a new `MultiPart` with the specified characteristics.

  Parameters:
    `mediaType` - The `MediaType` for this multipart

Method Detail

### getBodyParts

    public java.util.List<BodyPart> getBodyParts()

  Return a mutable list of `BodyPart`s nested in this `MultiPart`.

### getEntity

    public java.lang.Object getEntity()

  Disable access to the entity for a `MultiPart`. Use the list returned by `getBodyParts()` to access the relevant `BodyPart` instead.

  Overrides:
    `getEntity` in class `BodyPart`
  Throws:
    `java.lang.IllegalStateException` - thrown unconditionally

### setEntity

    public void setEntity(java.lang.Object entity)

  Disable access to the entity for a `MultiPart`. Use the list returned by `getBodyParts()` to access the relevant `BodyPart` instead.

  Overrides:
    `setEntity` in class `BodyPart`
  Parameters:
    `entity` -

### setMediaType

    public void setMediaType(MediaType mediaType)

  Set the `MediaType` for this `MultiPart`. If never set, the default `MediaType` MUST be `multipart/mixed`.

  Overrides:
    `setMediaType` in class `BodyPart`
  Parameters:
    `mediaType` - The new `MediaType`
  Throws:
    `java.lang.IllegalArgumentException` - if the `type` property is not set to `multipart`

### bodyPart

    public MultiPart bodyPart(BodyPart bodyPart)

  Builder pattern method to add the specified `BodyPart` to this `MultiPart`.

  Parameters:
    `bodyPart` - `BodyPart` to be added

### bodyPart

    public MultiPart bodyPart(java.lang.Object entity,
                              MediaType mediaType)

  Builder pattern method to add a newly configured `BodyPart` to this `MultiPart`.

  Parameters:
    `entity` - Entity object for this body part
    `mediaType` - Content type for this body part

### entity

    public BodyPart entity(java.lang.Object entity)

  Override the entity set operation on a `MultiPart` to throw `IllegalArgumentException`.

  Overrides:
    `entity` in class `BodyPart`
  Parameters:
    `entity` - Entity to set for this `BodyPart`

### type

    public MultiPart type(MediaType type)

  Builder pattern method to return this `MultiPart` after additional configuration.

  Overrides:
    `type` in class `BodyPart`
  Parameters:
    `type` - Media type to set for this `MultiPart`

### cleanup

    public void cleanup()

  Perform any necessary cleanup at the end of processing this `MultiPart`.

  Overrides:
    `cleanup` in class `BodyPart`

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 Oracle Corporation. All Rights Reserved.