Generates the HTML debug page for the current view
and writes it to the given writer.
@param writer
@param faces
@throws IOException
554497
public static void debugHtml(Writer writer, FacesContext faces) throws IOException
    {
        _init(faces);
        Date now = new Date();
        for (int i = 0; i < debugParts.length; i++)
        {
            if ("message".equals(debugParts[i]))
            {
                writer.write(faces.getViewRoot().getViewId());
            }
            else if ("now".equals(debugParts[i]))
            {
                writer.write(DateFormat.getDateTimeInstance().format(now));
            }
            else if ("tree".equals(debugParts[i]))
            {
                _writeComponent(faces, writer, faces.getViewRoot(), null, true);
            }
            else if ("extendedtree".equals(debugParts[i]))
            {
                _writeExtendedComponentTree(writer, faces);
            }
            else if ("vars".equals(debugParts[i]))
            {
                _writeVariables(writer, faces, faces.getViewRoot());
            }
            else
            {
                writer.write(debugParts[i]);
            }
        }
    }
1139109
public void writeHeader(Writer writer) 
        throws IOException
    {
        if (_state!=__MSG_EDITABLE)
            throw new IllegalStateException(__state[_state]+
                                            " is not EDITABLE");
        if (_header==null)
            throw new IllegalStateException("Response is destroyed");

        if (getHttpRequest().getDotVersion()>=0)
        {
            _state=__MSG_BAD;
            writer.write(_version);
            writer.write(' ');
            writer.write('0'+((_status/100)%10));
            writer.write('0'+((_status/10)%10));
            writer.write('0'+(_status%10));
            writer.write(' ');
            writer.write(getReason());
            writer.write(HttpFields.__CRLF);
            _header.write(writer);
        }
        _state=__MSG_SENDING;
    }
535070
public static void addAllHeadlines(final PrintWriter writer, final Headers headers) {
		PageContentHelper.addHeadlines(writer, headers.getHeadLines());
		PageContentHelper.addJsHeadlines(writer, headers.getHeadLines(Headers.JAVASCRIPT_HEADLINE));
		PageContentHelper.addCssHeadlines(writer, headers.getHeadLines(Headers.CSS_HEADLINE));
	}
463976
void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException {
        writer.writeStartElement(Element.INTERFACES.getLocalName());
        final Set<String> interfaces = modelNode.keys();
        for (String ifaceName : interfaces) {
            final ModelNode iface = modelNode.get(ifaceName);
            writer.writeStartElement(Element.INTERFACE.getLocalName());
            writeAttribute(writer, Attribute.NAME, ifaceName);
            // <any-* /> is just handled at the root
            if (iface.get(Element.ANY_ADDRESS.getLocalName()).asBoolean(false)) {
                writer.writeEmptyElement(Element.ANY_ADDRESS.getLocalName());
            } else {
                // Write the other criteria elements
                writeInterfaceCriteria(writer, iface, false);
            }
            writer.writeEndElement();
        }
        writer.writeEndElement();
    }
851783
protected void render(final PrintWriter writer, final int level) throws IOException {

		beginTag(writer, tag, empty, attrs, level, indent);

		if (!empty) {

			if (text != null) {
				writer.print(text);
			}

			if (newline) {
				writer.println();
			}

			for (Tag child : children) {
				child.render(writer, level + 1);
			}

			endTag(writer, tag, newline, level, indent);
		}
	}
650751
@Override
	protected void render(FacesContext context) throws IOException {

		// Generate the name definition or image element
		StringBuffer results = new StringBuffer(getElementOpen());

		prepareImageUrl(context, results);

		prepareAttribute(results, "name", getAttribute("name"));
		prepareAttribute(results, "align", getAttribute("align"));
		prepareAttribute(results, "border", getAttribute("border"));
		prepareAttribute(results, "value", getAttribute("value"));
		prepareAttribute(results, "accesskey", getAttribute("accesskey"));
		prepareAttribute(results, "tabindex", getAttribute("tabindex"));
		prepareAttribute(results, "disabled", getAttribute("disabled"));
		results.append(prepareStyles());
		results.append(prepareEventHandlers());
		results.append(" />");

		ResponseWriter writer = context.getResponseWriter();
		writer.write(results.toString());
	}
385583
@SuppressWarnings("unchecked")
	public void addWriter(RecordWriter<Record> writer)
	{
		// avoid using the array-list here to reduce one level of object indirection
		if (this.writers == null) {
			this.writers = new RecordWriter[] {writer};
		}
		else {
			RecordWriter<Record>[] ws = new RecordWriter[this.writers.length + 1];
			System.arraycopy(this.writers, 0, ws, 0, this.writers.length);
			ws[this.writers.length] = writer;
			this.writers = ws;
		}
	}
129370
private static void writeReader(
            final Reader reader,
            final FileWriter writer,
            final LineEndingStyle style
    ) throws IOException
    {
        final BufferedReader inbuff = new BufferedReader(reader);
        String inData;
        final String linesep =
                null == style ?
                        LineEndingStyle.LOCAL.getLineSeparator() :
                        style.getLineSeparator();
        while ((inData = inbuff.readLine()) != null) {
            writer.write(inData);
            writer.write(linesep);
        }
        inbuff.close();
    }
687484
@Override
	public void process(Writer writer)
	{
		try
		{
			template.process(data, writer);
		}
		catch (IOException e)
		{
			throw new RuntimeException("Error writing template to writer", e);
		}
		catch (TemplateException e)
		{
			throw new RuntimeException(e.getMessage(), e);
		}
	}
585283
public void writeEndPage() throws IOException {
		writer.openElement("document");
		writer.textElement("id", Integer.toString(_page.Id));
		writer.textElement("group", "0");
		writer.textElement("timestamp", formatTimestamp(_rev.Timestamp));
		writer.textElement("title", _page.Title.toString());
		writer.textElement("body", _rev.Text);
		writer.closeElement();
		_rev = null;
		_page = null;
	}
1334526
public void writeDialog() throws IOException {

        if (isForwarded()) {
            return;
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_START_WRITE_LIST_1, getListId()));
        }
        JspWriter out = getJsp().getJspContext().getOut();
        out.print(defaultActionHtml());
        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_END_WRITE_LIST_1, getListId()));
        }
    }
115756
private void renderApplication() throws IOException {
		StringBuilder sb = new StringBuilder();

		// First pages
		sb.append( renderDocumentTitle());
		sb.append( renderPageBreak());

		sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$
		sb.append( renderPageBreak());

		sb.append( renderDocumentIndex());
		sb.append( renderPageBreak());

		sb.append( startTable());
		sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$
		sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$
		sb.append( endTable());

		sb.append( renderApplicationDescription());
		sb.append( renderPageBreak());
		sb.append( renderSections( new ArrayList<String>( 0 )));

		// Render information about components
		sb.append( renderComponents());

		// Render information about initial instances
		sb.append( renderInstances());

		writeFileContent( sb.toString());
	}
93849
public void write(Writer writer) throws IOException {
    final Properties properties = new Properties();

    for (Map.Entry<DictionaryAttribute, String> e : getAttributes().entrySet()) {
      properties.setProperty(e.getKey().propertyName, e.getValue());
    }

    properties.store(writer, "# " + getClass().getName());
  }
302534
public function write(WriterInterface $writer)
    {
        try {
            switch ($this->writeView($writer)) {
                case self::WRITE_OK:
                    $status = 'OK';
                    break;

                case self::WRITE_EXTERNAL:
                    $status = 'skipped, marked as external';
                    break;

                default:
                    $status = 'unsupported';
                    break;
            }
            $this->getDocument()->addLog(sprintf('* %s: %s', $this->getRawViewName(), $status));
        } catch (\Exception $e) {
            $this->getDocument()->addLog(sprintf('* %s: ERROR', $this->getRawViewName()));
            throw $e;
        }

        return $this;
    }
558165
private void renderState(FacesContext context) throws IOException {
		// Get the view state and write it to the response..
		PartialViewContext pvc = context.getPartialViewContext();
		PartialResponseWriter writer = pvc.getPartialResponseWriter();
		String viewStateId = Util.getViewStateId(context);

		writer.startUpdate(viewStateId);
		String state = context.getApplication().getStateManager().getViewState(context);
		writer.write(state);
		writer.endUpdate();

		ClientWindow window = context.getExternalContext().getClientWindow();
		if (null != window) {
			String clientWindowId = Util.getClientWindowId(context);
			writer.startUpdate(clientWindowId);
			writer.write(window.getId());
			writer.endUpdate();
		}
	}
778384
protected String renderRadio(FacesContext facesContext,
                               UIInput uiComponent,
                               String value,
                               boolean disabled,
                               boolean checked,
                               boolean renderId,
                               Integer itemNum)
            throws IOException
    {
        String clientId = uiComponent.getClientId(facesContext);

        String itemId = (itemNum == null)? null : clientId + 
                facesContext.getNamingContainerSeparatorChar() + itemNum;

        ResponseWriter writer = facesContext.getResponseWriter();

        writer.startElement(HTML.INPUT_ELEM, uiComponent);

        if (itemId != null)
        {
            writer.writeAttribute(HTML.ID_ATTR, itemId, null);
        }
        else if (renderId)
        {
            writer.writeAttribute(HTML.ID_ATTR, clientId, null);
        }
        writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_RADIO, null);
        writer.writeAttribute(HTML.NAME_ATTR, clientId, null);

        if (disabled)
        {
            writer.writeAttribute(HTML.DISABLED_ATTR, HTML.DISABLED_ATTR, null);
        }

        if (checked)
        {
            writer.writeAttribute(HTML.CHECKED_ATTR, HTML.CHECKED_ATTR, null);
        }

        if (value != null)
        {
            writer.writeAttribute(HTML.VALUE_ATTR, value, null);
        }
        else
        {
            writer.writeAttribute(HTML.VALUE_ATTR, "", null);
        }
        
        Map<String, List<ClientBehavior>> behaviors = null;
        if (uiComponent instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
            
            long commonPropertiesMarked = 0L;
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
            }
            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderChangeEventProperty(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderEventProperties(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
                        commonPropertiesMarked, uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent, behaviors);
                if (isCommonEventsOptimizationEnabled(facesContext))
                {
                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
                            commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                        facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                }
                else
                {
                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                            facesContext, writer, uiComponent, behaviors);
                }
            }
            HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                    HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS);
        }
        else
        {
            HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                    HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE);
        }

        if (isDisabled(facesContext, uiComponent))
        {
            writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.DISABLED_ATTR, Boolean.TRUE, null);
        }

        writer.endElement(HTML.INPUT_ELEM);

        return itemId;
    }
495675
protected void renderInputBegin(FacesContext facesContext,
            UIComponent component) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();

        String clientId = component.getClientId(facesContext);

        writer.startElement(HTML.INPUT_ELEM, component);
        writer.writeAttribute(HTML.ID_ATTR, clientId, null);
        writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
        
        //allow extending classes to modify html input element's type
        String inputHtmlType = getInputHtmlType(component);
        writer.writeAttribute(HTML.TYPE_ATTR, inputHtmlType, null);

        renderValue(facesContext, component, writer);

        Map<String, List<ClientBehavior>> behaviors = null;
        if (component instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
            
            long commonPropertiesMarked = 0L;
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(component);
            }
            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderChangeEventProperty(writer, 
                        commonPropertiesMarked, component);
                CommonPropertyUtils.renderEventProperties(writer, 
                        commonPropertiesMarked, component);
                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
                        commonPropertiesMarked, component);
            }
            else
            {
                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, component, behaviors);
                if (isCommonEventsOptimizationEnabled(facesContext))
                {
                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(component);
                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
                            commonPropertiesMarked, commonEventsMarked, component, behaviors);
                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                        facesContext, writer, commonPropertiesMarked, commonEventsMarked, component, behaviors);
                }
                else
                {
                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, component, behaviors);
                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                            facesContext, writer, component, behaviors);
                }
            }
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabledAndEvents(writer, 
                        commonPropertiesMarked, component);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, component, 
                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
            }
        }
        else
        {
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabled(writer, 
                        CommonPropertyUtils.getCommonPropertiesMarked(component), component);
            }
            else
            {
                HtmlRendererUtils.renderHTMLAttributes(writer, component, 
                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
            }
        }

        if (isDisabled(facesContext, component))
        {
            writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
        }

        if (isAutocompleteOff(facesContext, component))
        {
            writer.writeAttribute(HTML.AUTOCOMPLETE_ATTR, AUTOCOMPLETE_VALUE_OFF, HTML.AUTOCOMPLETE_ATTR);
        }
    }