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

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

public class ContentIDUtils
extends Object

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

Author:
Attila Kiraly

Field Summary
static String CID_URL_SCHEME
           
 
Constructor Summary
ContentIDUtils()
           
 
Method Summary
static String convertCidToContentID(String cid)
           
static String convertContentIDToCid(String contentID)
           
static String generateCidFromAddrSpec(String addrSpec)
          Helper method to generate a standards-compliant cid url from the supplied addrSpec.
static String generateContentID()
          Calls generateContentIDFromAddrSpec(String) with generateRFC822AddrSpec() as parameter.
static String generateContentIDFromAddrSpec(String addrSpec)
          Helper method to generate a standards-compliant Content-ID header value from the supplied addrSpec.
static String generateRFC822AddrSpec()
          Helper method to generate a standards-compliant, random addr-spec as described in RFC822.
static String parseAddrSpecFromCid(String cid)
           
static String parseAddrSpecFromContentID(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 String CID_URL_SCHEME
See Also:
Constant Field Values
Constructor Detail

ContentIDUtils

public ContentIDUtils()
Method Detail

generateContentID

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

Returns:
the generated Content-ID

generateContentIDFromAddrSpec

public static String generateContentIDFromAddrSpec(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 String generateRFC822AddrSpec()
Helper method to generate a standards-compliant, random addr-spec as described in RFC822.

Returns:
the generated addrSpec

generateCidFromAddrSpec

public static String generateCidFromAddrSpec(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 String parseAddrSpecFromCid(String cid)
Parameters:
cid - the RFC2392 compliant cid
Returns:
the RFC822 defined addr-spec decoded from the cid

parseAddrSpecFromContentID

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

convertCidToContentID

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

convertContentIDToCid

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


Copyright © 2013. All Rights Reserved.