Search in sources :

Example 1 with TagAttributeException

use of javax.faces.view.facelets.TagAttributeException in project muikku by otavanopisto.

the class EmbedJSF method apply.

@Override
public void apply(FaceletContext context, UIComponent uiComponent) throws IOException {
    String unencoded = (String) jsfString.getObject(context, String.class);
    String encoded = Base64.encodeBase64String(unencoded.getBytes());
    VariableMapper orig = context.getVariableMapper();
    context.setVariableMapper(new VariableMapperWrapper(orig));
    try {
        this.nextHandler.apply(context, null);
        context.includeFacelet(uiComponent, new URL(null, "data://text/plain;base64," + encoded, new DataStreamHandler()));
    } catch (IOException e) {
        throw new TagAttributeException(this.tag, this.jsfString, "Invalid embedded JSF: " + unencoded);
    } finally {
        context.setVariableMapper(orig);
    }
}
Also used : TagAttributeException(javax.faces.view.facelets.TagAttributeException) VariableMapper(javax.el.VariableMapper) VariableMapperWrapper(com.sun.faces.facelets.el.VariableMapperWrapper) IOException(java.io.IOException) URL(java.net.URL)

Aggregations

VariableMapperWrapper (com.sun.faces.facelets.el.VariableMapperWrapper)1 IOException (java.io.IOException)1 URL (java.net.URL)1 VariableMapper (javax.el.VariableMapper)1 TagAttributeException (javax.faces.view.facelets.TagAttributeException)1