Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.soap.rpc
Class SOAPContext

    java.lang.Object
      |
      +--org.apache.soap.rpc.SOAPContext

Direct Known Subclasses:
  OracleSOAPContext

public class SOAPContext
extends java.lang.Object

SOAP context for a message. Encapsulates:

- MIME multipart
- MultiRef elements

Field Summary
`protected java.util.Hashtable` | `bag`
`protected java.lang.String` | `currentId`
`protected java.util.Hashtable` | `deserializedMultiRef`
`protected java.lang.ClassLoader` | `loader`
`protected java.util.Vector` | `multiRef`
`protected MimeMultipart` | `parts`
`protected boolean` | `rootPartSet` This flag indicates if setRootPart() was called, so we can distinguish default root part resolution from deliberate root part indication.

Constructor Summary
`SOAPContext()` Constructor.

Method Summary
`void` | `addBodyPart(MimeBodyPart part)` Adds a Part.
`void` | `addBodyPart(MimeBodyPart part, int index)` Adds a MimeBodyPart at position `index`.
`void` | `addDeserializedMultiRef(java.lang.String id, java.lang.Object o)` Adds the multiRef deserialized for a particular id.
`int` | `addMultiRef(java.lang.Object obj, Serializer ser)` Adds a multiRef element.
`MimeBodyPart` | `findBodyPart(java.lang.String uri)` Find the Mimepart referred to by the given URI.
`MimeBodyPart` | `findPartByLocation(java.lang.String uri)` Find the Mimepart referred to by the given URI.
`java.lang.String` | `getBaseURI()` Determine the document's base URI, according to the following scheme: The Content-Location header of the root (SOAP) part.
`MimeBodyPart` | `getBodyPart(int index)` Get the specified Part.
`MimeBodyPart` | `getBodyPart(java.lang.String CID)` Get the Mimepart referred to by the given ContentID (CID).
`java.lang.ClassLoader` | `getClassLoader()`
`java.lang.String` | `getContentType()` Return the content-type
`int` | `getCount()` Return the number of enclosed BodyPart objects.
`java.lang.String` | `getCurrentId()` Gets the id attribute for the element currently being deserialized.
`java.lang.Object` | `getDeserializedMultiRef(java.lang.String id)` Gets the multiRef deserialized for a particular id.
`int` | `getMultiRefCount()` Gets the number of multiRefs.
`java.lang.Object` | `getMultiRefObject(int id)` Gets the multiRef object for a particular id.
`Serializer` | `getMultiRefSerializer(int id)` Gets the multiRef serializer for a particular id.
`java.lang.Object` | `getProperty(java.lang.String name)` Look for something in the hold-all 'bag'
`java.util.Enumeration` | `getPropertyNames()` Return the entire list of 'names' in the hold-all 'bag'
`MimeBodyPart` | `getRootPart()` Find the root part.
`boolean` | `isRootPartSet()` Returns true is setRootPart() has been called.
`java.lang.Class` | `loadClass(java.lang.String className)`
`void` | `readMultipart(DataSource ds)` Initialise MIME multipart object from a data source.
`void` | `removeBodyPart(MimeBodyPart part)` Remove a body part.
`java.lang.Object` | `removeProperty(java.lang.String name)` Remove something from the hold-all 'bag'
`void` | `setClassLoader(java.lang.ClassLoader cl)`
`void` | `setCurrentId(java.lang.String id)` Sets the id attribute for the element currently being deserialized.
`void` | `setProperty(java.lang.String name, java.lang.Object value)` Store something in the hold-all 'bag'
`void` | `setRootPart(byte[] b, java.lang.String contentType)` Set the root part to a provided string (usually the SOAP envelope).
`void` | `setRootPart(MimeBodyPart part)` Adds the root BodyPart.
`void` | `setRootPart(java.lang.String s, java.lang.String contentType)` Set the root part to a provided string (usually the SOAP envelope).
`void` | `setSubType(java.lang.String subtype)` Set the MultiPart Mime subtype.
`java.lang.String` | `toString()` String representation for debug purposes.
`void` | `writeTo(java.io.OutputStream os)` Encode the root part or multipart and write to an OutputStream.

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

Field Detail

### parts

    protected MimeMultipart parts

### bag

    protected java.util.Hashtable bag

### loader

    protected java.lang.ClassLoader loader

### multiRef

    protected java.util.Vector multiRef

### deserializedMultiRef

    protected java.util.Hashtable deserializedMultiRef

### currentId

    protected java.lang.String currentId

### rootPartSet

    protected boolean rootPartSet

  This flag indicates if setRootPart() was called, so we can distinguish default root part resolution from deliberate root part indication. Effect: calling setRootPart() twice will replace the original root part.

Constructor Detail

### SOAPContext

    public SOAPContext()

  Constructor.

Method Detail

### readMultipart

    public void readMultipart(DataSource ds)
                       throws MessagingException

  Initialise MIME multipart object from a data source.
  Parameters:
    `ds` - a DataSource object to read from
    `MessagingException`

### getBodyPart

    public MimeBodyPart getBodyPart(int index)

  Get the specified Part. Parts are numbered starting at 0.
  Parameters:
    `index` - the index of the desired Part
  Returns:
    the Part, or null if no such part exists.

### getBodyPart

    public MimeBodyPart getBodyPart(java.lang.String CID)

  Get the Mimepart referred to by the given ContentID (CID). Returns null if the part is not found.
  Parameters:
    `CID` - the ContentID of the desired part
  Returns:
    the Part, or null if no such part exists.

### findBodyPart

    public MimeBodyPart findBodyPart(java.lang.String uri)

  Find the Mimepart referred to by the given URI. This can be:
  - An absolute URI, in which case a part is located with a corresponding Content-Location header.
  - A relative URI, in which case an absolute URI is constructed relative to the Content-Location header of the root SOAP part or the multipart and the previous rule is then applied.
  - A URI of the format "cid:xxx"> in which case a part is located with a matching Content-ID header.
  Returns null if the part is not found.

  Note: relative URIs not entirely implemented yet.

  Parameters:
    `uri` - the URI
  Returns:
    the Part or null if not found

### getBaseURI

    public java.lang.String getBaseURI()

  Determine the document's base URI, according to the following scheme:
  1. The Content-Location header of the root (SOAP) part.
  2. The Content-Location header of the multipart. (not implemented)
  3. "thismessage:/"

### findPartByLocation

    public MimeBodyPart findPartByLocation(java.lang.String uri)

  Find the Mimepart referred to by the given URI. This can be:
  - An absolute URI, in which case a part is located with a corresponding Content-Location header.
  - A relative URI, in which case an absolute URI is constructed relative to the Content-Location header of the root SOAP part or the multipart and the previous rule is then applied.
  Returns null if the part is not found.

  Note: relative URIs not entirely implemented yet. We also can't pick up the base URI from the multipart (transport) headers yet, only from the root (SOAP) part.

  Parameters:
    `uri` - the URI
  Returns:
    the Part or null if not found

### addBodyPart

    public void addBodyPart(MimeBodyPart part)
                     throws MessagingException

  Adds a Part. The BodyPart is appended to the list of existing Parts.
  Parameters:
    `part` - The Part to be appended
  Throws:
    `MessagingException`
    `IllegalWriteException` - if the underlying implementation does not support modification of existing values

### addBodyPart

    public void addBodyPart(MimeBodyPart part,
                            int index)
                     throws MessagingException,
                            java.lang.IllegalArgumentException

  Adds a MimeBodyPart at position `index`. If `index` is not the last one in the list, the subsequent parts are shifted up. If `index` is larger than the number of parts present, the MimeBodyPart is appended to the end.
  Parameters:
    `part` - The BodyPart to be inserted
    `index` - Location where to insert the part
  Throws:
    `MessagingException`
    `IllegalWriteException` - if the underlying implementation does not support modification of existing values
    `java.lang.IllegalArgumentException` - if the part cannot be made into an attachment for some reason

### removeBodyPart

    public void removeBodyPart(MimeBodyPart part)
                        throws MessagingException

  Remove a body part.
    `MessagingException`

### setRootPart

    public void setRootPart(MimeBodyPart part)
                     throws MessagingException

  Adds the root BodyPart. Add it in the first position, create a unique Content ID and set the "start" Content-Type header modifier that that.

  Calling this method twice will replace the previous root part with the new one.

  Parameters:
    `part` - The BodyPart to be inserted
  Throws:
    `MessagingException`

### setRootPart

    public void setRootPart(java.lang.String s,
                            java.lang.String contentType)
                     throws MessagingException,
                            java.io.IOException

  Set the root part to a provided string (usually the SOAP envelope). The string will be UTF-8 encoded.
  Parameters:
    `s` - The String to be inserted
    `contentType` - the Content-Type of the root part
  Throws:
    `MessagingException`
    `java.io.IOException`

### setRootPart

    public void setRootPart(byte[] b,
                            java.lang.String contentType)
                     throws MessagingException

  Set the root part to a provided string (usually the SOAP envelope). The string will be UTF-8 encoded.
  Parameters:
    `b` - The String to be inserted
    `contentType` - the Content-Type of the root part
  Returns:
    "start" Content-Type header modifier
  Throws:
    `MessagingException`

### getRootPart

    public MimeBodyPart getRootPart()
                             throws MessagingException

  Find the root part. For multipart, search for a "start" Content-Type header modifier, if not present or invalid, assume the first part is the root.
  Returns:
    document root BodyPart
  Throws:
    `MessagingException`

### setSubType

    public void setSubType(java.lang.String subtype)
                    throws MessagingException

  Set the MultiPart Mime subtype. This method should be invoked only on a new MimeMultipart object created by the client. The default subtype of such a multipart object is "related".
  Parameters:
    `subtype` - Subtype
  Throws:
    `MessagingException`

### isRootPartSet

    public boolean isRootPartSet()

  Returns true is setRootPart() has been called.

### getCount

    public int getCount()
                 throws MessagingException

  Return the number of enclosed BodyPart objects.
  Returns:
    number of parts
    `MessagingException`

### getContentType

    public java.lang.String getContentType()
                                    throws MessagingException

  Return the content-type
  Returns:
    content type of the Mime multipart if there's more than one part, or of the root part if there's only one part
    `MessagingException`

### writeTo

    public void writeTo(java.io.OutputStream os)
                 throws java.io.IOException,
                        MessagingException

  Encode the root part or multipart and write to an OutputStream.
  Parameters:
    `os` - stream to write to
  Throws:
    `java.io.IOException`
    `MessagingException`

### setProperty

    public void setProperty(java.lang.String name,
                            java.lang.Object value)

  Store something in the hold-all 'bag'

### getProperty

    public java.lang.Object getProperty(java.lang.String name)

  Look for something in the hold-all 'bag'

### removeProperty

    public java.lang.Object removeProperty(java.lang.String name)

  Remove something from the hold-all 'bag'

### getPropertyNames

    public java.util.Enumeration getPropertyNames()

  Return the entire list of 'names' in the hold-all 'bag'

### setClassLoader

    public void setClassLoader(java.lang.ClassLoader cl)

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

### loadClass

    public java.lang.Class loadClass(java.lang.String className)
                              throws java.lang.ClassNotFoundException

    `java.lang.ClassNotFoundException`

### getCurrentId

    public java.lang.String getCurrentId()

  Gets the id attribute for the element currently being deserialized. This will be null if there is no current id.
  Returns:
    The current id.

### setCurrentId

    public void setCurrentId(java.lang.String id)

  Sets the id attribute for the element currently being deserialized. This will be null if there is no current id.
  Parameters:
    `id` - The current id.

### addMultiRef

    public int addMultiRef(java.lang.Object obj,
    Serializer ser)

  Adds a multiRef element. This may actually add the object, or it may simply return the id of the object as previously added. The id of the object is always between 0 and the count of multiRefs minus 1.
  Parameters:
    `obj` - The object for which a multiRef is desired.
    `ser` - The serializer with which to serialize the object.
  Returns:
    The id of the element.

### getMultiRefObject

    public java.lang.Object getMultiRefObject(int id)

  Gets the multiRef object for a particular id.
  Parameters:
    `id` - The id.
  Returns:
    The multiRef object for the id.

### getMultiRefSerializer

    public Serializer getMultiRefSerializer(int id)

  Gets the multiRef serializer for a particular id.
  Parameters:
    `id` - The id.
  Returns:
    The multiRef serializer for the id.

### getMultiRefCount

    public int getMultiRefCount()

  Gets the number of multiRefs. The multiRefs have id from 0 to count - 1.
  Returns:
    The number of multiRefs.

### addDeserializedMultiRef

    public void addDeserializedMultiRef(java.lang.String id,
                                        java.lang.Object o)

  Adds the multiRef deserialized for a particular id.
  Parameters:
    `id` - The element id, as referred to by an href.
    `o` - The deserialized object.

### getDeserializedMultiRef

    public java.lang.Object getDeserializedMultiRef(java.lang.String id)

  Gets the multiRef deserialized for a particular id.
  Parameters:
    `id` - The id, as referred to by an href.
  Returns:
    The multiRef for the id.

### toString

    public java.lang.String toString()

  String representation for debug purposes.
  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 The Apache Software Foundation. All rights reserved.