1 18 package org.apache.beehive.netui.pageflow; 19 20 import org.apache.beehive.netui.pageflow.adapter.AdapterContext; 21 import org.apache.beehive.netui.pageflow.internal.PageFlowBeanContext; 22 import org.apache.beehive.netui.util.logging.Logger; 23 24 import javax.security.auth.login.LoginException ; 25 import javax.servlet.ServletContext ; 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 30 33 public abstract class DefaultServletContainerAdapter 34 implements ServletContainerAdapter 35 { 36 private static boolean _productionMode = true; 37 38 private ServletContext _servletContext; 39 private PageFlowEventReporter _eventReporter; 40 41 static 42 { 43 String productionModeFlag = System.getProperty( "beehive.productionmode" ); 44 45 if ( productionModeFlag != null ) 46 { 47 _productionMode = Boolean.valueOf( productionModeFlag ).booleanValue(); 48 } 49 else 50 { 51 assert ( _productionMode = false ) || true; 56 } 57 } 58 59 protected DefaultServletContainerAdapter() 60 { 61 } 62 63 71 public boolean isInProductionMode() 72 { 73 return _productionMode; 74 } 75 76 84 public SecurityProtocol getSecurityProtocol( String path, HttpServletRequest request ) 85 { 86 return SecurityProtocol.UNSPECIFIED; 88 } 89 90 94 public boolean doSecurityRedirect( String path, HttpServletRequest request, HttpServletResponse response ) 95 { 96 return false; 97 } 98 99 105 public int getListenPort( HttpServletRequest request ) 106 { 107 return -1; 109 } 110 111 117 public int getSecureListenPort( HttpServletRequest request ) 118 { 119 return -1; 121 } 122 123 129 public void login( String username, String password, HttpServletRequest request, HttpServletResponse response ) 130 throws LoginException 131 { 132 throw new UnsupportedOperationException ( "login is not supported by " 133 + DefaultServletContainerAdapter.class.getName() ); 134 } 135 136 141 public void logout( boolean invalidateSessions, HttpServletRequest request, HttpServletResponse response ) 142 { 143 throw new UnsupportedOperationException ( "logout is not supported by " 144 + DefaultServletContainerAdapter.class.getName() ); 145 } 146 147 155 public String getFullContextPath( HttpServletRequest request ) 156 { 157 return request.getContextPath(); 158 } 159 160 169 public void ensureFailover( String attrName, Object attrVal, HttpServletRequest request ) 170 { 171 } 172 173 179 public void beginRequest( HttpServletRequest request, HttpServletResponse response ) 180 { 181 } 182 183 189 public void endRequest( HttpServletRequest request, HttpServletResponse response ) 190 { 191 } 192 193 201 public Object createControlBeanContext( HttpServletRequest request, HttpServletResponse response ) 202 { 203 return new PageFlowBeanContext(); 204 } 205 206 210 protected ServletContext getServletContext() 211 { 212 return _servletContext; 213 } 214 215 219 public void setContext( AdapterContext context ) 220 { 221 Object servletContext = context.getExternalContext(); 222 assert servletContext instanceof ServletContext : servletContext; 223 _servletContext = ( ServletContext ) servletContext; 224 _eventReporter = new DefaultPageFlowEventReporter( _servletContext ); 225 } 226 227 233 public String getPlatformName() 234 { 235 return "generic"; 236 } 237 238 244 public PageFlowEventReporter getEventReporter() 245 { 246 return _eventReporter; 247 } 248 } 249 | Popular Tags |