Coverage Report - org.apache.tapestry.services.impl.ResponseDelegateFactoryImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ResponseDelegateFactoryImpl
0%
0/10
0%
0/6
4
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 package org.apache.tapestry.services.impl;
 15  
 
 16  
 import java.io.IOException;
 17  
 import java.util.List;
 18  
 
 19  
 import org.apache.hivemind.ApplicationRuntimeException;
 20  
 import org.apache.tapestry.IRequestCycle;
 21  
 import org.apache.tapestry.services.ResponseBuilder;
 22  
 import org.apache.tapestry.services.ResponseContributor;
 23  
 import org.apache.tapestry.services.ResponseDelegateFactory;
 24  
 
 25  
 /**
 26  
  * Implementation of {@link ResponseDelegateFactory}.
 27  
  *
 28  
  * @author jkuhnert
 29  
  */
 30  0
 public class ResponseDelegateFactoryImpl implements ResponseDelegateFactory {
 31  
     
 32  
     /** Configured response contribution choosers. */
 33  
     protected List _responseContributors;
 34  
     
 35  
     /**
 36  
      * {@inheritDoc}
 37  
      */
 38  
     public ResponseBuilder getResponseBuilder(IRequestCycle cycle)
 39  
     throws IOException
 40  
     {
 41  0
         if (_responseContributors == null)
 42  0
             return null;
 43  
         
 44  0
         for (int i = 0; i < _responseContributors.size(); i++) {
 45  0
             ResponseContributor rc = (ResponseContributor)_responseContributors.get(i);
 46  0
             if (rc.handlesResponse(cycle))
 47  0
                 return rc.createBuilder(cycle);
 48  
         }
 49  
         
 50  0
         throw new ApplicationRuntimeException(ImplMessages.unknownRequest());
 51  
     }
 52  
     
 53  
     /**
 54  
      * Sets a configured list of {@link ResponseContributor} objects to be used
 55  
      * in processing ajax requests.
 56  
      * 
 57  
      * @param responseContributors
 58  
      */
 59  
     public void setResponseContributors(List responseContributors)
 60  
     {
 61  0
         this._responseContributors = responseContributors;
 62  0
     }
 63  
 }