Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.gateway
Class GatewayUtil

java.lang.Object
  extended by com.jivesoftware.forum.gateway.GatewayUtil

public class GatewayUtil
extends java.lang.Object


Field Summary
static java.lang.String[] AGENT_HEADER_NAMES
          List of likely headers which can contain user agent info
static java.lang.String DEFAULT_CHARACTER_SET
           
static java.lang.String DUMMY_PARENT_HEADER
          Used to mark a message as a Jive created message
static java.lang.String GATEWAY_MESSAGE_ID
           
static java.lang.String USER_AGENT_PROPERTY
          Used to store user agent which posted the message as a message property.
 
Constructor Summary
protected GatewayUtil()
           
 
Method Summary
static java.lang.String cleanseHTMLForImport(java.lang.String html)
          Prepares a full HTML document to be imported as a forum message.
static java.lang.String getCharacterSet(java.lang.String contentType, java.lang.String defaultCharacterSet)
           
static java.lang.String getEncodedSpace(java.lang.String charset, java.lang.String encoding)
           
static java.lang.String getFromEmail(java.lang.String fromHeader)
          Retrieve the from email address from the provided message object.
static java.lang.String getFromName(java.lang.String fromHeader)
          Retrieve the from email name.
static java.lang.String getRFC2047DecodedString(java.lang.String str)
          Utility method to decode strings that may have rfc 2047 encoded words in them.
static java.lang.String getTranslatedFooter(ForumMessage message, java.lang.String exportFooter)
          Gets the export footer for a message, which is the footer with all tokens replaced with correct values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARACTER_SET

public static final java.lang.String DEFAULT_CHARACTER_SET
See Also:
Constant Field Values

DUMMY_PARENT_HEADER

public static final java.lang.String DUMMY_PARENT_HEADER
Used to mark a message as a Jive created message

See Also:
Constant Field Values

USER_AGENT_PROPERTY

public static final java.lang.String USER_AGENT_PROPERTY
Used to store user agent which posted the message as a message property.

See Also:
Constant Field Values

AGENT_HEADER_NAMES

public static final java.lang.String[] AGENT_HEADER_NAMES
List of likely headers which can contain user agent info


GATEWAY_MESSAGE_ID

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

GatewayUtil

protected GatewayUtil()
Method Detail

getTranslatedFooter

public static java.lang.String getTranslatedFooter(ForumMessage message,
                                                   java.lang.String exportFooter)
Gets the export footer for a message, which is the footer with all tokens replaced with correct values.


cleanseHTMLForImport

public static java.lang.String cleanseHTMLForImport(java.lang.String html)
Prepares a full HTML document to be imported as a forum message. This means cutting out all content except the body and then moving any style information in-line.

Parameters:
html - the original HTML document.
Returns:
a sanitized version ready to become a forum message body.

getFromEmail

public static java.lang.String getFromEmail(java.lang.String fromHeader)
Retrieve the from email address from the provided message object.

Don't let javaMail parse the address since it sometimes won't handle odd addresses.

In most cases we default to returning the whole from string if we can't determine the email address because of a poorly formatted header.

Parameters:
fromHeader - the from header.
Returns:
String the from email address.

getFromName

public static java.lang.String getFromName(java.lang.String fromHeader)
Retrieve the from email name.

Don't let javaMail parse the address since it sometimes won't handle odd addresses like the following one I found "Mike [remove (SPAM_BLOCKER) from my email address to reply]"

In most cases we default to returning the whole from string if we can't determine the name because of a poorly formatted header.

Parameters:
fromHeader - the from header.
Returns:
String the from name.

getRFC2047DecodedString

public static java.lang.String getRFC2047DecodedString(java.lang.String str)
Utility method to decode strings that may have rfc 2047 encoded words in them.

Parameters:
str - the string to decode.
Returns:
the decoded string.

getEncodedSpace

public static java.lang.String getEncodedSpace(java.lang.String charset,
                                               java.lang.String encoding)
                                        throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

getCharacterSet

public static java.lang.String getCharacterSet(java.lang.String contentType,
                                               java.lang.String defaultCharacterSet)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.