To create link URLs on a particular page to different navigation
states within your application, modify the
UrlState
and then transform the modified
UrlState
to a URL string.
This procedure
requires that you have an informed
UrlState
representing the current navigation state of
your page.
To create a link URL, follow these steps:
Modify the
UrlState
to reflect a different navigation state in your application.For example, the following statement creates a refinement link for a Guided Navigation component in your application:
UrlState refinedUrlState = informedUrlState.selectRefinement(refDim, refDimVal, true);
The final parameter indicates whether the modification should be performed on a cloned version of the current
UrlState
, and should typically betrue
. For instance, in the case of a Guided Navigation component, you would loop through the possible refinements and create a modifiedUrlState
based on the currentUrlState
for each refinement link. If you wanted to select several refinements in the same URL, you would passfalse
as the value of this parameter.For further details about additional methods that can be used to modify a
UrlState
, please refer to the Assembler API Reference (Javadoc).Generate the URL string from the modified
UrlState
.String refinedUrl = refinedUrlState.toString();
The
UrlState.toString()
method calls theformatString()
method of theUrlFormatter
that constructed theUrlState
instance.