001// Copyright 2005 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry.markup;
016
017import java.io.PrintWriter;
018
019import org.apache.tapestry.IMarkupWriter;
020import org.apache.tapestry.util.ContentType;
021
022/**
023 * Service interface for <code>tapestry.markup.MarkupWriterSource</code> service. A factory
024 * service that creates new instances of {@link org.apache.tapestry.IMarkupWriter}, configured for
025 * different content types;
026 * 
027 * @author Howard M. Lewis Ship
028 * @since 4.0
029 */
030public interface MarkupWriterSource
031{
032    /**
033     * Creates and returns a new instance of {@link org.apache.tapestry.IMarkupWriter}. The content
034     * type is used to find the proper implemenation. Any additional content type data (after a ';')
035     * is ignored.
036     * 
037     * @param writer
038     *            The {@link PrintWriter}&nbsp;to which the markup writer should send output.
039     * @param contentType
040     *            Used to locate the correct markup writer implementation (used to select a
041     *            {@link MarkupFilter}.
042     * @return The configured markup writer instance.
043     */
044
045    public IMarkupWriter newMarkupWriter(PrintWriter writer, ContentType contentType);
046}