亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? webappconfig.java

?? Examples From Java Examples in a Nutshell, 2nd Edition 書中的源碼
?? JAVA
字號:
/* * Copyright (c) 2000 David Flanagan.  All rights reserved. * This code is from the book Java Examples in a Nutshell, 2nd Edition. * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. * You may study, use, and modify it for any non-commercial purpose. * You may distribute it non-commercially as long as you retain this notice. * For a commercial use license, or to purchase the book (recommended), * visit http://www.davidflanagan.com/javaexamples2. */package com.davidflanagan.examples.xml;import javax.xml.parsers.*;   // JAXP classes for parsingimport org.w3c.dom.*;         // W3C DOM classes for traversing the documentimport org.xml.sax.*;         // SAX classes used for error handling by JAXPimport java.io.*;             // For reading the input file/** * A WebAppConfig object is a wrapper around a DOM tree for a web.xml * file.  The methods of the class use the DOM API to work with the * tree in various ways. **/public class WebAppConfig {    /** The main method creates and demonstrates a WebAppConfig object */    public static void main(String[] args)	throws IOException, SAXException, ParserConfigurationException    {	// Create a new WebAppConfig object that represents the web.xml	// file specified by the first command-line argument	WebAppConfig config = new WebAppConfig(new File(args[0]));	// Query the tree for the class name associated with the specified	// servlet name	System.out.println("Class for servlet " + args[1] + " is " +			   config.getServletClass(args[1]));	// Add a new servlet name-to-class mapping to the DOM tree	config.addServlet("foo", "bar");	// And write out an XML version of the DOM tree to standard out	config.output(new PrintWriter(new OutputStreamWriter(System.out)));    }    org.w3c.dom.Document document;  // This field holds the parsed DOM tree    /**     * This constructor method is passed an XML file.  It uses the JAXP API to     * obtain a DOM parser, and to parse the file into a DOM Document object,     * which is used by the remaining methods of the class.     **/    public WebAppConfig(File configfile)	throws IOException, SAXException, ParserConfigurationException    {	// Get a JAXP parser factory object	javax.xml.parsers.DocumentBuilderFactory dbf =	    DocumentBuilderFactory.newInstance();	// Tell the factory what kind of parser we want 	dbf.setValidating(false);	// Use the factory to get a JAXP parser object	javax.xml.parsers.DocumentBuilder parser = dbf.newDocumentBuilder();	// Tell the parser how to handle errors.  Note that in the JAXP API,	// DOM parsers rely on the SAX API for error handling	parser.setErrorHandler(new org.xml.sax.ErrorHandler() {		public void warning(SAXParseException e) {		    System.err.println("WARNING: " + e.getMessage());		}		public void error(SAXParseException e) {		    System.err.println("ERROR: " + e.getMessage());		}		public void fatalError(SAXParseException e)		    throws SAXException {		    System.err.println("FATAL: " + e.getMessage());		    throw e;   // re-throw the error		}	    });	// Finally, use the JAXP parser to parse the file.  This call returns	// A Document object.  Now that we have this object, the rest of this	// class uses the DOM API to work with it; JAXP is no longer required.	document = parser.parse(configfile);    }    /**     * This method looks for specific Element nodes in the DOM tree in order     * to figure out the classname associated with the specified servlet name     **/    public String getServletClass(String servletName) {	// Find all <servlet> elements and loop through them.	NodeList servletnodes = document.getElementsByTagName("servlet");	int numservlets = servletnodes.getLength();	for(int i = 0; i < numservlets; i++) {	    Element servletTag = (Element)servletnodes.item(i);	    // Get the first <servlet-name> tag within the <servlet> tag	    Element nameTag = (Element)		servletTag.getElementsByTagName("servlet-name").item(0);	    if (nameTag == null) continue;	    // The <servlet-name> tag should have a single child of type	    // Text.  Get that child, and extract its text.  Use trim()	    // to strip whitespace from the beginning and end of it.	    String name =((Text)nameTag.getFirstChild()).getData().trim();	   	    // If this <servlet-name> tag has the right name	    if (servletName.equals(name)) {		// Get the matching <servlet-class> tag		Element classTag = (Element)		    servletTag.getElementsByTagName("servlet-class").item(0);		if (classTag != null) {		    // Extract the tag's text as above, and return it		    Text classTagContent = (Text)classTag.getFirstChild();		    return classTagContent.getNodeValue().trim();		}	    }	}	// If we get here, no matching servlet name was found	return null;    }    /**     * This method adds a new name-to-class mapping in in the form of     * a <servlet> sub-tree to the document.     **/    public void addServlet(String servletName, String className) {	// Create the <servlet> tag	Element newNode = document.createElement("servlet");	// Create the <servlet-name> and <servlet-class> tags	Element nameNode = document.createElement("servlet-name");	Element classNode = document.createElement("servlet-class");	// Add the name and classname text to those tags	nameNode.appendChild(document.createTextNode(servletName));	classNode.appendChild(document.createTextNode(className));	// And add those tags to the servlet tag	newNode.appendChild(nameNode);	newNode.appendChild(classNode);		// Now that we've created the new sub-tree, figure out where to put	// it.  This code looks for another servlet tag and inserts the new	// one right before it. Note that this code will fail if the document	// does not already contain at least one <servlet> tag.	NodeList servletnodes = document.getElementsByTagName("servlet");	Element firstServlet = (Element)servletnodes.item(0);	// Insert the new node before the first servlet node	firstServlet.getParentNode().insertBefore(newNode, firstServlet);    }    /**     * Output the DOM tree to the specified stream as an XML document.     * See the XMLDocumentWriter example for the details.     **/    public void output(PrintWriter out) {	XMLDocumentWriter docwriter = new XMLDocumentWriter(out);	docwriter.write(document);	docwriter.close();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
高潮精品一区videoshd| 国产黄色91视频| 国产精品国产自产拍高清av王其| 久久综合久久99| 日韩精品在线看片z| 欧美刺激午夜性久久久久久久| 91精品国产综合久久久久| 91精品国产一区二区人妖| 这里只有精品免费| 久久网站热最新地址| 国产精品免费久久| 亚洲日本中文字幕区| 夜夜夜精品看看| 日本在线不卡一区| 国产美女主播视频一区| 99精品久久99久久久久| 在线观看不卡视频| 欧美一卡二卡在线| 久久久久久久久久电影| 国产精品久久午夜夜伦鲁鲁| 亚洲综合激情网| 免费精品视频最新在线| 岛国av在线一区| 在线亚洲一区二区| 欧美大片日本大片免费观看| 国产亚洲精品超碰| 亚洲一区二区三区激情| 日韩在线一区二区三区| 国产成人免费在线| 欧美日韩一区三区四区| 亚洲精品一区二区三区99| 国产精品欧美经典| 偷拍一区二区三区四区| 国产激情精品久久久第一区二区| 色老汉av一区二区三区| 精品区一区二区| 国产精品久线在线观看| 蜜臀av性久久久久av蜜臀妖精| 懂色av噜噜一区二区三区av| 欧美日韩高清在线| 中文字幕欧美激情一区| 日韩国产一区二| 色综合咪咪久久| www国产精品av| 亚洲成a人在线观看| 成人免费高清视频在线观看| 91麻豆精品国产91久久久资源速度| 国产午夜亚洲精品羞羞网站| 男女男精品视频| 制服丝袜中文字幕亚洲| 综合婷婷亚洲小说| 国产精品一区二区三区网站| 欧美性色欧美a在线播放| 国产精品美女www爽爽爽| 毛片一区二区三区| 欧美日韩国产经典色站一区二区三区 | 国产精品中文欧美| 欧美人牲a欧美精品| 亚洲女厕所小便bbb| 成人动漫一区二区| 精品国产乱码久久久久久闺蜜| 亚洲一区在线观看网站| 成人深夜视频在线观看| 久久亚洲综合av| 九九视频精品免费| 日韩欧美一区二区在线视频| 亚洲成人你懂的| 欧美日本一区二区三区| 亚洲图片一区二区| 91行情网站电视在线观看高清版| 国产精品成人一区二区艾草 | 日韩亚洲欧美高清| 日本aⅴ精品一区二区三区| 91精品国产综合久久精品图片| 亚洲成人精品影院| 欧美亚洲国产一卡| 亚洲成人综合网站| 久久精品一二三| 国产一区二区三区四| 久久美女高清视频| 国产成人精品免费在线| 国产精品午夜春色av| 成人午夜电影小说| 亚洲三级视频在线观看| 欧美影视一区在线| 日韩精彩视频在线观看| 欧美电影免费观看高清完整版在线| 秋霞成人午夜伦在线观看| 精品国产成人系列| av中文字幕不卡| 亚洲一区精品在线| 日韩欧美专区在线| 成人性视频网站| 国产精品久久久久四虎| 一本一道久久a久久精品综合蜜臀| 亚洲狠狠爱一区二区三区| 欧美一区二区视频在线观看2022| 精品一区二区三区在线视频| 国产欧美日韩视频一区二区| 91福利精品第一导航| 免费人成在线不卡| 国产精品久久毛片| 欧美视频一区在线观看| 久久97超碰国产精品超碰| 国产精品高清亚洲| 欧美区一区二区三区| 国产成人啪午夜精品网站男同| 亚洲激情六月丁香| 精品免费视频一区二区| 99精品视频一区二区| 美女脱光内衣内裤视频久久影院| 中文字幕+乱码+中文字幕一区| 91极品美女在线| 久久99久久久久| 亚洲天堂2016| 精品成人一区二区三区四区| 99re视频精品| 国产精品亚洲成人| 日本美女一区二区| 一区二区三区免费网站| 久久看人人爽人人| 欧美一激情一区二区三区| 99久久er热在这里只有精品66| 美女视频一区二区三区| 亚洲午夜一区二区| 国产精品不卡在线观看| 久久麻豆一区二区| 精品国产一区二区三区久久影院| 欧美在线观看一区二区| 成人av在线影院| 黄色成人免费在线| 日韩电影免费一区| 午夜精品免费在线| 亚洲精品一卡二卡| 日韩美女视频一区| 国产精品久久久爽爽爽麻豆色哟哟| 欧美电影免费观看完整版| 欧美一级片免费看| 在线电影国产精品| 欧美日本乱大交xxxxx| 色久综合一二码| 色婷婷综合激情| 色综合久久综合| 91丨porny丨户外露出| 成人高清免费观看| 成人动漫中文字幕| 99这里只有精品| 懂色av一区二区三区免费看| 国产a精品视频| 成人免费视频免费观看| 国产成都精品91一区二区三| 国产sm精品调教视频网站| 国产精品中文字幕日韩精品 | 日韩和欧美一区二区三区| 亚洲人成影院在线观看| 亚洲视频资源在线| 亚洲欧洲综合另类| 亚洲综合久久久| 日韩精品五月天| 久久aⅴ国产欧美74aaa| 狠狠久久亚洲欧美| 国产成人精品亚洲777人妖| 岛国一区二区三区| 91啦中文在线观看| 精品视频1区2区| 91精品国产美女浴室洗澡无遮挡| 日韩一区二区免费在线观看| 精品成人一区二区三区四区| 国产精品久久三| 亚洲综合av网| 蜜芽一区二区三区| 国产成人免费视频网站| 91免费精品国自产拍在线不卡| 欧美系列在线观看| 日韩限制级电影在线观看| 久久夜色精品一区| 亚洲精品国产精华液| 奇米一区二区三区| 国产精品一级片| 91成人国产精品| 久久婷婷成人综合色| 一区二区三区在线不卡| 另类人妖一区二区av| thepron国产精品| 欧美日韩黄色影视| 国产欧美日韩综合| 亚洲综合自拍偷拍| 国产一区二区三区香蕉| 色婷婷一区二区三区四区| 欧美日韩国产在线观看| 国产日韩欧美精品在线| 亚洲午夜免费电影| 国产成人8x视频一区二区| 欧美日韩不卡一区二区| 中文字幕在线不卡| 老司机精品视频线观看86| 91香蕉视频黄| 国产欧美一区二区精品久导航 | 欧美精品在线观看播放| 欧美国产一区二区在线观看|