1 18 package org.apache.beehive.netui.pageflow.internal; 19 20 import org.apache.beehive.netui.pageflow.PageFlowUtils; 21 import org.apache.beehive.netui.pageflow.PageFlowController; 22 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.ServletRequest ; 25 import java.beans.beancontext.BeanContextServiceProvider ; 26 import java.beans.beancontext.BeanContextServices ; 27 import java.util.Iterator ; 28 29 30 33 public class PageFlowServiceProvider implements BeanContextServiceProvider 34 { 35 private static final PageFlowServiceProvider _provider = new PageFlowServiceProvider(); 36 37 public static final PageFlowServiceProvider getProvider() { return _provider; } 38 39 private PageFlowServiceProvider() 40 { 41 } 42 43 public static interface HasServletRequest 44 { 45 ServletRequest getServletRequest(); 46 } 47 48 public Object getService( BeanContextServices bcs, Object requestor, Class serviceClass, 49 Object serviceSelector ) 50 { 51 if ( ! ( bcs instanceof HasServletRequest ) ) return null; 55 56 if ( PageFlowController.class.equals( serviceClass ) ) 57 { 58 ServletRequest request = ( ( HasServletRequest ) bcs ).getServletRequest(); 59 if ( ! ( request instanceof HttpServletRequest ) ) return null; 60 return PageFlowUtils.getCurrentPageFlow( ( HttpServletRequest ) request ); 61 } 62 63 return null; 64 } 65 66 public void releaseService( BeanContextServices bcs, Object requestor, Object service ) 67 { 68 } 69 70 public Iterator getCurrentServiceSelectors( BeanContextServices bcs, Class serviceClass ) 71 { 72 return null; 73 } 74 } 75 | Popular Tags |