001// Copyright 2007, 2008 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.tapestry5.services;
016
017import org.apache.tapestry5.MarkupWriter;
018import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
019import org.apache.tapestry5.json.JSONObject;
020
021/**
022 * Defines an Ajax-oriented partial page render, wherein a render of a portion of a page occurs, and the content is
023 * stored into a key ("content") of a {@link org.apache.tapestry5.json.JSONObject}, which is sent to the client side as
024 * the final response.  Client-side JavaScript receives this reply and uses it to update a portion of the page.
025 * <p/>
026 * <p/>
027 * The PartialMarkupRenderer service takes an ordered configuration of {@link PartialMarkupRendererFilter}s.  It can be
028 * selected using the {@link org.apache.tapestry5.ioc.annotations.Primary} marker annotation.
029 */
030@UsesOrderedConfiguration(PartialMarkupRendererFilter.class)
031public interface PartialMarkupRenderer
032{
033    /**
034     * Implementations should perform work before or after passing the writer to the renderer.
035     *
036     * @param writer to which markup should be written
037     * @param reply  JSONObject which will contain the partial response
038     */
039    void renderMarkup(MarkupWriter writer, JSONObject reply);
040}