Coverage Report - org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge
 
Classes in this File Line Coverage Branch Coverage Complexity
WebRequestServicerPipelineBridge
0%
0/14
N/A
1.667
 
 1  
 // Copyright 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  
 
 15  
 package org.apache.tapestry.services.impl;
 16  
 
 17  
 import java.io.IOException;
 18  
 
 19  
 import javax.servlet.ServletException;
 20  
 import javax.servlet.http.HttpServletRequest;
 21  
 import javax.servlet.http.HttpServletResponse;
 22  
 
 23  
 import org.apache.tapestry.services.RequestGlobals;
 24  
 import org.apache.tapestry.services.ServletRequestServicer;
 25  
 import org.apache.tapestry.services.WebRequestServicer;
 26  
 import org.apache.tapestry.web.ServletWebRequest;
 27  
 import org.apache.tapestry.web.ServletWebResponse;
 28  
 import org.apache.tapestry.web.WebRequest;
 29  
 import org.apache.tapestry.web.WebResponse;
 30  
 
 31  
 /**
 32  
  * Bridges from the <code>tapestry.request.ServletRequestServicerPipeline</code> to the
 33  
  * <code>tapestry.request.WebRequestServicerPipeline</code>. Also, stores the web request and
 34  
  * web response into {@link org.apache.tapestry.services.RequestGlobals}. Intercepts runtime
 35  
  * exceptions and throws them wrapped as {@link javax.servlet.ServletException}.
 36  
  * 
 37  
  * <p>This service is responsible for for storing the http/web request wrappers into 
 38  
  *  {@link RequestGlobals}.</p>
 39  
  * 
 40  
  * @author Howard M. Lewis Ship
 41  
  * @since 4.0
 42  
  */
 43  0
 public class WebRequestServicerPipelineBridge implements ServletRequestServicer
 44  
 {
 45  
     private RequestGlobals _requestGlobals;
 46  
 
 47  
     private WebRequestServicer _webRequestServicer;
 48  
 
 49  
     public void service(HttpServletRequest request, HttpServletResponse response)
 50  
             throws IOException, ServletException
 51  
     {
 52  0
         _requestGlobals.store(request, response);
 53  
         
 54  0
         WebRequest webRequest = new ServletWebRequest(request, response);
 55  0
         WebResponse webResponse = new ServletWebResponse(response);
 56  
         
 57  0
         _requestGlobals.store(webRequest, webResponse);
 58  
         
 59  
         try
 60  
         {
 61  0
             _webRequestServicer.service(webRequest, webResponse);
 62  
         }
 63  0
         catch (RuntimeException ex)
 64  
         {
 65  0
             throw new ServletException(ex);
 66  0
         }
 67  0
     }
 68  
 
 69  
     public void setRequestGlobals(RequestGlobals requestGlobals)
 70  
     {
 71  0
         _requestGlobals = requestGlobals;
 72  0
     }
 73  
 
 74  
     public void setWebRequestServicer(WebRequestServicer webRequestServicer)
 75  
     {
 76  0
         _webRequestServicer = webRequestServicer;
 77  0
     }
 78  
 }