String characterEncoding = context.getResponseWriter().getCharacterEncoding();
boolean first = true;
Set<String> usedParameters = new HashSet<String>();
boolean conversationIdEncoded = false;
Page page = Pages.instance().getPage(viewId);
for ( Object child: getChildren() )
{
if (child instanceof UIParameter)
{
UIParameter uip = (UIParameter) child;
if ( uip.getValue()!=null )
{
encodedUrl += getParameterString(characterEncoding, uip, first);
first = false;
if ( uip.getName().equals( page.getConversationIdParameter().getParameterName() ) )
{
conversationIdEncoded = true;
}
}
usedParameters.add( uip.getName() );
}
}
if (viewId!=null)
{
Map<String, Object> pageParameters = Pages.instance().getConvertedParameters(context, viewId, usedParameters);
for ( Map.Entry<String, Object> me: pageParameters.entrySet() )
{
UIParameter uip = new UIParameter();
uip.setName( me.getKey() );
uip.setValue( me.getValue() );
encodedUrl += getParameterString(characterEncoding, uip, first);
first = false;
if (!conversationIdEncoded && me.getKey().equals(page.getConversationIdParameter().getParameterName()))
{
conversationIdEncoded = true;
}
}
}