Coverage Report - org.trails.servlet.TrailsApplicationServlet
 
Classes in this File Line Coverage Branch Coverage Complexity
TrailsApplicationServlet
0% 
N/A 
0
 
 1  
 /*
 2  
  * Created on 29/11/2005
 3  
  *
 4  
  */
 5  
 package org.trails.servlet;
 6  
 
 7  
 import java.util.Locale;
 8  
 import javax.servlet.ServletConfig;
 9  
 
 10  
 import org.apache.hivemind.Registry;
 11  
 import org.apache.hivemind.service.ThreadLocale;
 12  
 import org.apache.tapestry.ApplicationServlet;
 13  
 import org.apache.tapestry.services.RequestLocaleManager;
 14  
 
 15  
 /**
 16  
  * This class will expose the Tapestry Registry as an static atribute.
 17  
  *
 18  
  * @author Eduardo Fernandes Piva (eduardo@gwe.com.br)
 19  
  */
 20  0
 public class TrailsApplicationServlet extends ApplicationServlet
 21  
 {
 22  
 
 23  
         /**
 24  
          * This is used to share the Registry among all the
 25  
          */
 26  0
         private static Registry tapestryRegistry = null;
 27  
 
 28  
         @Override
 29  
         protected Registry constructRegistry(ServletConfig config)
 30  
         {
 31  0
                 synchronized (TrailsApplicationServlet.class)
 32  
                 {
 33  0
                         TrailsApplicationServlet.tapestryRegistry = super.constructRegistry(config);
 34  0
                         return TrailsApplicationServlet.tapestryRegistry;
 35  
                 }
 36  
         }
 37  
 
 38  
         @Override
 39  
         public void destroy()
 40  
         {
 41  0
                 synchronized (TrailsApplicationServlet.class)
 42  
                 {
 43  0
                         super.destroy();
 44  0
                         TrailsApplicationServlet.tapestryRegistry = null;
 45  
                 }
 46  0
         }
 47  
 
 48  
         /*
 49  
                  * Used by Spring.
 50  
                  */
 51  
         public static Registry getRegistry()
 52  
         {
 53  0
                 return tapestryRegistry;
 54  
         }
 55  
 
 56  
         public static Locale getCurrentLocale()
 57  
         {
 58  0
                 return ((ThreadLocale) tapestryRegistry.getService("hivemind.ThreadLocale", ThreadLocale.class)).getLocale();
 59  
         }
 60  
 }