Skip to content

Commit 7e2a261

Browse files
committed
Generated method to make easier customize url
1 parent 1a2c427 commit 7e2a261

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/component/renderer

‎config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/component/renderer/LinkRenderer.java‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class LinkRenderer extends Renderer
3737
{
3838
public static final String RENDERER_TYPE = "javax.faces.Link";
39-
private final PrettyURLBuilder urlBuilder = new PrettyURLBuilder();
39+
protected final PrettyURLBuilder urlBuilder = new PrettyURLBuilder();
4040

4141
@Override
4242
public void encodeBegin(final FacesContext context, final UIComponent component) throws IOException
@@ -73,8 +73,7 @@ public void encodeBegin(final FacesContext context, final UIComponent component)
7373
PrettyConfig prettyConfig = prettyContext.getConfig();
7474
UrlMapping urlMapping = prettyConfig.getMappingById(mappingId);
7575

76-
String href = context.getExternalContext().getRequestContextPath()
77-
+ urlBuilder.build(urlMapping, true, urlBuilder.extractParameters(component));
76+
String href = buildUrl(context, component, urlMapping);
7877

7978
if ((link.getAnchor() != null) && link.getAnchor().length() > 0)
8079
{
@@ -121,6 +120,11 @@ public void encodeBegin(final FacesContext context, final UIComponent component)
121120

122121
}
123122

123+
protected String buildUrl(FacesContext context, UIComponent component, UrlMapping urlMapping) {
124+
return context.getExternalContext().getRequestContextPath()
125+
+ urlBuilder.build(urlMapping, true, urlBuilder.extractParameters(component));
126+
}
127+
124128
private void writeAttr(final ResponseWriter writer, final String name, final String value) throws IOException
125129
{
126130
if (value != null)

0 commit comments

Comments
 (0)