Re: h:link not rendered

Splash Forums PrettyFaces Users h:link not rendered Re: h:link not rendered

#23072

DusegrEsque
Member

I have played around a little and got it working with a slightly modified PrettyViewHandler class. When overriding method deriveViewId with this

public class PortalViewHandler extends PrettyViewHandler {

public PortalViewHandler(final ViewHandler viewHandler) {
super(viewHandler);
}

@Override
public String deriveViewId(final FacesContext facesContext, final String rawViewId) {
String viewId = super.deriveViewId(facesContext, rawViewId);
if (viewId == null) {
viewId = derivePhysicalViewId(facesContext, rawViewId, true);
}
return viewId;
}

protected String derivePhysicalViewId(FacesContext facesContext, String rawViewId, boolean checkPhysical) {
String canonicalViewId = new URLDuplicatePathCanonicalizer().canonicalize(rawViewId);
if (checkPhysical) {
FaceletsResourceResolver resourceResolver = new FaceletsResourceResolver(null);
return (resourceResolver.resolveUrl(canonicalViewId) != null) ? canonicalViewId : null;
}
return canonicalViewId;
}

}

everything works fine. The FacletsResourceResolver class resolves from the META-INF directory directly. The code is

public class FaceletsResourceResolver extends ResourceResolver {

private static final String MODULE_BASE_PATH = "/META-INF";

private ResourceResolver resolver;

public FaceletsResourceResolver(ResourceResolver resolver) {
this.resolver = resolver;
}

@Override
public URL resolveUrl(String path) {
if (path == null || path.isEmpty()) {
return null;
}
URL url = null;
// resolve from war
if (resolver != null) {
url = resolver.resolveUrl(path);
}
// resolve from jar
if (url == null) {
url = getClass().getResource(MODULE_BASE_PATH + path);
}
return url;
}

}

Would it be possible to provide a patch?