public class Message extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
_destinationUrl |
static String |
MODE_CANCEL |
static String |
MODE_IDRES |
static String |
MODE_SETUP_NEEDED |
static String |
OPENID2_NS |
Modifier | Constructor and Description |
---|---|
protected |
Message() |
protected |
Message(ParameterList params) |
Modifier and Type | Method and Description |
---|---|
void |
addExtension(MessageExtension extension)
Adds a set of extension-specific parameters to a message.
|
String |
addExtension(MessageExtension extension,
String preferredAlias)
Adds a set of extension-specific parameters to a message,
trying to use the supplied preferredAlias
if the supplied alias is not already taken.
|
static void |
addExtensionFactory(Class clazz)
Adds a new extension factory.
|
static Message |
createMessage() |
static Message |
createMessage(ParameterList params) |
String |
getDestinationUrl(boolean httpGet)
Gets the URL where the message should be sent, where applicable.
|
MessageExtension |
getExtension(String typeUri)
Gets a MessageExtension for the specified Type URI if an implementation
is available, or null otherwise.
|
String |
getExtensionAlias(String extensionTypeUri)
Retrieves the extension alias that will be used for the extension
identified by the supplied extension type URI.
|
static MessageExtensionFactory |
getExtensionFactory(String typeUri)
Gets a MessageExtensionFactory for the specified Type URI
if an implementation is available, or null otherwise.
|
Set |
getExtensions()
Gets a set of extension Type URIs that are present in the message.
|
protected Parameter |
getParameter(String name) |
Map |
getParameterMap() |
protected List |
getParameters() |
String |
getParameterValue(String name) |
List |
getRequiredFields() |
boolean |
hasExtension(String typeUri)
Returns true if the message has parameters for the specified
extension type URI.
|
static boolean |
hasExtensionFactory(String typeUri)
Returns true if there is an extension factory available for extension
identified by the specified Type URI, or false otherwise.
|
boolean |
hasParameter(String name) |
String |
keyValueFormEncoding() |
protected void |
set(String name,
String value) |
void |
validate()
Checks that all required parameters are present
|
String |
wwwFormEncoding() |
public static final String MODE_IDRES
public static final String MODE_CANCEL
public static final String MODE_SETUP_NEEDED
public static final String OPENID2_NS
protected String _destinationUrl
protected Message()
protected Message(ParameterList params)
public static Message createMessage() throws MessageException
MessageException
public static Message createMessage(ParameterList params) throws MessageException
MessageException
public boolean hasParameter(String name)
protected List getParameters()
public Map getParameterMap()
public void validate() throws MessageException
MessageException
public List getRequiredFields()
public String keyValueFormEncoding()
public String wwwFormEncoding()
public String getDestinationUrl(boolean httpGet)
httpGet
- If true, the wwwFormEncoding() is appended to the
destination URL; the return value should be used
with a GET-redirect.
If false, the verbatim destination URL is returned,
which should be used with a FORM POST redirect.wwwFormEncoding()
public static void addExtensionFactory(Class clazz) throws MessageException
clazz
- The implementation class for the extension factory,
must implement MessageExtensionFactory
.MessageException
public static boolean hasExtensionFactory(String typeUri)
typeUri
- The Type URI that identifies an extension.public static MessageExtensionFactory getExtensionFactory(String typeUri)
typeUri
- The Type URI that identifies a extension.Message
public boolean hasExtension(String typeUri)
typeUri
- The URI that identifies the extension.public Set getExtensions()
public String getExtensionAlias(String extensionTypeUri)
If the message contains no parameters for the specified extension, null will be returned.
extensionTypeUri
- The URI that identifies the extensionpublic void addExtension(MessageExtension extension) throws MessageException
The parameter names must NOT contain the "openid.
extension
- A MessageExtension containing parameters
to be added to the messageMessageException
public String addExtension(MessageExtension extension, String preferredAlias) throws MessageException
extension
- the extension to be added to this messagepreferredAlias
- the preferred alias to use for the extension's parametersMessageException
- if the preferredAlias could not be used
and this is a v1 messagepublic MessageExtension getExtension(String typeUri) throws MessageException
The returned object will contain the parameters from the message belonging to the specified extension.
typeUri
- The Type URI that identifies a extension.MessageException
Copyright © 2016 Sxip. All rights reserved.