Coverage Report - org.seasar.teeda.core.util.PortletErrorPageManagerImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
PortletErrorPageManagerImpl
0%
0/13
0%
0/4
3
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.util;
 17  
 
 18  
 import java.io.IOException;
 19  
 
 20  
 import javax.faces.context.ExternalContext;
 21  
 import javax.faces.context.FacesContext;
 22  
 import javax.faces.internal.scope.RedirectScope;
 23  
 
 24  
 import org.seasar.framework.util.AssertionUtil;
 25  
 import org.seasar.teeda.core.JsfConstants;
 26  
 
 27  
 /**
 28  
  * @author shinsuke
 29  
  * 
 30  
  */
 31  0
 public class PortletErrorPageManagerImpl extends ServletErrorPageManagerImpl {
 32  
 
 33  
     /*
 34  
      * (non-Javadoc)
 35  
      * 
 36  
      * @see org.seasar.teeda.core.util.ServletErrorPageManagerImpl#handleException(java.lang.Throwable,
 37  
      *      javax.faces.context.FacesContext,
 38  
      *      javax.faces.context.ExternalContext)
 39  
      */
 40  
     public boolean handleException(Throwable exception, FacesContext context,
 41  
             ExternalContext extContext) throws IOException {
 42  0
         if (PortletUtil.isPortlet(context)) {
 43  0
             String location = getLocation(exception.getClass());
 44  0
             if (location == null) {
 45  0
                 return false;
 46  
             }
 47  0
             storeErrorInfoToAttribute(extContext, exception);
 48  0
             RedirectScope.setRedirectingPath(context, location);
 49  0
             return true;
 50  
         } else {
 51  0
             return super.handleException(exception, context, extContext);
 52  
         }
 53  
     }
 54  
 
 55  
     protected void storeErrorInfoToAttribute(ExternalContext extContext,
 56  
             Throwable exception) {
 57  0
         AssertionUtil.assertNotNull("extContext", extContext);
 58  0
         AssertionUtil.assertNotNull("exception", exception);
 59  0
         extContext.getSessionMap().put(JsfConstants.ERROR_EXCEPTION, exception);
 60  0
     }
 61  
 
 62  
 }