Coverage Report - org.apache.tapestry.services.impl.DojoAjaxResponseContributorImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
DojoAjaxResponseContributorImpl
0% 
0% 
1
 
 1  
 // Copyright May 8, 2006 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 org.apache.tapestry.IRequestCycle;
 17  
 import org.apache.tapestry.asset.AssetFactory;
 18  
 import org.apache.tapestry.engine.IEngineService;
 19  
 import org.apache.tapestry.markup.MarkupWriterSource;
 20  
 import org.apache.tapestry.services.RequestLocaleManager;
 21  
 import org.apache.tapestry.services.ResponseBuilder;
 22  
 import org.apache.tapestry.services.ResponseContributor;
 23  
 import org.apache.tapestry.web.WebRequest;
 24  
 import org.apache.tapestry.web.WebResponse;
 25  
 
 26  
 import java.io.IOException;
 27  
 import java.util.ArrayList;
 28  
 import java.util.List;
 29  
 
 30  
 
 31  
 /**
 32  
  * Handles determining dojo ajax requests.
 33  
  * 
 34  
  * @author jkuhnert
 35  
  */
 36  0
 public class DojoAjaxResponseContributorImpl implements ResponseContributor
 37  
 {
 38  
     public static final String DOJO_AJAX_HEADER = "dojo-ajax-request";
 39  
     
 40  
     private RequestLocaleManager _localeManager;
 41  
     
 42  
     private MarkupWriterSource _markupWriterSource;
 43  
     
 44  
     private WebResponse _webResponse;
 45  
     
 46  
     private WebRequest _webRequest;
 47  
     
 48  
     private String _exceptionPageName;
 49  
     
 50  
     private String _staleSessionPageName;
 51  
     
 52  
     private String _staleLinkPageName;
 53  
     
 54  
     private AssetFactory _assetFactory;
 55  
     
 56  
     private IEngineService _pageService;
 57  
     
 58  
     /** 
 59  
      * {@inheritDoc}
 60  
      */
 61  
     public ResponseBuilder createBuilder(IRequestCycle cycle)
 62  
         throws IOException
 63  
     {
 64  0
         List errorPages = new ArrayList();
 65  0
         errorPages.add(_exceptionPageName);
 66  0
         errorPages.add(_staleSessionPageName);
 67  0
         errorPages.add(_staleLinkPageName);
 68  
         
 69  0
         return new DojoAjaxResponseBuilder(cycle, _localeManager, 
 70  
                 _markupWriterSource,
 71  
                 _webResponse, errorPages, _assetFactory, 
 72  
                 _webResponse.getNamespace(), _pageService);
 73  
     }
 74  
     
 75  
     /** 
 76  
      * {@inheritDoc}
 77  
      */
 78  
     public boolean handlesResponse(IRequestCycle cycle)
 79  
     {
 80  0
         return _webRequest.getHeader(DOJO_AJAX_HEADER) != null;
 81  
     }
 82  
     
 83  
     public void setLocaleManager(RequestLocaleManager localeManager)
 84  
     {
 85  0
         _localeManager = localeManager;
 86  0
     }
 87  
     
 88  
     public void setMarkupWriterSource(MarkupWriterSource markupWriterSource)
 89  
     {
 90  0
         _markupWriterSource = markupWriterSource;
 91  0
     }
 92  
     
 93  
     public void setWebResponse(WebResponse webResponse)
 94  
     {
 95  0
         _webResponse = webResponse;
 96  0
     }
 97  
     
 98  
     public void setWebRequest(WebRequest webRequest)
 99  
     {
 100  0
         _webRequest  = webRequest;
 101  0
     }
 102  
     
 103  
     public void setExceptionPageName(String name)
 104  
     {
 105  0
         _exceptionPageName = name;
 106  0
     }
 107  
     
 108  
     public void setStaleSessionPageName(String name)
 109  
     {
 110  0
         _staleSessionPageName = name;
 111  0
     }
 112  
     
 113  
     public void setStaleLinkPageName(String name)
 114  
     {
 115  0
         _staleLinkPageName = name;
 116  0
     }
 117  
     
 118  
     public void setAssetFactory(AssetFactory factory)
 119  
     {
 120  0
         _assetFactory = factory;
 121  0
     }
 122  
     
 123  
     public void setPageService(IEngineService service)
 124  
     {
 125  0
         _pageService = service;
 126  0
     }
 127  
 }