📄 warpconfigurationhandler.java
字号:
packet.setType(Constants.TYPE_CONF_MAP_DENY); packet.writeString(smap[x]); if (c instanceof Wrapper) { String servlet=((Wrapper)c).getServletClass(); if (DEFAULT_SERVLET.equals(servlet)) { packet.setType( Constants.TYPE_CONF_MAP_ALLOW); if (Constants.DEBUG) logger.debug("Servlet mapping \""+ smap[x]+"\" allowed"); } else if (Constants.DEBUG) { logger.debug("Servlet mapping \""+smap[x]+ "\" denied"); } } connection.send(packet); } } FilterMap fmap[]=context.findFilterMaps(); if (fmap!=null) { logger.log("Filter mappings ("+fmap.length+")"); for (int x=0; x<fmap.length; x++) { String map=fmap[x].getURLPattern(); if (map!=null) { if (Constants.DEBUG) logger.debug("Filter mapping \""+map+ "\" denied"); packet.reset(); packet.setType(Constants.TYPE_CONF_MAP_DENY); packet.writeString(map); connection.send(packet); } } } SecurityConstraint scon[]=context.findConstraints(); if (scon!=null) { for (int x=0; x<scon.length; x++) { SecurityCollection col[]=scon[x].findCollections(); if (col!=null) { for (int y=0; y<col.length; y++) { String patt[]=col[y].findPatterns(); if (patt!=null) { for (int q=0; q<patt.length; q++) { packet.reset(); packet.setType( Constants.TYPE_CONF_MAP_DENY); packet.writeString(patt[q]); connection.send(packet); if (Constants.DEBUG) { logger.debug("Seurity "+ " mapping \""+patt[q]+ "\""); } } } } } } } packet.reset(); packet.setType(Constants.TYPE_CONF_MAP_DONE); connection.send(packet); break; } case Constants.TYPE_CONF_DONE: { return(true); } case Constants.TYPE_DISCONNECT: { return(false); } default: { String msg="Invalid packet with type "+packet.getType(); logger.log(msg); packet.reset(); packet.setType(Constants.TYPE_FATAL); packet.writeString(msg); connection.send(packet); return(false); } } } } /** Deploy a web application */ private Context deploy(WarpConnection connection, WarpLogger logger, String applName, String hostName, String applPath) throws IOException { synchronized (connection.getConnector()) { Container container=connection.getConnector().getContainer(); // the hostName should be in lowewr case (setName makes a toLowerCase). Host host=(Host)container.findChild(hostName.toLowerCase()); if (host==null) { WarpHost whost=new WarpHost(); whost.setName(hostName); whost.setParent(container); whost.setAppBase(connection.getConnector().getAppBase()); whost.setDebug(connection.getConnector().getDebug()); container.addChild(whost); host=whost; if (Constants.DEBUG) logger.debug("Created new host "+host.getName()); } else if (Constants.DEBUG) { logger.debug("Reusing instance of Host \""+host.getName()+"\""); } // TODO: Set up mapping mechanism for performance if (applPath.endsWith("/")) applPath=applPath.substring(0,applPath.length()-1); Context appl=(Context)host.findChild(applPath); if (appl==null) { if (Constants.DEBUG) logger.debug("No application for \""+applPath+"\""); Deployer deployer=(Deployer)host; File file=new File(applName); if (!file.isAbsolute()) { file=new File(host.getAppBase()+File.separator+applName); if (!file.isAbsolute()) { file=new File(System.getProperty("catalina.base"), host.getAppBase()+File.separator+applName); } } if (!file.exists()) { logger.log("Cannot find \""+file.getPath()+"\" for appl. \""+ applName+"\" host \""+host.getName()+"\""); return(null); } String path=file.getCanonicalPath(); URL url=new URL("file",null,path); if (path.toLowerCase().endsWith(".war")) url=new URL("jar:"+url.toString()+"!/"); if (Constants.DEBUG) logger.debug("Application URL \""+url.toString()+"\""); deployer.install(applPath, url); StandardContext context=null; context=(StandardContext)deployer.findDeployedApp(applPath); context.setDebug(connection.getConnector().getDebug()); return(context); } else { if (Constants.DEBUG) logger.debug("Found application for \""+appl.getName()+"\""); return(appl); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -