org.jboss.resteasy.plugins.providers.multipart
Class ContentIDUtils

java.lang.Object
  extended by org.jboss.resteasy.plugins.providers.multipart.ContentIDUtils

public class ContentIDUtils
extends java.lang.Object

Utility class to help generate, convert RFC compliant Content-ID and cid.

Author:
Attila Kiraly

Field Summary
static java.lang.String CID_URL_SCHEME
           
 
Constructor Summary
ContentIDUtils()
           
 
Method Summary
static java.lang.String convertCidToContentID(java.lang.String cid)
           
static java.lang.String convertContentIDToCid(java.lang.String contentID)
           
static java.lang.String generateCidFromAddrSpec(java.lang.String addrSpec)
          Helper method to generate a standards-compliant cid url from the supplied addrSpec.
static java.lang.String generateContentID()
          Calls generateContentIDFromAddrSpec(String) with generateRFC822AddrSpec() as parameter.
static java.lang.String generateContentIDFromAddrSpec(java.lang.String addrSpec)
          Helper method to generate a standards-compliant Content-ID header value from the supplied addrSpec.
static java.lang.String generateRFC822AddrSpec()
          Helper method to generate a standards-compliant, random addr-spec as described in RFC822.
static java.lang.String parseAddrSpecFromCid(java.lang.String cid)
           
static java.lang.String parseAddrSpecFromContentID(java.lang.String contentID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CID_URL_SCHEME

public static final java.lang.String CID_URL_SCHEME
See Also:
Constant Field Values
Constructor Detail

ContentIDUtils

public ContentIDUtils()
Method Detail

generateContentID

public static java.lang.String generateContentID()
Calls generateContentIDFromAddrSpec(String) with generateRFC822AddrSpec() as parameter.

Returns:
the generated Content-ID

generateContentIDFromAddrSpec

public static java.lang.String generateContentIDFromAddrSpec(java.lang.String addrSpec)
Helper method to generate a standards-compliant Content-ID header value from the supplied addrSpec. Used rfc-s: RFC2045, RFC822

Returns:
the generated Content-ID

generateRFC822AddrSpec

public static java.lang.String generateRFC822AddrSpec()
Helper method to generate a standards-compliant, random addr-spec as described in RFC822.

Returns:
the generated addrSpec

generateCidFromAddrSpec

public static java.lang.String generateCidFromAddrSpec(java.lang.String addrSpec)
Helper method to generate a standards-compliant cid url from the supplied addrSpec. This implementation URL encodes everything without considering if it is needed or not. Used rfc-s: RFC2392, RFC822

Returns:
the generated Content-ID

parseAddrSpecFromCid

public static java.lang.String parseAddrSpecFromCid(java.lang.String cid)
Parameters:
cid - the RFC2392 compliant cid
Returns:
the RFC822 defined addr-spec decoded from the cid

parseAddrSpecFromContentID

public static java.lang.String parseAddrSpecFromContentID(java.lang.String contentID)
Parameters:
contentID - the RFC2045 compliant Content-ID
Returns:
the RFC822 defined addr-spec decoded from the contentID

convertCidToContentID

public static java.lang.String convertCidToContentID(java.lang.String cid)
Parameters:
cid - the RFC2392 compliant cid
Returns:
the RFC2045 compliant Content-ID representing the cid

convertContentIDToCid

public static java.lang.String convertContentIDToCid(java.lang.String contentID)
Parameters:
contentID - the RFC2045 compliant Content-ID
Returns:
the RFC2392 compliant cid representing the contentID


Copyright © 2009. All Rights Reserved.