/** * Add a new Wrapper to an existing Context. * * @param hostName Virtual host name this wrapper belongs to * @param contextPath Context path this wrapper belongs to * @param path Wrapper mapping * @param wrapper Wrapper object */ public void addWrapper(String hostName, String contextPath, String path, Object wrapper) { addWrapper(hostName, contextPath, path, wrapper, false); }
int pos = find(hosts, hostName); if( pos <0 ) { addHost(hostName, new String[0], ""); hosts = this.hosts; pos = find(hosts, hostName); int slashCount = slashCount(path); synchronized (host) { Context[] contexts = host.contextList.contexts; Context newContext = new Context(); newContext.name = path; if (insertMap(contexts, newContexts, newContext)) { host.contextList.contexts = newContexts;
/** * Remove a wrapper from the context associated with this wrapper. * * @param path Wrapper mapping */ public void removeWrapper(String path) { removeWrapper(context, path); }
public void addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard) { Host[] hosts = this.hosts; int pos = find(hosts, hostName); if (pos < 0) { return; } Host host = hosts[pos]; if (host.name.equals(hostName)) { Context[] contexts = host.contextList.contexts; int pos2 = find(contexts, contextPath); if( pos2<0 ) { throw new IllegalStateException("No context found: " + contextPath ); } Context context = contexts[pos2]; if (context.name.equals(contextPath)) { addWrapper(context, path, wrapper, jspWildCard); } } }
mapper.addHostAlias(((Host) event.getSource()).getName(), event.getData().toString()); } else if (Host.REMOVE_ALIAS_EVENT.equals(event.getType())) { mapper.removeHostAlias(event.getData().toString()); } else if (Wrapper.ADD_MAPPING_EVENT.equals(event.getType())) { boolean jspWildCard = ("jsp".equals(wrapperName) && mapping.endsWith("/*")); mapper.addWrapper(hostName, contextPath, version, mapping, wrapper, jspWildCard, context.isResourceOnlyServlet(wrapperName)); } else if (Wrapper.REMOVE_MAPPING_EVENT.equals(event.getType())) { mapper.removeWrapper(hostName, contextPath, version, mapping); } else if (Context.ADD_WELCOME_FILE_EVENT.equals(event.getType())) { mapper.addWelcomeFile(hostName, contextPath, context.getWebappVersion(), welcomeFile); } else if (Context.REMOVE_WELCOME_FILE_EVENT.equals(event.getType())) { mapper.removeWelcomeFile(hostName, contextPath, context.getWebappVersion(), welcomeFile); } else if (Context.CLEAR_WELCOME_FILES_EVENT.equals(event.getType())) { mapper.clearWelcomeFiles(hostName, contextPath, context.getWebappVersion());
mapper.addHost(host.getName(), host.findAliases(), host); mapper.removeContext(container.getName(), context.getName()); } else if (container instanceof Engine) { mapper.removeHost(host.getName()); mapper.addHostAlias(((Host) event.getSource()).getName(), event.getData().toString()); } else if (type == Host.REMOVE_ALIAS_EVENT) { mapper.removeHostAlias(event.getData().toString());
private String getWrapperName(ServletRequest request, GeronimoStandardContext webContext) { MappingData mappingData = new MappingData(); Mapper mapper = webContext.getMapper(); MessageBytes mb = MessageBytes.newInstance(); String dispatchPath = (String) request.getAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR); mb.setString(webContext.getName() + dispatchPath); try { mapper.map(mb, mappingData); StandardWrapper wrapper = (StandardWrapper) mappingData.wrapper; return wrapper.getName(); } catch (Exception e) { log.error(e.getMessage(), e); } return null; }
((Lifecycle) engine).addLifecycleListener(this); if (engine.getDefaultHost() != null) { mapper.setDefaultHostName(engine.getDefaultHost()); mapper.addHost(host.getName(), ((Host) host).findAliases(), host); for (Container context : host.findChildren()) { ((Lifecycle) context).addLifecycleListener(this); mapper.removeContext(context.getParent().getName(), context.getName()); } else if (source instanceof Service) { Service service = (Service) source; for (Container host : engine.findChildren()) { host.removeContainerListener(this); mapper.removeHost(host.getName()); for (Container context : host.findChildren()) { ((Lifecycle) context).removeLifecycleListener(this); mapper.removeContext(host.getName(), context.getName());
/** * Register host. */ private void registerHost(ObjectName objectName) throws Exception { String name=objectName.getKeyProperty("host"); if( name != null ) { String[] aliases = (String[]) mBeanServer.invoke(objectName, "findAliases", null, null); mapper.addHost(name, aliases, objectName); if(log.isDebugEnabled()) log.debug(sm.getString ("mapperListener.registerHost", name, domain)); } }
mapper.setContext(getPath(), welcomeFiles, resources);
protected void addContext(Context context) { mapper.addContext(context.getParent().getName(), context.getName(), context, context.findWelcomeFiles(), context.getResources()); // Add all wrappers for (Container child : context.findChildren()) { Wrapper wrapper = (Wrapper) child; if (wrapper.getEnabled()) { for (String mapping : wrapper.findMappings()) { boolean jspWildCard = ("jsp".equals(wrapper.getName()) && mapping.endsWith("/*")); mapper.addWrapper(context.getParent().getName(), context.getName(), mapping, wrapper, jspWildCard); } } } }
/** * Unregister host. */ private void unregisterHost(ObjectName objectName) throws Exception { String name=objectName.getKeyProperty("host"); mapper.removeHost(name); if(log.isDebugEnabled()) log.debug(sm.getString ("mapperListener.unregisterHost", name, domain)); }
mapper.setDefaultHostName(defaultHost);
mapper.addHostAlias(((Host) event.getSource()).getName(), event.getData().toString()); } else if (Host.REMOVE_ALIAS_EVENT.equals(event.getType())) { mapper.removeHostAlias(event.getData().toString()); } else if (Wrapper.ADD_MAPPING_EVENT.equals(event.getType())) { boolean jspWildCard = ("jsp".equals(wrapperName) && mapping.endsWith("/*")); mapper.addWrapper(hostName, contextPath, version, mapping, wrapper, jspWildCard, context.isResourceOnlyServlet(wrapperName)); } else if (Wrapper.REMOVE_MAPPING_EVENT.equals(event.getType())) { mapper.removeWrapper(hostName, contextPath, version, mapping); } else if (Context.ADD_WELCOME_FILE_EVENT.equals(event.getType())) { mapper.addWelcomeFile(hostName, contextPath, context.getWebappVersion(), welcomeFile); } else if (Context.REMOVE_WELCOME_FILE_EVENT.equals(event.getType())) { mapper.removeWelcomeFile(hostName, contextPath, context.getWebappVersion(), welcomeFile); } else if (Context.CLEAR_WELCOME_FILES_EVENT.equals(event.getType())) { mapper.clearWelcomeFiles(hostName, contextPath, context.getWebappVersion());
mapper.addHost(host.getName(), host.findAliases(), host); mapper.removeContext(container.getName(), context.getName()); } else if (container instanceof Engine) { mapper.removeHost(host.getName()); mapper.addHostAlias(((Host) event.getSource()).getName(), event.getData().toString()); } else if (type == Host.REMOVE_ALIAS_EVENT) { mapper.removeHostAlias(event.getData().toString());
private String getWrapperName(ServletRequest request, GeronimoStandardContext webContext) { MappingData mappingData = new MappingData(); Mapper mapper = webContext.getMapper(); MessageBytes mb = MessageBytes.newInstance(); String dispatchPath = (String) request.getAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR); mb.setString(webContext.getName() + dispatchPath); try { mapper.map(mb, mappingData); StandardWrapper wrapper = (StandardWrapper) mappingData.wrapper; return wrapper.getName(); } catch (Exception e) { log.error(e.getMessage(), e); } return null; }
((Lifecycle) engine).addLifecycleListener(this); if (engine.getDefaultHost() != null) { mapper.setDefaultHostName(engine.getDefaultHost()); mapper.addHost(host.getName(), ((Host) host).findAliases(), host); for (Container context : host.findChildren()) { ((Lifecycle) context).addLifecycleListener(this); mapper.removeContext(context.getParent().getName(), context.getName()); } else if (source instanceof Service) { Service service = (Service) source; for (Container host : engine.findChildren()) { host.removeContainerListener(this); mapper.removeHost(host.getName()); for (Container context : host.findChildren()) { ((Lifecycle) context).removeLifecycleListener(this); mapper.removeContext(host.getName(), context.getName());
/** * Register host. */ private void registerHost(Host host) { String[] aliases = host.findAliases(); mapper.addHost(host.getName(), aliases, host); for (Container container : host.findChildren()) { registerContext((Context) container); } if(log.isDebugEnabled()) { log.debug(sm.getString("mapperListener.registerHost", host.getName(), domain, connector)); } }
mapper.setContext(getPath(), welcomeFiles, resources);