001 // Copyright 2004, 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 package org.apache.tapestry.services; 015 016 import java.io.IOException; 017 018 import org.apache.tapestry.IRequestCycle; 019 020 021 /** 022 * Determines if the particular incoming ajax request is handled by this 023 * contributor/library response type. If it is will also provide an instance 024 * of the appropriate ResponseBuilder. 025 * 026 * @author jkuhnert 027 */ 028 public interface ResponseContributor { 029 030 /** 031 * Determines if the incoming ajax request is capable of being 032 * handled by the {@link ResponseBuilder} this contributor 033 * manages. 034 * 035 * @param cycle 036 * Main request cycle for this request. 037 * @return True if can handle request, false otherwise. 038 */ 039 boolean handlesResponse(IRequestCycle cycle); 040 041 /** 042 * Creates the appropriate {@link ResponseBuilder} instance to handle the 043 * incoming ajax request. 044 * 045 * @param cycle 046 * The incoming request cycle for this request. 047 * 048 * @return A newly created response builder. 049 */ 050 ResponseBuilder createBuilder(IRequestCycle cycle) 051 throws IOException; 052 }