public class HTTPLocation extends Object
BindingOperation
component which maps to the whttp:location
extension attribute of the WSDL binding <operation> element, as defined by the
WSDL 2.0 HTTP binding extensions.
The value of the whttp:location
attribute may contain templates in which elements
from the instance data of the message to be serialized in the request IRI are cited by
enclosing their local name within curly braces.
A template can then be substituted by matching the local name against an element in the instance
data and replacing the template in the HTTP Location with the String value of that element.
For example, consider the HTTP Location "temperature/{town}" and the message data element
<town>Sydney</town>
.
After substitution, the formatted HTTP Location is "temperature/Sydney". Note, that the entire
template "{town}" is replaced by the matching element's value, "Sydney".
If a template is not matched against the instance data, it is replaced in the formatted HTTP Location by the empty string (in other words, it is omitted).
This class has one constructor and this takes a String representing a
whttp:location
value, which may contain the curly brace templates
described above.
The class can perform template substitution and return the formatted HTTP Location
resulting from such substitution. It can also return the original HTTP Location
value specified on the constructor, so that even after substitution it is possible to
see where any templates were used.
This class uses the EBNF grammar defined for {http location} by the WSDL 2.0 HTTP binding extensions to parse and validate the original HTTP Location string. It checks that any single left and right curly braces are correctly paired to enclose a String that is of the correct type to represent an element local name (that is, a String of type xs:NCName).
It also supports the double curly brace syntax used to represent a literal single curly brace in the formatted HTTP Location. That is, a double curly brace escapes a literal single curly brace to avoid mistaking it for a template. For example, "abc{{def" is formatted as "abc{def" and this literal left brace is not interpreted as the beginning of a template.
Constructor and Description |
---|
HTTPLocation(String location)
Creates an HTTPLocation object to represent the specified HTTP Location String value.
|
Modifier and Type | Method and Description |
---|---|
String |
getFormattedLocation()
Returns a formatted String representing the original HTTP Location modified by any
template substitution that has taken place via the
substitute methods. |
String |
getOriginalLocation()
Returns the original HTTP Location String specified when this object
was created.
|
HTTPLocationTemplate |
getTemplate(String name)
Return the first template with the specified name from the HTTP Location string
or null if no such template is exists.
|
HTTPLocationTemplate |
getTemplateInPath(String name)
Return the first template with the specified name from the URI Path portion of
the HTTP Location string or null if no such template exists.
|
HTTPLocationTemplate |
getTemplateInQuery(String name)
Return the first template with the specified name from the URI Query portion of
the HTTP Location string or null if no such template exists.
|
String[] |
getTemplateNames()
Return the names of the templates that appear in the HTTP Location string
in the order they appear.
|
String[] |
getTemplateNamesInPath()
Return the names of the templates that appear in the URI Path portion of the
HTTP Location string in the order they appear.
|
String[] |
getTemplateNamesInQuery()
Return the names of the templates that appear in the URI Query portion of the
HTTP Location string in the order they appear.
|
HTTPLocationTemplate[] |
getTemplates()
Return the templates that appear in the HTTP Location string in
the order they appear.
|
HTTPLocationTemplate[] |
getTemplates(String name)
Return the templates with the specified name from the HTTP Location string .
|
HTTPLocationTemplate[] |
getTemplatesInPath()
Return the templates that appear in the URI Path portion of the HTTP Location
string in the order they appear.
|
HTTPLocationTemplate[] |
getTemplatesInPath(String name)
Return the templates with the specified name from the URI Path portion of the
HTTP Location string.
|
HTTPLocationTemplate[] |
getTemplatesInQuery()
Return templates that appear in the URI Query portion of the HTTP Location
string in the order they appear.
|
HTTPLocationTemplate[] |
getTemplatesInQuery(String name)
Return the templates with the specified name from the URI Query portion of the
HTTP Location string.
|
boolean |
isLocationValid()
Indicates whether the original HTTP Location string used to create this object
is valid.
|
String |
toString()
Same behaviour as getFormattedLocation()
|
public HTTPLocation(String location)
whttp:location
attribute within
a binding operation element.
The location template String argument must not be null.
location
- the String value of the http locationpublic boolean isLocationValid()
public String getOriginalLocation()
public String getFormattedLocation()
substitute
methods.
Templates that have not been matched against any element from the instance data
will be omitted from the formatted String.
An unmatched template is indicated by an HTTPLocationTemplate object whose value is null.
If the original HTTP Location does not contain any templates then substitution
is not applicable and this method will return the same String returned by the
getOriginalLocation()
method.
If the HTTP Locationis invalid this method will return null.
public String toString()
public HTTPLocationTemplate[] getTemplates()
public HTTPLocationTemplate[] getTemplatesInPath()
public HTTPLocationTemplate[] getTemplatesInQuery()
public String[] getTemplateNames()
public String[] getTemplateNamesInPath()
public String[] getTemplateNamesInQuery()
public HTTPLocationTemplate getTemplate(String name)
If the HTTP Location is invalid this method will return null.
public HTTPLocationTemplate[] getTemplates(String name)
public HTTPLocationTemplate getTemplateInPath(String name)
If the HTTP Location is invalid this method will return null.
public HTTPLocationTemplate[] getTemplatesInPath(String name)
public HTTPLocationTemplate getTemplateInQuery(String name)
If the HTTP Location is invalid this method will return null.
public HTTPLocationTemplate[] getTemplatesInQuery(String name)
Copyright © 2005–2013 Apache Software Foundation. All rights reserved.