锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品视频久久,亚洲精品av无码喷奶水糖心,亚洲今日精彩视频http://www.tkk7.com/junhong/archive/2006/06/28/55575.htmljunhongjunhongWed, 28 Jun 2006 09:46:00 GMThttp://www.tkk7.com/junhong/archive/2006/06/28/55575.htmlhttp://www.tkk7.com/junhong/comments/55575.htmlhttp://www.tkk7.com/junhong/archive/2006/06/28/55575.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/55575.htmlhttp://www.tkk7.com/junhong/services/trackbacks/55575.html闃呰鍏ㄦ枃

junhong 2006-06-28 17:46 鍙戣〃璇勮
]]>
Thinking in java reviewhttp://www.tkk7.com/junhong/archive/2006/06/27/55384.htmljunhongjunhongTue, 27 Jun 2006 09:40:00 GMThttp://www.tkk7.com/junhong/archive/2006/06/27/55384.htmlhttp://www.tkk7.com/junhong/comments/55384.htmlhttp://www.tkk7.com/junhong/archive/2006/06/27/55384.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/55384.htmlhttp://www.tkk7.com/junhong/services/trackbacks/55384.html 1銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Java 涓墍鏈夌殑 member function 閮芥槸鍔ㄦ佺粦瀹?/span>

2銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Java 涓墍鏈夌殑瀵硅薄閮芥槸閫氳繃 new 鏉ュ姩鎬佷駭鐢?/span>

3銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 鎵鏈夌殑瀹瑰櫒 (collection) 鍜?/span> Object array( 瀵硅薄鏁扮粍 e.g String []str=new String[10]) 鍐呴兘鍖呭惈閮芥槸瀵硅薄鐨?/span> reference

4銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 鍦?/span> java 涓紝 java 緙栬瘧鍣ㄦ湁璐d換浜х敓鈥滃皢 stack 鎸囬拡鍓嶅悗縐誨姩鈥滅殑紼嬪簭浠g爜錛屾墍浠?/span> 瀹冨繀欏昏兘澶熷畬鍏ㄦ帉鎻″畠鎵緙栬瘧鐨勭殑紼嬪簭涓滃瓨鍦?/span> stack 閲屽ご鐨勬墍鏈夋暟鎹殑瀹為檯澶у皬鍜屽瓨媧繪椂闂粹滐紝 濡傛涓鏉ヤ究浼氶檺鍒剁▼搴忕殑寮規с?/span> 鐢變簬榪欎釜闄愬埗錛屽敖綆℃垜浠彲浠ュ皢瀵硅薄鐨?/span> reference 瀛樺偍涓?/span> stack 鍐咃紝浣嗗嵈涓嶈兘灝嗕竴鑸殑 java 瀵硅薄鏀懼湪 stack 涓?/span>
鐗逛緥錛氾紙 primitive types 錛?/span>
鍩烘湰鍨嬪埆浼氱粡甯歌浣跨敤錛屽鏋滀嬌鐢?/span> new 鏉ヤ駭鐢熸綾繪瀬灝忥紝鏋佺畝鍗曠殑鍙橀噺錛屼細鍥犫?/span> new 灝嗗璞$疆浜?/span> heap 涔嬩笂鈥?/span> 鑰屾晥鐜囦笉濂姐傚洜姝ゅ浜庢綾誨彉閲?/span> java 閲囧彇 c/c++ 鐨勬柟寮忥紝涔熷氨鏄笉鐢?/span> new 鍒嗛厤鍣ㄧ┖闂達紝鑰屾槸浜х敓涓縐嶆墍璋撶殑 鈥漚utomatic 鈥滃彉閲忥紝瀛樹簬 static 涓?/span>

5銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 褰撲綘浜х敓鏌愪釜瀛樺偍瀵硅薄鐨勬暟緇勶紝鐪熸浜х敓鐨勬槸涓瓨鍌?/span> reference 鐨勬暟緇勩傛鏁扮粍寤虹珛涔嬪悗錛屽叾涓殑姣忎竴涓?/span> reference 閮戒細琚嚜鍔ㄨ涓烘煇涓壒孌婄殑鍊?/span> null,

6銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 { String s=new String(鈥渄dd鈥?;} s 榪欎釜 reference 浼氬湪鐢熷瓨絀洪棿涔嬪娑堝け鏃犺釜錛屼絾鏄紝 s 鍏堝墠鎵鎸囩殑閭d釜 String 瀵硅薄浠嶇劧浼氱戶緇崰鐢ㄥ唴瀛?/span>

7銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Class 鍐呯殑鍩烘湰鍨嬪埆鍙橀噺閮芥湁鍒濆鹼紝浣嗘槸鍦ㄥ嚱鏁板唴鐨?/span> local variable 鏄病鏈夊垵鍊肩殑

8銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Java 涓紝鎵鏈変紶閫掔殑瀵硅薄鐨勫満鍚堬紝浼犻掔殑閮芥槸瀵硅薄鐨?/span> reference.

9銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Return 錛?/span> 璇存槑榪欎釜鍑芥暟榪愯緇撴潫錛岃繑鍥炲埌鍏惰皟鐢ㄥ嚱鏁般?/span> Return 2 錛氳繑鍥炰竴涓暟 2 緇欒皟鐢ㄨ咃紝鍚屾椂緇撴潫鏈嚱鏁扮殑榪愯銆?/span>

10銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽 Class 鍐呯殑 non-static data(state) 鍜?/span> method , 閮芥槸鍜岀壒瀹氱殑瀵硅薄緇戝畾鐨勶紝涓鑸儏鍐典笅錛屼綘鐨勪駭鐢熸煇涓璞★紝鍐嶉氳繃璇ュ璞″彇鐢ㄥ叾鏁版嵁鍜屽嚱鏁般傛墍浠?/span> non-static 鏁版嵁 / 鍑芥暟蹇呴』鐭ラ亾浠栦滑闅跺睘浜庡摢涓涓璞★紝鎵嶆湁鍔炴硶榪愯 .static 鍑芥暟鍐呬笉鑳戒嬌鐢?/span> non-static 鏁版嵁鍜屽嚱鏁?/span>

11銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽 (object1= = object2 ) 涓や釜瀵硅薄鐨?/span> reference 鐨?/span> = = 姣旇緝寰楁槸涓や釜瀵硅薄鐨勫唴瀛樼殑鍦板潃銆傛墍浠ユ垜浠笉鑳戒嬌鐢?/span> = = 鏉ユ祴璇曚袱涓璞$殑鍐呭鏄惁鐩哥瓑銆傚鏋滄兂嫻嬭瘯瀵硅薄鐨勫唴瀹規槸鍚︾浉絳夛紝搴旇浣跨敤 equal(), 浠諱綍涓涓璞¢兘鎷ユ湁榪欎釜鍑芥暟銆備笉榪囦綘鑷繁鐨?/span> class 闇瑕?/span> override 榪欎釜鍑芥暟錛屽惁鍒欓粯璁ょ殑 equal() 鍑芥暟鏄繕鏄瘮杈冪殑涓や釜瀵硅薄鐨勫唴瀛樺湴鍧銆?/span>
Java
鏍囧噯紼嬪簭搴撲腑鐨勫ぇ澶氭暟 class 閮?/span> override 浜?/span> equal(), 鎵浠ヤ粬浠兘浼氭瘮杈冨璞$殑鍐呭鏄惁鐩哥瓑銆?/span>

12銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽 浣嶈繍綆楃閮芥槸浣滅敤浜庡熀鏈鏁扮被鍨嬨傝榪愮畻絎︿富瑕佹槸閽堝紜歡緙栫▼浣跨敤錛堟垜浠敤寰椾笉澶氾紝錛?/span>

寰呯畫



junhong 2006-06-27 17:40 鍙戣〃璇勮
]]>
鍏充簬杈撳叆妗嗕腑鏄劇ず鍙屽紩鍙峰拰鍗曞紩鍙?/title><link>http://www.tkk7.com/junhong/archive/2006/04/19/42026.html</link><dc:creator>junhong</dc:creator><author>junhong</author><pubDate>Wed, 19 Apr 2006 15:39:00 GMT</pubDate><guid>http://www.tkk7.com/junhong/archive/2006/04/19/42026.html</guid><wfw:comment>http://www.tkk7.com/junhong/comments/42026.html</wfw:comment><comments>http://www.tkk7.com/junhong/archive/2006/04/19/42026.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/junhong/comments/commentRss/42026.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/junhong/services/trackbacks/42026.html</trackback:ping><description><![CDATA[<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%"> <tbody> <tr> <td height="20"> <br /> </td> </tr> <tr> <td bgcolor="#e8e8e8" height="30"> <div align="center"> <font color="#ff0000" size="4"> <strong>鍏充簬杈撳叆妗嗕腑鏄劇ず鍙屽紩鍙峰拰鍗曞紩鍙?/strong> </font> </div> </td> </tr> <tr> <td> <!--鍐呭寮濮?-> 鍏充簬杈撳叆妗嗕腑鏄劇ず鍙屽紩鍙峰拰鍗曞紩鍙? <br /><br />鍓嶅彴鏄劇ず瑙e喅鍔炴硶: <br />鏂規硶涓: <br />鍗曞紩鍙?lt;input type="text" value="'"> <br />鍙屽紩鍙?lt;input type="text" value='"'> <br />鏂規硶浜? <br />鍗曞紩鍙?lt;input type="text" value="&#39;"> <br />鍙屽紩鍙?lt;input type="text" value="&#34;"> <br /><br /><br />浠庡悗鍙拌鍙栨暟鎹墠鍙版樉紺鴻В鍐沖姙娉? <br />鎴戜滑浠庢暟鎹簱涓鍙栧煎埌鍓嶅彴鏄劇ず鏃跺簲璇ュ姞鍏ヨ漿鎹? <br /><br />JavaScript鐗堟湰: <br /><br /><% @Language="JavaScript" %> <br /><% <br />function ForamtValue(oStr) <br />{ <br /> switch(typeof(oStr)) <br /> { <br /> case "date" : <br /> //鐩存帴toString()杞崲,鍙互鍔犲叆涓板瘜鐨勬樉紺烘柟寮? <br /> sStr = (new Date(oStr)).toString(); <br /> break; <br /> default : <br /> sStr = String(oStr); <br /> } <br /> sStr = sStr.replace(/\"/g,"&#34;"); //杈撳叆妗嗕腑鏄劇ず鍙屽紩鍙烽棶棰? <br /> sStr = sStr.replace(/\'/g,"&#39;"); //杈撳叆妗嗕腑鏄劇ず鍗曞紩鍙烽棶棰? <br /> return sStr; <br />} <br />%> <br /><br /><% <br />//嫻嬭瘯 <br />var str = "\"鐏拌眴瀹濆疂.net(欖斿夠瀛h妭)\""; <br />var str = new Date(); <br />%> <br /><br> <br /><input type="text" value="<%=str%>" style="width:200px">[涓嶈兘姝e父鏄劇ず]<br> <br /><input type="text" value="<%=ForamtValue(str)%>" style="width:200px">[姝e父鏄劇ず]<br> <br /><br /><br />VBScript鐗堟湰: <br /><br /><% @Language="VBScript" %> <br /><% <br />function ForamtValue(oStr) <br /> Select Case VarType(oStr) <br /> Case "vbDate" <br /> '鐩存帴toString()杞崲,鍙互鍔犲叆涓板瘜鐨勬樉紺烘柟寮? <br /> sStr = CDate(oStr) <br /> Case Else <br /> sStr = CStr(oStr) <br /> End Select <br /> sStr = Replace(sStr,"""","&#34;") '杈撳叆妗嗕腑鏄劇ず鍙屽紩鍙烽棶棰? <br /> sStr = Replace(sStr,"'","&#39;") '杈撳叆妗嗕腑鏄劇ず鍗曞紩鍙烽棶棰? <br /> ForamtValue = sStr <br />End Function <br />%> <br /><br /><% <br />'嫻嬭瘯 <br />Dim str <br />str = """'鐏拌眴瀹濆疂.net(欖斿夠瀛h妭)'""" <br />%> <br /><br> <br /><input type="text" value="<%=str%>" style="width:200px">[涓嶈兘姝e父鏄劇ず]<br> <br /><input type="text" value="<%=ForamtValue(str)%>" style="width:200px">[姝e父鏄劇ず]<br> <br /></td> </tr> </tbody> </table><img src ="http://www.tkk7.com/junhong/aggbug/42026.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/junhong/" target="_blank">junhong</a> 2006-04-19 23:39 <a href="http://www.tkk7.com/junhong/archive/2006/04/19/42026.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>how to use ant to deply your web applicationhttp://www.tkk7.com/junhong/archive/2006/04/19/42008.htmljunhongjunhongWed, 19 Apr 2006 13:41:00 GMThttp://www.tkk7.com/junhong/archive/2006/04/19/42008.htmlhttp://www.tkk7.com/junhong/comments/42008.htmlhttp://www.tkk7.com/junhong/archive/2006/04/19/42008.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/42008.htmlhttp://www.tkk7.com/junhong/services/trackbacks/42008.html


First of all, if you develop your application by Eclipse, it means you have had the ant tool and you need not to download the internet.

Projects

A project has three attributes:

Attribute Description Required
name the name of the project. No
default the default target to use when no target is supplied. No; however, since Ant 1.6.0, every project includes an implicit target that contains any and all top-level tasks and/or types. This target will always be executed as part of the project's initialization, even when Ant is run with the -projecthelp option.
basedir the base directory from which all path calculations are done. This attribute might be overridden by setting the "basedir" property beforehand. When this is done, it must be omitted in the project tag. If neither the attribute nor the property have been set, the parent directory of the buildfile will be used. No

Optionally, a description for the project can be provided as a top-level description type).

Each project defines one or more targets. A target is a set of tasks you want to be executed. When starting Ant, you can select which target(s) you want to have executed. When no target is given, the project's default is used.

Targets

A target can depend on other targets. You might have a target for compiling, for example, and a target for creating a distributable. You can only build a distributable when you have compiled first, so the distribute target depends on the compile target. Ant resolves these dependencies.

It should be noted, however, that Ant's Ant tries to execute the targets in the <target name="A"/>
<target name="B" depends="A"/>
<target name="C" depends="B"/>
<target name="D" depends="C,B,A"/>

Suppose we want to execute target D. From its In a chain of dependencies stretching back from a given target such as D above, each target gets executed only once, even when more than one target depends on it. Thus, executing the D target will first result in C being called, which in turn will first call B, which in turn will first call A. After A, then B, then C have executed, execution returns to the dependency list of D, which will not call B and A, since they were already called in process of dependency resolution for C and B respectively as dependencies of D. Had no such dependencies been discovered in processing C and B, B and A would have been executed after C in processing D's dependency list.

A target also has the ability to perform its execution if (or unless) a property has been set. This allows, for example, better control on the building process depending on the state of the system (java version, OS, command-line property defines, etc.). To make a target sense this property, you should add the unless) attribute with the name of the property that the target should react to. Note: Ant will only check whether the property has been set, the value doesn't matter. A property set to the empty string is still an existing property. For example:

						
								<target name="build-module-A" if="module-A-present"/>
						
				
						
								<target name="build-own-fake-module-A" unless="module-A-present"/>
						
				

In the first example, if the module-A-present property is set (again, to any value), the target will not be run.

If no unless attribute is present, the target will always be executed.

Important: the unless attributes only enable or disable the target to which they are attached. They do not control whether or not targets that a conditional target depends upon get executed. In fact, they do not even get evaluated until the target is about to be executed, and all its predecessors have already run.

The optional -projecthelp command-line option. Targets without such a description are deemed internal and will not be listed, unless either the -debug option is used.

It is a good practice to place your tstamp tasks in a so-called initialization target, on which all other targets depend. Make sure that target is always the first one in the depends list of the other targets. In this manual, most initialization targets have the name .

If the depends attribute and the if/unless attribute are set, the depends attribute is executed first.

A target has the following attributes:

Attribute Description Required
name the name of the target. Yes
depends a comma-separated list of names of targets on which this target depends. No
if the name of the property that must be set in order for this target to execute. No
unless the name of the property that must not be set in order for this target to execute. No
description a short description of this target's function. No

A target name can be any alphanumeric string valid in the encoding of the XML file. The empty string "" is in this set, as is comma "," and space " ". Please avoid using these, as they will not be supported in future Ant versions because of all the confusion they cause. IDE support of unusual target names, or any target name containing spaces, varies with the IDE.

Targets beginning with a hyphen such as are valid, and can be used to name targets that should not be called directly from the command line.

Tasks

A task is a piece of code that can be executed.

A task can have multiple attributes (or arguments, if you prefer). The value of an attribute might contain references to a property. These references will be resolved before the task is executed.

Tasks have a common structure:

						
								<nameattribute1="value1" attribute2="value2" ... />
						
				

where name is the name of the task, attributeN is the attribute name, and valueN is the value for this attribute.

There is a set of built-in tasks , along with a number of optional tasks , but it is also very easy to write your own .

All tasks share a task name attribute. The value of this attribute will be used in the logging messages generated by Ant.

Tasks can be assigned an <taskname id="taskID" ... />

where taskname is the name of the task, and taskID is a unique identifier for this task. You can refer to the corresponding task object in scripts or other tasks via this name. For example, in scripts you could do:

						
								<script ... >
task1.setFoo("bar");
</script>

to set the project.getReference("task1").

Note1: If "task1" has not been run yet, then it has not been configured (ie., no attributes have been set), and if it is going to be configured later, anything you've done to the instance may be overwritten.

Note2: Future versions of Ant will most likely not be backward-compatible with this behaviour, since there will likely be no task instances at all, only proxies.

Properties

A project can have a set of properties. These might be set in the buildfile by the property task, or might be set outside Ant. A property has a name and a value; the name is case-sensitive. Properties may be used in the value of task attributes. This is done by placing the property name between "build/classes.

Built-in Properties

Ant provides access to all system properties as if they had been defined using a ${os.name} expands to the name of the operating system.

For a list of system properties see the Javadoc of System.getProperties .

In addition, Ant has some built-in properties:

				
						basedir             the absolute path of the project's basedir (as set
with the basedir attribute of <project>).
ant.file the absolute path of the buildfile.
ant.version the version of Ant
ant.project.name the name of the project that is currently executing;
it is set in the name attribute of <project>.
ant.java.version the JVM version Ant detected; currently it can hold
the values "1.1", "1.2", "1.3", "1.4" and "1.5".

Example Buildfile

				
						<project name="MyProject" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>

<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>

<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>

Notice that we are declaring properties outside any target. As of Ant 1.6 all tasks can be declared outside targets (earlier version only allowed <typedef> and <antcall> for example).

We have given some targets descriptions; this causes the Finally, for this target to work the source in the <javac> task for details.

Token Filters

A project can have a set of tokens that might be automatically expanded if found when a file is copied, when the filtering-copy behavior is selected in the tasks that support this. These might be set in the buildfile by the filter task.

Since this can potentially be a very harmful behavior, the tokens in the files must be of the form @, where token is the token name that is set in the Note: If a token with the format @ is found in a file, but no filter is associated with that token, no changes take place; therefore, no escaping method is available - but as long as you choose appropriate names for your tokens, this should not cause problems.

Warning: If you copy binary files with filtering turned on, you can corrupt the files. This feature should be used with text files only.

Path-like Structures

You can specify CLASSPATH-type references using both "

Wherever path-like values need to be specified, a nested element can be used. This takes the general form of:

				
						    <classpath>
<pathelement path="${classpath}"/>
<pathelement location="lib/helper.jar"/>
</classpath>

The path attribute accepts colon- or semicolon-separated lists of locations. The location attributes should be preferred.

As a shortcut, the path and <classpath>
<pathelement path="${classpath}"/>
</classpath>

can be abbreviated to:

				
						    <classpath path="${classpath}"/>

In addition, DirSet s, FileSet s, and FileList s can be specified via nested <fileset>, and <classpath>
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<filelist refid="third-party_jars"/>
</classpath>

This builds a path that holds the value of lib directory, the classes under the ${build.dir}, except those that have the text If you want to use the same path-like structure for several tasks, you can define them with a References for an example.

A path-like structure can include a reference to another path-like structure via nested <path id="base.path">
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
</path>

<path id="tests.path">
<path refid="base.path"/>
<pathelement location="testclasses"/>
</path>

The shortcuts previously mentioned for <path>.For example:

				
						
								
								 <path id="base.path">
<pathelement path="${classpath}"/>
</path>

can be written as:

				
						 <path id="base.path" path="${classpath}"/>
				
		
				
						generally, you need not to write your builder.xml file started from scratch. you can just modify the following
part to meet your demand.
				
						<project name="javastep" default="deploy" basedir=".">
				
		
				
						<!-- ===================== Property Definitions =========================== -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽 All properties should be defined in this section.
聽聽聽聽聽聽聽聽 Any host-specific properties should be defined
聽聽聽聽聽聽聽聽 in the build.properties file.
				
						聽 In this app, the following properties are defined in build.properties:
				
		
				
						聽聽 o聽 tomcat.home聽聽聽聽 - the home directory of your Tomcat installation
聽聽聽聽聽聽聽 o聽 webapps.home聽聽聽 - the place to copy the war file to deploy it
聽聽聽 -->
				
						聽 <property file="build.properties" />
				
						聽 <property name="app.home"聽聽聽聽聽聽聽聽聽 value="." />
聽 <property name="app.name"聽聽聽聽聽聽聽聽聽 value="javastep" />
聽 <property name="javadoc.pkg.top"聽聽 value="hello" />
				
						聽 <property name="src.home"聽聽聽聽聽聽聽聽聽 value="${app.home}/src"/>
聽 <property name="lib.home"聽聽聽聽聽聽聽聽聽 value="${app.home}/WebRoot/WEB-INF/lib"/>

聽 <property name="classes.home"聽聽聽聽聽聽 value="${app.home}/WebRoot/WEB-INF/classes/"/>
聽 <property name="deploy.home"聽聽聽聽聽聽 value="${app.home}/deploy"/>
聽 <property name="doc.home"聽聽聽聽聽聽聽聽聽 value="${app.home}/doc"/>
聽 <property name="web.home"聽聽聽聽聽聽聽聽聽 value="${app.home}/WebRoot"/>
				
						聽 <property name="build.home"聽聽聽聽聽聽聽 value="${app.home}/build"/>
聽 <property name="build.classes"聽聽聽聽 value="${build.home}/WEB-INF/classes"/>
聽 <property name="build.lib"聽聽聽聽聽聽聽聽 value="${build.home}/WEB-INF/lib"/>
				
						<!-- ==================== Compilation Classpath =========================== -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽 This section creates the classpath for compilation.
聽聽聽 -->
				
						聽 <path id="compile.classpath">
				
		
				
						聽聽聽 <!-- The object files for this application -->
聽聽聽 <pathelement location="${classes.home}"/>
				
						聽聽聽 <!-- The lib files for this application -->
聽聽聽 <fileset dir="${lib.home}">
聽聽聽聽聽 <include name="*.jar"/>
聽聽聽聽聽 <include name="*.zip"/>
聽聽聽 </fileset>
				
						聽聽聽 <!-- All files/jars that Tomcat makes available -->
				
		
				
						
								
聽 </path>
				
						
								
<!-- ==================== Build Targets below here========================= -->
				
						
								
<!-- ==================== "help" Target =================================== -->
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽 This is the default ant target executed if no target is specified.
聽聽聽聽聽聽聽聽 This helps avoid users just typing 'ant' and running a
聽聽聽聽聽聽聽聽 default target that may not do what they are anticipating...
聽聽聽 -->
				
						聽<target name="help" >
聽聽 <echo message="Please specify a target! [usage: ant &lt;targetname&gt;]" />
聽聽 <echo message="Here is a list of possible targets: "/>
聽聽 <echo message="聽 clean-all.....Delete build dir, all .class and war files"/>
聽聽 <echo message="聽 prepare.......Creates directories if required" />
聽聽 <echo message="聽 compile.......Compiles source files" />
聽聽 <echo message="聽 build.........Build war file from .class and other files"/>
聽聽 <echo message="聽 deploy........Copy war file to the webapps directory" />
聽聽 <echo message="聽 javadoc.......Generates javadoc for this application" />
聽</target>
				
						<!-- ==================== "clean-all" Target ============================== -->
				
		
				
						聽聽 <!--
聽聽聽聽聽聽聽聽聽 This target should clean up any traces of the application
聽聽聽聽聽聽聽聽聽 so that if you run a new build directly after cleaning, all
聽聽聽聽聽聽聽聽聽 files will be replaced with what's current in source control
聽聽 -->
				
						聽<target name="clean-all" >
聽聽聽 <delete dir="${build.home}"/>
聽聽聽 <delete dir="${classes.home}"/>
聽聽聽 <delete dir="${deploy.home}"/>
				
						聽聽聽 <!-- can't delete directory if Tomcat is running -->
聽聽聽 <delete dir="${webapps.home}/${app.name}" failonerror="false"/>
				
						聽聽聽 <!-- deleting the deployed .war file is fine even if Tomcat is running -->
聽聽聽 <delete dir="${webapps.home}/${app.name}.war" />
				
						聽聽聽 <!-- delete the javadoc -->
聽聽聽 <delete dir="${doc.home}"/>
				
						聽</target>
				
		
				
						<!-- ==================== "prepare" Target ================================ -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽聽 This target is executed prior to any of the later targets
聽聽聽聽聽聽聽聽聽 to make sure the directories exist. It only creates them
聽聽聽聽聽聽聽聽聽 if they need to be created....
聽聽聽聽聽聽聽聽聽 Other, similar, preparation steps can be placed here.
聽聽聽 -->
				
						聽 <target name="prepare">
				
		
				
						聽聽聽 <echo message="Tomcat Home = ${tomcat.home}" />
聽聽聽 <echo message="webapps Home = ${webapps.home}" />
				
						聽聽聽 <mkdir dir="${classes.home}"/>
聽聽聽 <mkdir dir="${deploy.home}"/>
				
						聽聽聽 <mkdir dir="${doc.home}"/>
聽聽聽 <mkdir dir="${doc.home}/api"/>
				
						聽聽聽 <mkdir dir="${build.home}"/>
聽聽聽 <mkdir dir="${build.home}/WEB-INF" />
聽聽聽 <mkdir dir="${build.home}/WEB-INF/classes" />
聽聽聽 <mkdir dir="${build.home}/WEB-INF/lib" />
				
						聽 </target>
				
		
				
						<!-- ==================== "compile" Target ================================ -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽聽 This only compiles java files that are newer
聽聽聽聽聽聽聽聽聽 than their corresponding .class files.
聽聽聽聽 -->
				
						聽 <target name="compile" depends="prepare" >
聽聽聽 <javac srcdir="${src.home}" destdir="${classes.home}" debug="yes" >
聽聽聽聽聽聽聽 <classpath refid="compile.classpath"/>
聽聽聽 </javac>
聽 </target>
				
						<!-- ==================== "build" Target ================================== -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽聽 This target builds the war file for the application
聽聽聽聽聽聽聽聽聽 by first building the directory structure of the
聽聽聽聽聽聽聽聽聽 application in ${build.home} and then creating the
聽聽聽聽聽聽聽聽聽 war file using the ant <war> task
聽聽聽聽 -->
				
						聽 <target name="build" >
				
		
				
						聽聽聽 <!-- Copy all the webapp content (jsp's, html, tld's, xml, etc. -->
聽聽聽 <!-- Note that this also copies the META-INF directory -->
聽聽聽 <copy聽聽聽 todir="${build.home}">
聽聽聽聽聽 <fileset dir="${web.home}"/>
聽聽聽 </copy>
				
						聽聽聽 <!-- Now, copy all the Java class files -->
聽聽聽 <copy聽聽聽 todir="${build.home}/WEB-INF/classes">
聽聽聽聽聽 <fileset dir="${classes.home}"/>
聽聽聽 </copy>
				
						聽聽聽 <!-- Now, copy all the properties files, etc that go on the classpath -->
聽聽聽 <copy聽聽聽 todir="${build.home}/WEB-INF/classes">
聽聽聽聽聽 <fileset dir="${src.home}">
聽聽聽聽聽聽聽聽 <include name="**/*.properties" />
聽聽聽聽聽聽聽聽 <include name="**/*.prop" />
聽聽聽聽聽 </fileset>
聽聽聽 </copy>
				
						聽聽聽 <!-- Now, copy all the jar files we need -->
聽聽聽 <copy聽聽聽 todir="${build.home}/WEB-INF/lib">
聽聽聽聽聽 <fileset dir="${lib.home}" />
聽聽聽 </copy>
				
						聽聽聽 <!-- Create the <war> file -->
聽聽聽 <jar jarfile="${deploy.home}/${app.name}.war"
聽聽聽聽聽聽聽聽 basedir="${build.home}"/>
				
						聽 </target>
				
		
				
						<!-- ==================== "deploy" Target ================================= -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽 This target simply copies the war file from the deploy
聽聽聽聽聽聽聽聽 directory into the Tomcat webapp directory.
聽聽聽聽 -->
				
						聽 <target name="deploy" depends="build" >
				
		
				
						聽聽聽 <!-- Copy the contents of the build directory -->
聽聽聽 <copy todir="${webapps.home}"聽 file="${deploy.home}/${app.name}.war" />
				
						聽 </target>
				
		
				
						<!-- ==================== "doc" Target ==================================== -->
				
		
				
						聽聽聽 <!--
聽聽聽聽聽聽聽聽 This task creates javadoc. It is dependent upon only the
聽聽聽聽聽聽聽聽 'compile' target so it is not executed in a normal build.
聽聽聽聽聽聽聽聽 As a result, the target needs to be run on its own.
聽聽聽 -->
				
						聽 <target name="javadoc" depends="compile">
聽聽聽聽聽 <javadoc sourcepath = "${src.home}"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 destdir = "${doc.home}/api"
聽聽聽聽聽聽聽聽聽聽聽聽 packagenames = "${javadoc.pkg.top}.*"/>
聽 </target>

<!-- ==================== "test" Target ================================== -->
				
						聽聽聽 <!--
聽聽聽聽聽聽聽 This task runs all test cases. It invokes each test case individually.
聽聽聽聽聽聽聽 The "test-all" target is tied back to the "struts-test" target which
聽聽聽聽聽聽聽 actually runs the tests. This allows other test targets to be created
聽聽聽聽聽聽聽 in this section while maintaining the ability to run each test target
聽聽聽聽聽聽聽 individually. All individual test targets should be added to the
聽聽聽聽聽聽聽 "depends" attribute of the "test-all" target to provide a single
聽聽聽聽聽聽聽 target that runs all tests.
-->
				
						聽 <target name="test-all" depends="struts-tests" />
				
		
				
						聽 <target name="struts-tests" depends="build" >
				
		
				
						聽聽聽聽聽 <junit printsummary="yes" >
				
		
				
						聽聽聽聽聽聽聽聽聽 <classpath >
聽聽聽聽聽聽聽聽聽聽聽聽聽 <pathelement location="${classes.home}"/>
聽聽聽聽聽聽聽聽聽聽聽聽聽 <pathelement location="${build.home}"/>
聽聽聽聽聽聽聽聽聽聽聽聽聽 <pathelement location="${build.home}/WEB-INF/classes"/>
聽聽聽聽聽聽聽聽聽聽聽聽聽 <path refid="compile.classpath"/>
聽聽聽聽聽聽聽聽聽 </classpath>
				
						聽聽聽聽聽聽聽聽聽 <formatter type="plain" />
聽聽聽聽聽聽聽聽聽 <test name="hello.mocktest.TestHelloAction" />
聽聽聽聽聽聽聽聽聽 <test name="hello.mocktest.TestHelloActionMultiple" />
聽聽聽聽聽 </junit>
聽聽聽
聽 </target>
</project>



junhong 2006-04-19 21:41 鍙戣〃璇勮
]]>
how to use sitemesh http://www.tkk7.com/junhong/archive/2006/04/13/40996.htmljunhongjunhongThu, 13 Apr 2006 15:41:00 GMThttp://www.tkk7.com/junhong/archive/2006/04/13/40996.htmlhttp://www.tkk7.com/junhong/comments/40996.htmlhttp://www.tkk7.com/junhong/archive/2006/04/13/40996.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/40996.htmlhttp://www.tkk7.com/junhong/services/trackbacks/40996.htmlCopy sitemesh-2.2.1.jar into [web-app]/WEB-INF/lib.
  • Create the file [web-app]/WEB-INF/decorators.xml that contains the following:

    <decorators>
    </decorators>
  • (Optional) Create the file [web-app]/WEB-INF/sitemesh.xml that contains the following:
    <sitemesh>
        <property name="decorators-file" value="/WEB-INF/decorators.xml" />
        <excludes file="${decorators-file}" />
    
        <page-parsers>
            <parser content-type="text/html"
                class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
            <parser content-type="text/html;charset=ISO-8859-1"
                class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
        </page-parsers>
    
        <decorator-mappers>
            <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
                <param name="config" value="${decorators-file}" />
            </mapper>
        </decorator-mappers>
    </sitemesh>
    
  • Add the following to [web-app]/WEB-INF/web.xml within the <web-app> tag:

    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    Decorators are the pages that "decorate" the original, requested page (the page that is handed to the SiteMesh filter from the web container). Most (HTML) decorators are a combination of:
    • meta tags (keywords, description, author)
    • stylesheet (CSS)
    • header
    • navigation
    • footer
    • copyright notice
    First, define what different navigation/layout schemes you need. For example: Do I need a default decorator (a standard one for all pages)? Do I have a special layout for the index page? Is the header needed for my documentation files? Do I need printable version of my website?

    Web Application Structure

    Here is an example structure of a web application. This is not needed for SiteMesh to work.

    /decorators

    Directory containing all decorator files (e.g. main.jsp, printable.jsp).

    /includes

    Directory containing all files to be included into other files (e.g. header.jsp, footer.jsp, copyright.jsp).

    /images

    Directory containing all images (e.g. background.gif, logo.gif).

    /styles

    Directory containing all .CSS styles (e.g. ie4.css, ns4.css).

    /scripts

    Directory containing all scripts (JavaScript, VBScript files).

    Good practices:

    • Define a stylesheet to use in the entire application and include it using this script.
    • Use includes in your decorators (e.g. includes/navigation.jsp, includes/style.jsp).
    • Try not to refer to the absolute root ("/") path. Use <%=request.getContextPath()%>/ instead. This will make life easier when moving your web application under another context path.
    • Making your decorators compatible with multiple browsers (IE, Mozilla, Opera, ...) will (probably) make your entire application (all decorated pages) compatible.
    • Be careful when using frames, because decorators may NOT be applied to frames (FrameSetDecoratorMapper).

    My First Decorator

    Basically, all you need to know is what decorator tags you can use. The title, head and body tags are most used.
    Here is an example of a decorator (save it as /decorators/main.jsp):

    1: <%--
    2: % This is the main decorator for all SOMECOMPANY INTRANET pages.
    3: % It includes standard caching, style sheet, header, footer and copyright notice.
    4: --%>
    5: <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
    6: <%@ include file="7: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    8: <html>
    9: <head>
    10: <title><decorator:title default="INTRANET" /></title>
    11: <decorator:head />
    12: <%@ include file="

    13: </head>
    14: <body bgcolor="#FFFFFF" background="<%=request.getContextPath()%>/images/bg.gif">
    15: <script type="text/javascript">window.status = "Loading: <decorator:title default="INTRANET" />...";</script>
    16: <%@ include file="/includes/header.jsp"%>
    17: <table width="100%" border="0" cellspacing="0" cellpadding="0">
    18: <tr>
    19: <td height="20" nowrap> </td>
    20: </tr>
    21: <tr>
    22: <td width="1%" nowrap> </td>
    23: <td width="16%" valign="top" nowrap>
    23: <script type="text/javascript">window.status = "Loading: Navigation...";</script>
    24: <%@ include file="/includes/navigation.jsp" %>
    25: </td>
    26: <td width="2%" nowrap> </td>
    27: <td valign="top">
    28: <br>
    29: <script type="text/javascript">window.status = "Loading: Document body...";</script>
    30: <div class="docBody"><decorator:body /></div>
    31: </td>
    32: <td width="1%" nowrap> </td>
    33: </tr>
    34: </table>
    35: <br>
    36: <%@ include file="/includes/footer.jsp" %>
    37: <%@ include file="/includes/copyright.jsp" %>
    38: <script type="text/javascript">window.status = "Done";</script>
    39: </body>
    40: </html>

    Now open WEB-INF/decorators.xml with your favorite editor and let SiteMesh know there is a decorator (with a mapping):

    <decorators defaultdir="/decorators">
        <decorator name="main" page="main.jsp">
            聽聽<pattern>/*</pattern>
        </decorator>
    </decorators>
    

    Now deploy the web application, go to the welcome page, and the main decorator will be applied.

  • When a page has been parsed, it then has to be mapped to a decorator. This mapping is performed by a chain of DecoratorMappers (referred to as mappers from here on).

    For each request, the first mapper in the chain is asked which decorator should be used. It is passed across a reference to the Page object and HttpServletRequest. It returns either a Decorator object, if it knows which decorator to be used, or null. If null is returned, the next mapper in the chain is queried. This whole process is repeated until there are no more mappers in the chain, or one of the mappers returns a valid decorator. If no mappers return a decorator, the page is not decorated at all and served in its original state.

    This way the mappers are chained together and queried is known as the Chain of Responsibility design pattern.

    Examples of mappers:

    • Determine decorator based on path of requested page.
    • Use different decorators based on time, locale or browser.
    • Use simplified decorators for search-engine robots.
    • Switch decorators based on a URL parameter, request attribute or meta-tag.
    • Use custom decorators based on user's saved settings...

    The main implementation of DecoratorMapper is ConfigDecoratorMapper which reads the decorators and mappings from /WEB-INF/decorators.xml. The appropriate decorator is then applied depending on the URL pattern.

    DecoratorMappers are simple to write and the distribution includes some samples that demonstrate how to write them and how flexible they can be. These are:

    AgentDecoratorMapper Can determine the user-agent (i.e. web-browser) requesting a page, and map to a suitable Decorator.
    ConfigDecoratorMapper Default implementation of DecoratorMapper. Reads decorators and mappings from the config property (default '/WEB- INF/decorators.xml').
    CookieDecoratorMapper Will map a suitable decorator based on a cookie value.
    EnvEntryDecoratorMapper Allows the reference to a web-app environment entry for the decorator name, and falls back to ConfigDecoratorMapper's behavior if no matching environment entry is found.
    FileDecoratorMapper Will treat the name of the decorator as a file-name to use (in the context of the web-app).
    FrameSetDecoratorMapper Will use the specified decorator when the Page is an instance of HTMLPage and isFrameSet() returns true. The name of this decorator should be supplied in the decorator property - if no decorator property is supplied, no decorator is applied to frame based pages.
    InlineDecoratorMapper Used to determine the correct Decorator when using inline decorators.
    LanguageDecoratorMapper Can determine the preferred language set in the browser requesting a page, and map to a suitable Decorator (using the "Accept-Language" HTTP header).
    PageDecoratorMapper The actual Page determines the Decorator to be used.

    The 'meta.decorator' and 'decorator' properties of the page are accessed and if any of them contain the name of a valid Decorator, that Decorator shall be applied.

    ParameterDecoratorMapper Will choose the decorator based on request parameters.

    The ParameterDecoratorMapper is configured via three properties.

    decorator.parameter - the parameter which contains the name of the decorator which will be mapped. The default is "decorator".

    For example if decorator.parameter is "foobar" then myurl.jsp?foobar=mydecorator will map to the decorator named "mydecorator".

    You can also supply an optional 'confirmation parameter'. The decorator will only be mapped if the parameter named parameter.name is in the request URI and the value of that parameter is equal to the parameter.value property.

    For example assuming parameter.name=confirm and parameter.value=true the URI myurl.jsp?decorator=mydecorator&confirm=true will map the decorator mydecorator. where as the URIs myurl.jsp?decorator=mydecorator and myurl.jsp?decorator=mydecorator&confirm=false will not return any decorator.

    SessionDecoratorMapper

    Will look at a session attribute to find the name of an appropriate decorator to use. If the session attribute is present, the mapper will not do anything and allow the next mapper in the chain to select a decorator.

    By default, it will look at the 'decorator' session attribute, however this can be overriden by configuring the mapper with a 'decorator.parameter' property.

    PrintableDecoratorMapper Will check to see whether 'printable=true' is supplied as a request parameter and if so, use the specified decorator instead. The name of this decorator should be supplied in the decorator property.
    RobotDecoratorMapper Will use the specified decorator when the requester is identified as a robot (also known as spider, crawler, ferret) of a search engine. The name of this decorator should be supplied in the decorator property.

    An example of a custom DecoratorMapper could be one that displays different Decorators based on time (e.g. morning, afternoon, Christmas, etc).

    Custom mapper configuration

    To be able to specify which mappers will be applied to a request, create the file [web-app]/WEB-INF/sitemesh.xml that contains the following:

    <sitemesh>
        <property name="decorators-file" value="/WEB-INF/decorators.xml" />
        <excludes file="${decorators-file}" />
    
        <page-parsers>
            <parser content-type="text/html"
                class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
            <parser content-type="text/html;charset=ISO-8859-1"
                class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
        </page-parsers>
    
        <decorator-mappers>
            <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
                <param name="config" value="${decorators-file}" />
            </mapper>
        </decorator-mappers>
    </sitemesh>
    

    In this example, the only mapper that will be applied is the ConfigDecoratorMapper, and that will only be applied to responses of type text/html or text/html;charset=ISO-8859-1. Responses of any other content type (eg image/gif) will be ignored by Sitemesh. Additionally, any files that match a pattern specified in the excludes file (in this case '/WEB-INF/decorators.xml') will not be touched by Sitemesh.

    The excludes file points to an XML file that contains an <excludes /> block similar to the following:

    <decorators>
        <excludes>
            <pattern>/plainPage.jsp</pattern>
            <pattern>/plain/*.jsp</pattern>
        </excludes>
    </decorators>
    

    The above example would prevent /plainPage.jsp and any JSP pages in the /plain directory from being decorated. (Note that the pattern matching follows exactly the same rules as the decorator mappings used by the ConfigDecoratorMapper.)

    Typically the <excludes /> block is just added at the start of the decorators.xml file, however this is not a requirement and any other XML file can be specified instead by changing the excludes file specified in sitemesh.xml. This might be useful if for example the ConfigDecoratorMapper is not being used in your deployment.

    Note that preventing pages from being decorated by adding them to the excludes list superceeds, and is a better approach than, the old method of mapping the pages to a non-existent decorator. This is because when pages were mapped to a non-existent decorator they were still buffered internally by Sitemesh. By using the exclude list Sitemesh will not let the request pass straight through to the servlet container without any buffering.

    Default mapper configuration

    If sitemesh.xml is not found in the WEB-INF dir, the default mapper configuration will be used. The default mapper configuration is defined in sitemesh-default.xml (packaged inside the jar) and consists of the following mappers:

    • PageDecoratorMapper
    • FrameSetDecoratorMapper
    • PrintableDecoratorMapper
    • FileDecoratorMapper
    • ConfigDecoratorMapper

    By default only content of type text/html will be decorated by Sitemesh.



    for more detail, please refer to http://www.opensymphony.com/sitemesh/dm.html



  • junhong 2006-04-13 23:41 鍙戣〃璇勮
    ]]>
    Design Pattern with java (part three)http://www.tkk7.com/junhong/archive/2006/04/10/40347.htmljunhongjunhongMon, 10 Apr 2006 15:51:00 GMThttp://www.tkk7.com/junhong/archive/2006/04/10/40347.htmlhttp://www.tkk7.com/junhong/comments/40347.htmlhttp://www.tkk7.com/junhong/archive/2006/04/10/40347.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/40347.htmlhttp://www.tkk7.com/junhong/services/trackbacks/40347.htmlSpecialized creation


    1. Prototype
      Objects are created by cloning a prototypical instance.
    2. Builder
      The goal of builder is to separate the construction from the 鈥渞epresentation,鈥?to allow multiple
      different representations. The construction process stays the same, but the resulting object
      has different possible representations. GoF points out that the main difference with Abstract
      Factory is that a Builder creates the object step-by-step, so the fact that the creation process is
      spread out in time seems to be important. In addition, it seems that the 鈥渄irector鈥?gets a
      stream of pieces that it passes to the Builder, and each piece is used to perform one of the
      steps in the build process.
      One example given in GoF is that of a text format converter. The incoming format is RTF, and
      once it is parsed the directives are passed to the text converter, which may be implemented in
      different ways depending on whether the resulting format is ASCII, TeX, or a 鈥淕UI Text
      Widget.鈥?Although the resulting 鈥渙bject鈥?(the entire converted text file) is created over time, if
      you consider the conversion of each RTF directive to be an object, this feels to me a little more
      like Bridge, because the specific types of converters extend the interface of the base class.
      Also, the general solution to the problem would allow multiple readers on the 鈥渇ront end鈥?and
      multiple converters on the 鈥渂ack end,鈥?which is a primary characteristic of Bridge.
      To me, the fact that Builder has multiple steps in creating an object, and those steps are
      accessed externally to the Builder object, is the essence of what distinguishes it (structurally,
      anyway) from a regular factory. However, GoF emphasizes that you鈥檙e able to create different
      representations using the same process. They never define exactly what they mean by
      representation. (Does the 鈥渞epresentation鈥?involve an object that is too large? Would the need
      for Builder vanish if the representation was broken into smaller objects?)
      The other example in GoF creates a maze object and adds rooms within the maze and doors
      within the rooms. Thus it is a multistep process, but alas, the different 鈥渞epresentations鈥?are
      the 鈥淪tandard鈥?and 鈥淐omplex鈥?mazes 鈥?not really different kinds of mazes, but instead
      different complexity. I think I would have tried to create one maze builder that could handle

      arbitrarily complex mazes. The final variation of the maze builder is something that doesn鈥檛
      create mazes at all, but instead counts the rooms in an existing maze.
      Neither the RTF converter nor the Mazebuilder example makes an overwhelmingly
      compelling case for Builder. Readers have suggested that the output of the Sax XML parser,
      and standard compiler parsers, might naturally be fed into a Builder.
      Here鈥檚 an example that may be a little more compelling, or at least give more of an idea of
      what Builder is trying to do. Media may be constructed into different representations, in this
      case books, magazines and web sites. The example argues that the steps involved are the
      same, and so can be abstracted into the director class.
      //: builder:BuildMedia.java
      // Example of the Builder pattern
      package builder;
      import java.util.*;
      import junit.framework.*;
      // Different "representations" of media:
      class Media extends ArrayList {}
      class Book extends Media {}
      class Magazine extends Media {}
      class WebSite extends Media {}
      // ... contain different kinds of media items:
      class MediaItem {
      private String s;
      public MediaItem(String s) { this.s = s; }
      public String toString() { return s; }
      }
      class Chapter extends MediaItem {
      public Chapter(String s) { super(s); }
      }
      class Article extends MediaItem {
      public Article(String s) { super(s); }
      }
      class WebItem extends MediaItem {
      public WebItem(String s) { super(s); }
      }
      // ... but use the same basic construction steps:
      class MediaBuilder {
      public void buildBase() {}
      public void addMediaItem(MediaItem item) {}
      public Media getFinishedMedia() { return null; }
      }
      class BookBuilder extends MediaBuilder {
      private Book b;
      public void buildBase() {
      System.out.println("Building book framework");
      b = new Book();
      }
      public void addMediaItem(MediaItem chapter) {
      System.out.println("Adding chapter " + chapter);
      b.add(chapter);
      }
      public Media getFinishedMedia() { return b; }
      }
      class MagazineBuilder extends MediaBuilder {

      private Magazine m;
      public void buildBase() {
      System.out.println("Building magazine framework");
      m = new Magazine();
      }
      public void addMediaItem(MediaItem article) {
      System.out.println("Adding article " + article);
      m.add(article);
      }
      public Media getFinishedMedia() { return m; }
      }
      class WebSiteBuilder extends MediaBuilder {
      private WebSite w;
      public void buildBase() {
      System.out.println("Building web site framework");
      w = new WebSite();
      }
      public void addMediaItem(MediaItem webItem) {
      System.out.println("Adding web item " + webItem);
      w.add(webItem);
      }
      public Media getFinishedMedia() { return w; }
      }
      class MediaDirector { // a.k.a. "Context"
      private MediaBuilder mb;
      public MediaDirector(MediaBuilder mb) {
      this.mb = mb; // Strategy-ish
      }
      public Media produceMedia(List input) {
      mb.buildBase();
      for(Iterator it = input.iterator(); it.hasNext();)
      mb.addMediaItem((MediaItem)it.next());
      return mb.getFinishedMedia();
      }
      };
      public class BuildMedia extends TestCase {
      private List input = Arrays.asList(new MediaItem[] {
      new MediaItem("item1"), new MediaItem("item2"),
      new MediaItem("item3"), new MediaItem("item4"),
      });
      public void testBook() {
      MediaDirector buildBook =
      new MediaDirector(new BookBuilder());
      Media book = buildBook.produceMedia(input);
      String result = "book: " + book;
      System.out.println(result);
      assertEquals(result,
      "book: [item1, item2, item3, item4]");
      }
      public void testMagazine() {
      MediaDirector buildMagazine =
      new MediaDirector(new MagazineBuilder());
      Media magazine = buildMagazine.produceMedia(input);
      String result = "magazine: " + magazine;
      System.out.println(result);
      assertEquals(result,
      "magazine: [item1, item2, item3, item4]");
      }

      public void testWebSite() {
      MediaDirector buildWebSite =
      new MediaDirector(new WebSiteBuilder());
      Media webSite = buildWebSite.produceMedia(input);
      String result = "web site: " + webSite;
      System.out.println(result);
      assertEquals(result,
      "web site: [item1, item2, item3, item4]");
      }
      public static void main(String[] args) {
      junit.textui.TestRunner.run(BuildMedia.class);
      }
      } ///:~



    junhong 2006-04-10 23:51 鍙戣〃璇勮
    ]]>
    Design Pattern with java (part two) http://www.tkk7.com/junhong/archive/2006/04/10/40343.htmljunhongjunhongMon, 10 Apr 2006 15:23:00 GMThttp://www.tkk7.com/junhong/archive/2006/04/10/40343.htmlhttp://www.tkk7.com/junhong/comments/40343.htmlhttp://www.tkk7.com/junhong/archive/2006/04/10/40343.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/40343.htmlhttp://www.tkk7.com/junhong/services/trackbacks/40343.html Encapsulating creation


    Although only the Simple Factory Method is a true singleton, you鈥檒l find that each specify
    factory class in the more general types of factories will only have a single instance.
    1. Simple Factory method
      One approach is to make the factory a static method of the base class:
      //: factory:shapefact1:ShapeFactory1.java
      // A simple static factory method.
      package factory.shapefact1;
      import java.util.*;
      import junit.framework.*;
      abstract class Shape {
      public abstract void draw();
      public abstract void erase();
      public static Shape factory(String type) {
      if(type.equals("Circle")) return new Circle();
      if(type.equals("Square")) return new Square();
      throw new RuntimeException(
      "Bad shape creation: " + type);
      }
      }
      class Circle extends Shape {Circle() {} // Package-access constructor
      public void draw() {
      System.out.println("Circle.draw");
      }
      public void erase() {
      System.out.println("Circle.erase");
      }
      }
      class Square extends Shape {
      Square() {} // Package-access constructor
      public void draw() {
      System.out.println("Square.draw");
      }
      public void erase() {
      System.out.println("Square.erase");
      }
      }
      public class ShapeFactory1 extends TestCase {
      String shlist[] = { "Circle", "Square",
      "Square", "Circle", "Circle", "Square" };
      List shapes = new ArrayList();
      public void test() {
      Iterator it = Arrays.asList(shlist).iterator();
      while(it.hasNext())
      shapes.add(Shape.factory((String)it.next()));
      it = shapes.iterator();
      while(it.hasNext()) {
      Shape s = (Shape)it.next();
      s.draw();
      s.erase();
      }
      }
      public static void main(String args[]) {
      junit.textui.TestRunner.run(ShapeFactory1.class);
      }
      } ///:~
      To encourage creation to only happen in the factory( ), the constructors for the specific
      types of Shape are give package access, so factory( ) has access to the constructors but they
      are not available outside the package.
    2. Polymorphic factories
      different types of factories can be subclassed from the basic factory,for example
      interface Shape {
      void draw();
      void erase();
      }
      abstract class ShapeFactory {
      protected abstract Shape create();
      private static Map factories = new HashMap();
      public static void
      addFactory(String id, ShapeFactory f) {
      factories.put(id, f);
      }
      // A Template Method:
      public static final
      Shape createShape(String id) {
      if(!factories.containsKey(id)) {
      try {
      // Load dynamically
      Class.forName("factory.shapefact2." + id);
      } catch(ClassNotFoundException e) {
      throw new RuntimeException(
      "Bad shape creation: " + id);
      }
      // See if it was put in:
      if(!factories.containsKey(id))
      throw new RuntimeException(
      "Bad shape creation: " + id);
      }
      return
      ((ShapeFactory)factories.get(id)).create();
      }
      }
      class Circle implements Shape {
      private Circle() {}
      public void draw() {
      System.out.println("Circle.draw");
      }
      public void erase() {
      System.out.println("Circle.erase");
      }
      private static class Factory
      extends ShapeFactory {
      protected Shape create() {
      return new Circle();
      }
      }
      static {
      ShapeFactory.addFactory(
      "Circle", new Factory());
      }
      }
      .......
    3. Abstract factories
      The Abstract Factory pattern looks like the factory objects we鈥檝e seen previously, with not
      one but several factory methods. Each of the factory methods creates a different kind of
      object. The idea is that at the point of creation of the factory object, you decide how all the
      objects created by that factory will be used.
      As another example suppose you are creating a general-purpose gaming environment and you
      want to be able to support different types of games
      interface Obstacle {
      void action();
      }
      interface Player {
      void interactWith(Obstacle o);
      }
      class Kitty implements Player {
      public void interactWith(Obstacle ob) {
      System.out.print("Kitty has encountered a ");
      ob.action();
      }
      }
      class KungFuGuy implements Player {
      public void interactWith(Obstacle ob) {
      System.out.print("KungFuGuy now battles a ");
      ob.action();
      }
      }
      class Puzzle implements Obstacle {
      public void action() {
      System.out.println("Puzzle");
      }
      }
      class NastyWeapon implements Obstacle {
      public void action() {
      System.out.println("NastyWeapon");
      }
      }
      // The Abstract Factory:
      interface GameElementFactory {Player makePlayer();
      Obstacle makeObstacle();
      }
      // Concrete factories:
      class KittiesAndPuzzles
      implements GameElementFactory {
      public Player makePlayer() {
      return new Kitty();
      }
      public Obstacle makeObstacle() {
      return new Puzzle();
      }
      }
      class KillAndDismember
      implements GameElementFactory {
      public Player makePlayer() {
      return new KungFuGuy();
      }
      public Obstacle makeObstacle() {
      return new NastyWeapon();
      }
      }
      class GameEnvironment {
      private GameElementFactory gef;
      private Player p;
      private Obstacle ob;
      public GameEnvironment(
      GameElementFactory factory) {
      gef = factory;
      p = factory.makePlayer();
      ob = factory.makeObstacle();
      }
      public void play() { p.interactWith(ob); }
      }
      public class Games extends TestCase {
      GameElementFactory
      kp = new KittiesAndPuzzles(),
      kd = new KillAndDismember();
      GameEnvironment
      g1 = new GameEnvironment(kp),
      g2 = new GameEnvironment(kd);
      // These just ensure no exceptions are thrown:
      public void test1() { g1.play(); }
      public void test2() { g2.play(); }
      public static void main(String args[]) {
      junit.textui.TestRunner.run(Games.class);
      }
      } ///:~
      In this environment, Player objects interact with Obstacle objects, but there are different
      types of players and obstacles depending on what kind of game you鈥檙e playing. You determine
      the kind of game by choosing a particular GameElementFactory, and then the
      GameEnvironment controls the setup and play of the game. In this example, the setup and
      play is very simple, but those activities (the initial conditions and the state change) can
      determine much of the game鈥檚 outcome. Here, GameEnvironment is not designed to be
      inherited, although it could very possibly make sense to do that.


    junhong 2006-04-10 23:23 鍙戣〃璇勮
    ]]>
    Design Pattern with java (part one)http://www.tkk7.com/junhong/archive/2006/04/09/40108.htmljunhongjunhongSun, 09 Apr 2006 09:15:00 GMThttp://www.tkk7.com/junhong/archive/2006/04/09/40108.htmlhttp://www.tkk7.com/junhong/comments/40108.htmlhttp://www.tkk7.com/junhong/archive/2006/04/09/40108.html#Feedback0http://www.tkk7.com/junhong/comments/commentRss/40108.htmlhttp://www.tkk7.com/junhong/services/trackbacks/40108.html
  • Messager
    The most trivial of these is the messenger, which simply packages information into an object
    to be passed around, instead of passing all the pieces around separately. Note that without the
    messenger, the code for translate() would be much more confusing to read:
  • Collecting Parameter
    Messenger鈥檚 big brother is the collecting parameter, whose job is to capture information from
    the method to which it is passed. Generally, this is used when the collecting parameter is
    passed to multiple methods, so it鈥檚 like a bee collecting pollen.
    A container makes an especially useful collecting parameter, since it is already set up to
    dynamically add objects.
  • Object quantity:Singleton and object pool
    Singleton:The key to creating a singleton is to prevent the client programmer from having any way to
    create an object except the ways you provide. You must make all constructors private, and
    you must create at least one constructor to prevent the compiler from synthesizing a default
    constructor for you (which it will create using package access).
  • Object pool:If this is an issue, you can create a solution involving a check-out
    and check-in of the shared objects. see the following example
    //: singleton:PoolManager.java
    package singleton;
    import java.util.*;
    public class PoolManager {
    private static class PoolItem {
    boolean inUse = false;
    Object item;
    PoolItem(Object item) { this.item = item; }
    }
    private ArrayList items = new ArrayList();
    public void add(Object item) {
    items.add(new PoolItem(item));
    }
    static class EmptyPoolException extends Exception {}
    public Object get() throws EmptyPoolException {
    for(int i = 0; i < items.size(); i++) {
    PoolItem pitem = (PoolItem)items.get(i);
    if(pitem.inUse == false) {
    pitem.inUse = true;
    return pitem.item;
    }
    }
    // Fail early:
    throw new EmptyPoolException();
    // return null; // Delayed failure
    }
    public void release(Object item) {
    for(int i = 0; i < items.size(); i++) {
    PoolItem pitem = (PoolItem)items.get(i);
    if(item == pitem.item) {
    pitem.inUse = false;
    return;
    }
    }
    throw new RuntimeException(item + " not found");
    }
    } ///:~
    //: singleton:ConnectionPoolDemo.java
    package singleton;
    import junit.framework.*;
    interface Connection {
    Object get();
    void set(Object x);
    }
    class ConnectionImplementation implements Connection {
    public Object get() { return null; }
    public void set(Object s) {}
    }
    class ConnectionPool { // A singleton
    private static PoolManager pool = new PoolManager();
    public static void addConnections(int number) {
    17 z 157
    for(int i = 0; i < number; i++)
    pool.add(new ConnectionImplementation());
    }
    public static Connection getConnection()
    throws PoolManager.EmptyPoolException {
    return (Connection)pool.get();
    }
    public static void releaseConnection(Connection c) {
    pool.release(c);
    }
    }
    public class ConnectionPoolDemo extends TestCase {
    static {
    ConnectionPool.addConnections(5);
    }
    public void test() {
    Connection c = null;
    try {
    c = ConnectionPool.getConnection();
    } catch (PoolManager.EmptyPoolException e) {
    throw new RuntimeException(e);
    }
    c.set(new Object());
    c.get();
    ConnectionPool.releaseConnection(c);
    }
    public void test2() {
    Connection c = null;
    try {
    c = ConnectionPool.getConnection();
    } catch (PoolManager.EmptyPoolException e) {
    throw new RuntimeException(e);
    }
    c.set(new Object());
    c.get();
    ConnectionPool.releaseConnection(c);
    }
    public static void main(String args[]) {
    junit.textui.TestRunner.run(ConnectionPoolDemo.class);
    }
    } ///:~
  • Object decoupling:Both Proxy and State provide a surrogate class that you use in your code; the real class that
    does the work is hidden behind this surrogate class.When you call a method in the surrogate,
    it simply turns around and calls the method in the implementing class. These two patterns are
    so similar that the Proxy is simply a special case of State.

    The basic idea is simple: from a base class, the surrogate is derived along with the class or
    classes that provide the actual implementation:
    thinking in patterns with Java.bmp
    When a surrogate object is created, it is given an implementation to which to send all of the
    method calls.
    Structurally, the difference between Proxy and State is simple: a Proxy has only one
    implementation, while State has more than one. The application of the patterns is considered
    (in Design Patterns) to be distinct: Proxy is used to control access to its implementation,
    while State allows you to change the implementation dynamically. However, if you expand
    your notion of 鈥渃ontrolling access to implementation鈥?then the two fit neatly together.
  • State: changing object behavior
    The State pattern switches from one implementation to another during the lifetime of the
    surrogate, in order to produce different behavior from the same method call(s). It鈥檚 a way to
    improve the implementation of your code when you seem to be doing a lot of testing inside
    each of your methods before deciding what to do for that method. For example, the fairy tale
    of the frog-prince contains an object (the creature) that behaves differently depending on
    what state it鈥檚 in. You could implement this using a boolean that you test:
  • Factoring commonality
    Applying the 鈥渙nce and only once鈥?principle produces the most basic
    pattern of putting code that changes into a method.
  • Strategy: choosing the algorithm at run-time
    Strategy also adds a 鈥淐ontext鈥?which can be a surrogate class that controls the selection and
    use of the particular strategy object鈥攋ust like State!
    thinking in patterns with Java.bmp
  • Policy: generalized strategy
    Although GoF says that Policy is just another name for strategy, their use of Strategy
    implicitly assumes a single method in the strategy object 鈥?that you鈥檝e broken out your
    changing algorithm as a single piece of code.
    Others[6] use Policy to mean an object that has multiple methods that may vary
    independently from class to class. This gives more flexibility than being restricted to a single
    method.
    It also seems generally useful to distinguish Strategies with single methods from Policies with
    multiple methods
  • Template method
    An important characteristic of the Template Method is that it is defined in the base class and
    cannot be changed. It's sometimes a private method but it鈥檚 virtually always final. It calls
    other base-class methods (the ones you override) in order to do its job, but it is usually called
    only as part of an initialization process (and thus the client programmer isn鈥檛 necessarily able
    to call it directly).
    E.g
    abstract class ApplicationFramework {
    public ApplicationFramework() {
    templateMethod(); // Dangerous!
    }
    abstract void customize1();
    abstract void customize2();
    final void templateMethod() {
    for(int i = 0; i < 5; i++) {
    customize1();
    customize2();
    }
    }
    }
    // Create a new "application":
    class MyApp extends ApplicationFramework {
    void customize1() {
    System.out.print("Hello ");
    }
    void customize2() {
    System.out.println("World!");
    }
    }





  • junhong 2006-04-09 17:15 鍙戣〃璇勮
    ]]>
    鏈漢鍐欑殑鍒嗛〉鐨勬爣絳撅紝鍜?net涓殑datagrid鏍囩鐩鎬技錛屽彧闇瑕佽緗嚑涓睘鎬у氨鍙互瀹炵幇鍒嗛〉鍔熻兘浜?/title><link>http://www.tkk7.com/junhong/archive/2006/03/07/33960.html</link><dc:creator>junhong</dc:creator><author>junhong</author><pubDate>Tue, 07 Mar 2006 01:04:00 GMT</pubDate><guid>http://www.tkk7.com/junhong/archive/2006/03/07/33960.html</guid><wfw:comment>http://www.tkk7.com/junhong/comments/33960.html</wfw:comment><comments>http://www.tkk7.com/junhong/archive/2006/03/07/33960.html#Feedback</comments><slash:comments>31</slash:comments><wfw:commentRss>http://www.tkk7.com/junhong/comments/commentRss/33960.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/junhong/services/trackbacks/33960.html</trackback:ping><description><![CDATA[<img height="20" src="http://www.tkk7.com/Emoticons/QQ/15.gif" width="20" border="0" />鏈漢鍐欑殑鍒嗛〉鐨勬爣絳撅紝鍜?net涓殑datagrid鏍囩鐩鎬技錛屽彧闇瑕佽緗嚑涓睘鎬у氨鍙互瀹炵幇鍒嗛〉鍔熻兘浜嗭紝綆鍗曟柟渚匡紝騫朵笖鏁堢巼寰堥珮銆?br />鎴戝啓鐨勬湁涓ょ鍒嗛〉鐨勬爣絳撅紝涓縐嶆槸鍏ㄩ儴select 鍑烘潵錛岀劧鍚庡啀鍒嗛〉鐨勶紝榪欎釜緋葷粺鍦ㄧ涓嬈¤闂殑鏃跺欏彲鑳芥湁鐐規參,浣嗘槸鍦ㄩ殢鍚庣殑璁塊棶鍙槸寰堝揩鐨勶紝鍥犱負鏁版嵁宸茬粡閮界紦瀛樹互鏉ョ殑錛屽茍涓旀槸鍦╬ageContext涓殑錛屾墍浠ヤ笉浼氬崰鐢ㄥ緢澶氱殑璧勬簮銆傜浜岀鏄儴鍒唖elect 鍑烘潵鐨勶紝鏁堢巼寰堥珮銆傚鏋滄湁闇瑕佺殑鏈嬪弸錛岃鐣欎笅Email鍦板潃銆?br />鎯寵婧愪唬鐮佺殑鏈嬪弸璇峰拰鎴戣仈緋匯?br />澶у鍙互鎶婄敤鐨勬儏鍐電粰鎴戣涓涓嬶紝浠ヤ究鎴戝仛鍑鴻皟鏁淬?br /><font color="#ff0000"><br /><b>鏈▼搴忎綔浜嗗崌綰э紝璇峰ぇ瀹朵笅杞戒笅杈圭殑榪欎釜榪炴帴榪涜涓嬭澆錛屼互渚夸嬌鐢ㄦ渶鏂扮殑鐗堟湰銆?br />榪欐鍗囩駭淇浜嗗嚑涓猙ugs.</b></font><br /><font color="#ff0000"><b><a href="/Files/junhong/splitpage.rar">璇蜂笅杞絊plitpage.rar</a></b></font><br /><img style="WIDTH: 404px; HEIGHT: 611px" height="611" alt="testsplitpage.JPG" src="http://www.tkk7.com/images/blogjava_net/junhong/testsplitpage.JPG" width="399" border="0" /><br /><img src ="http://www.tkk7.com/junhong/aggbug/33960.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/junhong/" target="_blank">junhong</a> 2006-03-07 09:04 <a href="http://www.tkk7.com/junhong/archive/2006/03/07/33960.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://haiwaizhuyun.com" target="_blank">大学生一级特黄的免费大片视频 </a>| <a href="http://323799.com" target="_blank">四虎免费影院ww4164h</a>| <a href="http://szclinic.com" target="_blank">无码少妇精品一区二区免费动态 </a>| <a href="http://626393.com" target="_blank">免费国产在线精品一区 </a>| <a href="http://352362.com" target="_blank">久久经典免费视频</a>| <a href="http://xxxxxxxxcccc.com" target="_blank">亚洲另类春色校园小说</a>| <a href="http://56aaaa.com" target="_blank">亚洲一级毛片免费看</a>| <a href="http://zhxydq.com" target="_blank">亚洲午夜精品在线</a>| <a href="http://www44414.com" target="_blank">最近的免费中文字幕视频</a>| <a href="http://yuase.com" target="_blank">亚洲免费福利在线视频</a>| <a href="http://scycho.com" target="_blank">午夜爱爱免费视频</a>| <a href="http://fsdyzs.com" target="_blank">免费无码AV一区二区</a>| <a href="http://www66913.com" target="_blank">亚洲精品国产电影</a>| <a href="http://bearsou.com" target="_blank">成全视频高清免费观看电视剧</a>| <a href="http://2266511.com" target="_blank">亚洲人成色77777</a>| <a href="http://junfurui.com" target="_blank">久久成人免费大片</a>| <a href="http://wwwpaogou123.com" target="_blank">精品亚洲国产成AV人片传媒</a>| <a href="http://avxyz.com" target="_blank">97免费人妻无码视频</a>| <a href="http://imqun.com" target="_blank">久久精品亚洲日本波多野结衣</a>| <a href="http://chuoche.com" target="_blank">亚洲精品国产精品国自产观看</a>| <a href="http://yygcui.com" target="_blank">久久最新免费视频</a>| <a href="http://7778tv.com" target="_blank">亚洲视频在线观看免费视频</a>| <a href="http://bjqhkf.com" target="_blank">成年人视频在线观看免费</a>| <a href="http://43sihu.com" target="_blank">风间由美在线亚洲一区</a>| <a href="http://51708695.com" target="_blank">亚洲色大成网站WWW久久九九</a>| <a href="http://820111com.com" target="_blank">一个人免费视频观看在线www</a>| <a href="http://cfxzp.com" target="_blank">亚洲码在线中文在线观看</a>| <a href="http://cjfuli.com" target="_blank">破了亲妺妺的处免费视频国产 </a>| <a href="http://www-44334.com" target="_blank">国产97视频人人做人人爱免费</a>| <a href="http://kdltuliao.com" target="_blank">亚洲国产精品久久久天堂</a>| <a href="http://kj555888.com" target="_blank">91免费播放人人爽人人快乐</a>| <a href="http://hbwhgd.com" target="_blank">国产精品亚洲lv粉色</a>| <a href="http://uiui6.com" target="_blank">国产亚洲福利精品一区</a>| <a href="http://96yizhi.com" target="_blank">亚洲天堂中文字幕</a>| <a href="http://gwcyy.com" target="_blank">国产精品免费观看久久</a>| <a href="http://xjywater.com" target="_blank">杨幂最新免费特级毛片</a>| <a href="http://miya77772.com" target="_blank">久久精品国产亚洲AV嫖农村妇女</a>| <a href="http://199044.com" target="_blank">国产v精品成人免费视频400条</a>| <a href="http://cih60o.com" target="_blank">深夜福利在线免费观看</a>| <a href="http://gg596gg.com" target="_blank">亚洲色图在线播放</a>| <a href="http://wwwwmmmm.com" target="_blank">mm1313亚洲精品国产</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>