Interface UrlFormat
-
@ConsumerType @Deprecated public interface UrlFormat
Deprecated.Consumers may implement this interface to provide a customUrlFormat
to theUrlProvider
implementation.The implementation(s) of this interface must be registered as OSGI service and must have the
PROP_USE_AS
property set. TheUrlFormat
with thePROP_USE_AS
set toPRODUCT_PAGE_URL_FORMAT
will be used by theUrlProvider
implementation to format and parse product urls, theUrlFormat
registered withCATEGORY_PAGE_URL_FORMAT
to format and parse category urls.If any
UrlFormat
is registered as described above, it overrides the configured behaviour of theUrlProvider
implementation. Implementing aUrlFormat
is optional.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CATEGORY_PAGE_URL_FORMAT
Deprecated.The value of thePROP_USE_AS
property to be set when theUrlFormat
should be used to format and parse category urls.static String
CLOSING_BRACKETS
Deprecated.ACharSequence
to be used to write defaults to the format when a mandatory parameter is missing.static String
OPENING_BRACKETS
Deprecated.ACharSequence
to be used to write defaults to the format when a mandatory parameter is missing.static String
PRODUCT_PAGE_URL_FORMAT
Deprecated.The value of thePROP_USE_AS
property to be set when theUrlFormat
should be used to format and parse product urls.static String
PROP_USE_AS
Deprecated.The service registration property used to identify the purpose of theUrlFormat
.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description String
format(Map<String,String> parameters)
Deprecated.Formats an URL with the given parameters.Set<String>
getParameterNames()
Deprecated.Returns a set of all parameter names the url format implementation supports when parsing a pathinfo.Map<String,String>
parse(org.apache.sling.api.request.RequestPathInfo requestPathInfo, org.apache.sling.api.request.RequestParameterMap parameterMap)
Deprecated.Parses a given request URI using the internal configured pattern.
-
-
-
Field Detail
-
PROP_USE_AS
static final String PROP_USE_AS
Deprecated.The service registration property used to identify the purpose of theUrlFormat
. It can either be set toPRODUCT_PAGE_URL_FORMAT
orCATEGORY_PAGE_URL_FORMAT
.When- See Also:
- Constant Field Values
-
PRODUCT_PAGE_URL_FORMAT
static final String PRODUCT_PAGE_URL_FORMAT
Deprecated.The value of thePROP_USE_AS
property to be set when theUrlFormat
should be used to format and parse product urls.- See Also:
- Constant Field Values
-
CATEGORY_PAGE_URL_FORMAT
static final String CATEGORY_PAGE_URL_FORMAT
Deprecated.The value of thePROP_USE_AS
property to be set when theUrlFormat
should be used to format and parse category urls.- See Also:
- Constant Field Values
-
OPENING_BRACKETS
static final String OPENING_BRACKETS
Deprecated.ACharSequence
to be used to write defaults to the format when a mandatory parameter is missing.Consumers can check formatted urls on the existence of this
CharSequence
to identify urls that failed formatting.Example usage:
parameters.getOrDefault(key, OPENING_BRACKETS + key + CLOSING_BRACKETS)
- See Also:
- Constant Field Values
-
CLOSING_BRACKETS
static final String CLOSING_BRACKETS
Deprecated.ACharSequence
to be used to write defaults to the format when a mandatory parameter is missing.Consumers can check formatted urls on the existence of this
CharSequence
to identify urls that failed formatting.Example usage:
parameters.getOrDefault(key, OPENING_BRACKETS + key + CLOSING_BRACKETS)
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
String format(Map<String,String> parameters)
Deprecated.Formats an URL with the given parameters.- Parameters:
parameters
- the URL parameters to be applied to the URL according to the internal format- Returns:
- the formated URL
-
parse
Map<String,String> parse(org.apache.sling.api.request.RequestPathInfo requestPathInfo, org.apache.sling.api.request.RequestParameterMap parameterMap)
Deprecated.Parses a given request URI using the internal configured pattern.Returns a
Map
with up to all the parameter names returned bygetParameterNames()
.Passing the returned
Map
of parameters intoformat(Map)
must return the same pathInfo as used as input before.- Parameters:
requestPathInfo
- the request path info object used to extra the URL information fromparameterMap
- the request parameters the implementation may consider when parsing the url- Returns:
- a map containing the parsed URL elements
-
getParameterNames
Set<String> getParameterNames()
Deprecated.Returns a set of all parameter names the url format implementation supports when parsing a pathinfo.This may return more parameters, than the url format uses in
format(Map)
.- Returns:
- all supported parameter names.
-
-