private void renderXFC(FacesContext facesContext,
BridgeComponent bridgeComponent) throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
Bridge bridge = XulUtils.getBridge();
responseWriter.startElement("xfc:bridge", bridgeComponent);
for (Command command : bridge.getCommands()) {
StringBuffer stringBuffer = new StringBuffer("xfc:");
stringBuffer.append(command.getName());
if (log.isDebugEnabled()) {
log.debug("Command " + stringBuffer.toString() + " on "
+ command.getTarget());
}
responseWriter.startElement(stringBuffer.toString(),
bridgeComponent);
for (Parameter parameter : command.getParameters()) {
if (log.isDebugEnabled()) {
log.debug("parameter " + parameter.getName() + " value "
+ parameter.getValue());
}
responseWriter.writeAttribute(parameter.getName(), parameter
.getValue().toString(), null);
}
responseWriter.endElement(stringBuffer.toString());
}
facesContext.getApplication().getViewHandler().writeState(facesContext);
responseWriter.endElement("xfc:bridge");
bridge.getCommands().clear();
}