Coverage Report - org.apache.tapestry.engine.encoders.PathEncoder
 
Classes in this File Line Coverage Branch Coverage Complexity
PathEncoder
0%
0/14
0%
0/4
2
 
 1  
 package org.apache.tapestry.engine.encoders;
 2  
 
 3  
 import org.apache.tapestry.engine.ServiceEncoder;
 4  
 import org.apache.tapestry.engine.ServiceEncoding;
 5  
 import org.apache.tapestry.services.ServiceConstants;
 6  
 
 7  
 /**
 8  
  * Encoder for mapping service names as simple paths such as "/service" . 
 9  
  */
 10  0
 public class PathEncoder implements ServiceEncoder {
 11  
 
 12  
     private String _path;
 13  
 
 14  
     private String _service;
 15  
 
 16  
     public void setPath(String path)
 17  
     {
 18  0
         _path = path;
 19  0
     }
 20  
 
 21  
     public void setService(String service)
 22  
     {
 23  0
         _service = service;
 24  0
     }
 25  
 
 26  
     public void encode(ServiceEncoding encoding)
 27  
     {
 28  0
         if (!encoding.getParameterValue(ServiceConstants.SERVICE).equals(_service))
 29  0
             return;
 30  
            
 31  0
         encoding.setServletPath(_path);
 32  0
         encoding.setParameterValue(ServiceConstants.SERVICE, null);
 33  0
     }
 34  
 
 35  
     public void decode(ServiceEncoding encoding)
 36  
     {
 37  0
         if (!encoding.getServletPath().equals(_path))
 38  0
             return;
 39  
         
 40  0
         encoding.setParameterValue(ServiceConstants.SERVICE, _service);
 41  0
     }
 42  
 }