7. Araxis Merge File Comparison Report

Produced by Araxis Merge on Mon Mar 6 16:03:38 2006 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

7.1 Files compared

# Location File Last Modified
1 C:\Merge Test Files\4.0.6\catalina\src\share\org\apache\catalina\connector\http10\warp WarpResponse.java Tue Oct 8 15:15:34 2002 UTC
2 Mon Mar 6 16:03:38 2006 UTC

7.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 322

7.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

7.4 Active regular expressions

No regular expressions were active.

7.5 Comparison detail

1   /* ======= ========== ========== ========== ========== ========== ========== ====== *    
2    *                                                                                  *    
3    *                  T he Apache  Software L icense,  V ersion 1.1                   *    
4    *                                                                                  *    
5    *           Copyrigh t (c) 1999 -2001 The  Apache Sof tware Foun dation.           *    
6    *                             A ll rights  reserved.                               *    
7    *                                                                                  *    
8    * ======= ========== ========== ========== ========== ========== ========== ====== *    
9    *                                                                                  *    
10    * Redistr ibution an d use in s ource and  binary for ms,  with  or without  modi- *    
11    * ficatio n, are per mitted pro vided that  the follo wing condi tions are  met:   *    
12    *                                                                                  *    
13    * 1. Redi stribution s of sourc e code  mu st retain  the above  copyright  notice *    
14    *    noti ce, this l ist of con ditions an d the foll owing disc laimer.           *    
15    *                                                                                  *    
16    * 2. Redi stribution s  in bina ry  form   must  repr oduce the   above cop yright *    
17    *    noti ce,  this  list of co nditions   and the fo llowing  d isclaimer  in the *    
18    *    docu mentation  and/or oth er materia ls provide d with the  distribut ion.   *    
19    *                                                                                  *    
20    * 3. The  end-user d ocumentati on  includ ed with th e redistri bution,  i f any, *    
21    *    must  include t he followi ng acknowl egement:                                *    
22    *                                                                                  *    
23    *       " This produ ct include s  softwar e develope d  by the  Apache  So ftware *    
24    *         Foundation  <http://w ww.apache. org/>."                                 *    
25    *                                                                                  *    
26    *    Alte rnately, t his acknow legement m ay appear  in the sof tware itse lf, if *    
27    *    and  wherever s uch third- party ackn owlegement s normally  appear.          *    
28    *                                                                                  *    
29    * 4. The  names  "Th e  Jakarta   Project" ,  "Tomcat ",  and  " Apache  So ftware *    
30    *    Foun dation"  m ust not be  used  to  endorse or  promote   products d erived *    
31    *    from  this  sof tware with out  prior   written   permissio n.  For  w ritten *    
32    *    perm ission, pl ease conta ct <apache @apache.or g>.                          *    
33    *                                                                                  *    
34    * 5. Prod ucts deriv ed from th is softwar e may not  be called  "Apache" n or may *    
35    *    "Apa che" appea r in their  names wit hout prior  written p ermission  of the *    
36    *    Apac he Softwar e Foundati on.                                                *    
37    *                                                                                  *    
38    * THIS SO FTWARE IS  PROVIDED " AS IS" AND  ANY EXPRE SSED OR IM PLIED WARR ANTIES *    
39    * INCLUDI NG, BUT NO T LIMITED  TO,  THE I MPLIED WAR RANTIES OF  MERCHANTA BILITY *    
40    * AND FIT NESS FOR   A PARTICUL AR PURPOSE   ARE DISC LAIMED.  I N NO EVENT  SHALL *    
41    * THE APA CHE  SOFTW ARE  FOUND ATION OR   ITS CONTRI BUTORS  BE  LIABLE  F OR ANY *    
42    * DIRECT,   INDIRECT ,   INCIDE NTAL,  SPE CIAL,  EXE MPLARY,  O R  CONSEQU ENTIAL *    
43    * DAMAGES  (INCLUDIN G,  BUT NO T LIMITED  TO,  PROCU REMENT OF  SUBSTITUTE  GOODS *    
44    * OR SERV ICES;  LOS S OF USE,   DATA,  OR  PROFITS;   OR BUSINE SS INTERRU PTION) *    
45    * HOWEVER  CAUSED AN D  ON ANY   THEORY  O F  LIABILI TY,  WHETH ER IN  CON TRACT, *    
46    * STRICT  LIABILITY,  OR TORT   (INCLUDING  NEGLIGENC E OR OTHER WISE) ARIS ING IN *    
47    * ANY  WA Y  OUT OF   THE  USE  OF  THIS   SOFTWARE,   EVEN  IF   ADVISED   OF THE *    
48    * POSSIBI LITY OF SU CH DAMAGE.                                                    *    
49    *                                                                                  *    
50    * ======= ========== ========== ========== ========== ========== ========== ====== *    
51    *                                                                                  *    
52    * This so ftware  co nsists of  voluntary   contribut ions made   by many i ndivi- *    
53    * duals o n behalf o f the  Apa che Softwa re Foundat ion.  For  more infor mation *    
54    * on the  Apache Sof tware Foun dation, pl ease see < http://www .apache.or g/>.   *    
55    *                                                                                  *    
56    * ======= ========== ========== ========== ========== ========== ========== ====== */    
57   package or g.apache.c atalina.co nnector.wa rp;    
58      
59   import jav a.io.IOExc eption;    
60   import jav a.io.Outpu tStream;    
61   import jav a.io.Print Writer;    
62   import jav a.net.Malf ormedURLEx ception;    
63   import jav a.net.URL;    
64   import jav a.security .AccessCon troller;    
65   import jav a.security .Privilege dAction;    
66   import jav a.text.Sim pleDateFor mat;    
67   import jav a.util.Arr ayList;    
68   import jav a.util.Dat e;    
69   import jav a.util.Has hMap;    
70   import jav a.util.Ite rator;    
71   import jav a.util.Loc ale;    
72   import jav a.util.Tim eZone;    
73   import jav ax.servlet .ServletRe sponse;    
74   import jav ax.servlet .http.Cook ie;    
75   import jav ax.servlet .http.Http ServletReq uest;    
76   import jav ax.servlet .http.Http ServletRes ponse;    
77   import jav ax.servlet .http.Http Session;    
78   //import j avax.servl et.http.Ht tpUtils;    
79   import org .apache.ca talina.Htt pResponse;    
80   import org .apache.ca talina.Glo bals;    
81   import org .apache.ca talina.Log ger;    
82   import org .apache.ca talina.con nector.Htt pResponseB ase;    
83   import org .apache.ca talina.uti l.CookieTo ols;    
84   import org .apache.ca talina.uti l.RequestU til;    
85      
86   public cla ss WarpRes ponse exte nds HttpRe sponseBase  {    
87       /** Th e local st ream */    
88       privat e Stream l ocalstream ;    
89       /** Th e packet u sed for pr ocessing h eaders */    
90       privat e WarpPack et packet;    
91       /** Th e connecti on to whic h we are a ssociated  */    
92       privat e WarpConn ection con nection;    
93      
94       /**    
95        * Cre ate a new  instance o f a <code> WarpRespon se</code>.    
96        */    
97       public  WarpRespo nse() {    
98           su per();    
99           //  A WarpRes ponse is _ always_ as sociated w ith a Stre am    
100           th is.localst ream=new S tream(this );    
101           th is.setStre am(localst ream);    
102       }    
103      
104       /**    
105        * Rec ycle this  <code>Warp Response</ code> inst ance.    
106        */    
107       public  void recy cle() {    
108           //  Recycle o ur parent    
109           su per.recycl e();    
110           //  Recycle t he stream    
111           th is.localst ream.recyc le();    
112           //  Tell the  parent tha t a stream  is alread y in use.    
113           th is.setStre am(localst ream);    
114       }    
115      
116       /**    
117        * Set  the <code >WarpPacke t</code> i nstance us ed to proc ess header s.    
118        */    
119       public  void setP acket(Warp Packet pac ket) {    
120           th is.packet= packet;    
121       }    
122      
123       /**    
124        * Ret urn the <c ode>WarpPa cket</code > instance  used to p rocess hea ders.    
125        */    
126       public  WarpPacke t getPacke t() {    
127           re turn(this. packet);    
128       }    
129      
130       /**    
131        * Ass ociate thi s <code>Wa rpResponse </code> in stance wit h a specif ic    
132        * <co de>WarpCon nection</c ode> insta nce.    
133        */    
134       public  void setC onnection( WarpConnec tion conne ction) {    
135           th is.connect ion=connec tion;    
136       }    
137      
138       /**    
139        * Ret urn the <c ode>WarpCo nnection</ code> asso ciated thi s instance  of    
140        * <co de>WarpRes ponse</cod e>.    
141        */    
142       public  WarpConne ction getC onnection( ) {    
143           re turn(this. connection );    
144       }    
145      
146       /**    
147        * Flu sh output  and finish .    
148        */    
149       public  void fini shResponse ()    
150       throws  IOExcepti on {    
151           su per.finish Response() ;    
152           th is.localst ream.finis h();    
153       }    
154      
155       /**    
156        * Sen d the HTTP  response  headers, i f this has  not alrea dy occurre d.    
157        */    
158       protec ted void s endHeaders () throws  IOExceptio n {    
159           if  (isCommit ted()) ret urn;    
160           if  ("HTTP/0. 9".equals( request.ge tRequest() .getProtoc ol())) {    
161                committe d = true;    
162                return;    
163           }    
164      
165           th is.packet. reset();    
166           th is.packet. setType(Co nstants.TY PE_RES_STA TUS);    
167           th is.packet. writeUnsig nedShort(s tatus);    
168           th is.packet. writeStrin g(message) ;    
169           th is.connect ion.send(t his.packet );    
170      
171           if  (getConte ntType() ! = null) {    
172                this.pac ket.reset( );    
173                this.pac ket.setTyp e(Constant s.TYPE_RES _HEADER);    
174                this.pac ket.writeS tring("Con tent-Type" );    
175                this.pac ket.writeS tring(getC ontentType ());    
176                this.con nection.se nd(this.pa cket);    
177           }    
178           if  (getConte ntLength()  >= 0) {    
179                this.pac ket.reset( );    
180                this.pac ket.setTyp e(Constant s.TYPE_RES _HEADER);    
181                this.pac ket.writeS tring("Con tent-Lengt h");    
182                this.pac ket.writeS tring(Inte ger.toStri ng(getCont entLength( )));    
183                this.con nection.se nd(this.pa cket);    
184           }    
185      
186           sy nchronized  (headers)  {    
187                    Iter ator names  = headers .keySet(). iterator() ;    
188                while (n ames.hasNe xt()) {    
189                    Stri ng name =  (String) n ames.next( );    
190                    Arra yList valu es = (Arra yList) hea ders.get(n ame);    
191                    Iter ator items  = values. iterator() ;    
192                    whil e (items.h asNext())  {    
193                             String  value = ( String) it ems.next() ;    
194                         this.packe t.reset();    
195                         this.packe t.setType( Constants. TYPE_RES_H EADER);    
196                         this.packe t.writeStr ing(name);    
197                         this.packe t.writeStr ing(value) ;    
198                         this.conne ction.send (this.pack et);    
199                         }    
200                }    
201           }    
202      
203           //  Add the s ession ID  cookie if  necessary    
204           Ht tpServletR equest hre q = (HttpS ervletRequ est) reque st.getRequ est();    
205           Ht tpSession  session =  hreq.getSe ssion(fals e);    
206      
207           if  ((session  != null)  && session .isNew() & & (getCont ext() != n ull)    
208                    && g etContext( ).getCooki es()) {    
209                Cookie c ookie = ne w Cookie(G lobals.SES SION_COOKI E_NAME,    
210                                             s ession.get Id());    
211                cookie.s etMaxAge(- 1);    
212                String c ontextPath  = null;    
213                    if ( context !=  null)    
214                         contextPat h = contex t.getPath( );    
215                if ((con textPath ! = null) &&  (contextP ath.length () > 0))    
216                    cook ie.setPath (contextPa th);    
217                else    
218                    cook ie.setPath ("/");    
219                if (hreq .isSecure( ))    
220                    cook ie.setSecu re(true);    
221                addCooki e(cookie);    
222           }    
223      
224           //  Send all  specified  cookies (i f any)    
225           sy nchronized  (cookies)  {    
226                Iterator  items = c ookies.ite rator();    
227                while (i tems.hasNe xt()) {    
228                    Cook ie cookie  = (Cookie)  items.nex t();    
229                    Stri ng name=Co okieTools. getCookieH eaderName( cookie);    
230                    Stri ngBuffer v alue=new S tringBuffe r();    
231                    Cook ieTools.ge tCookieHea derValue(c ookie,valu e);    
232                         this.packe t.reset();    
233                    this .packet.se tType(Cons tants.TYPE _RES_HEADE R);    
234                    this .packet.wr iteString( name);    
235                    this .packet.wr iteString( value.toSt ring());    
236                    this .connectio n.send(thi s.packet);    
237                }    
238           }    
239      
240                this.pac ket.reset( );    
241           th is.packet. setType(Co nstants.TY PE_RES_COM MIT);    
242           th is.connect ion.send(t his.packet );    
243      
244           co mmitted =  true;    
245       }    
246      
247       /**    
248        * The  <code>Out putStream< /code> tha t will han dle all re sponse bod y    
249        * tra nsmission.    
250        */    
251       protec ted class  Stream ext ends Outpu tStream {    
252           /* * The resp onse assoc iated with  this stre am instanc e. */    
253           pr ivate Warp Response r esponse=nu ll;    
254           /* * The pack et used by  this stre am instanc e. */    
255           pr ivate Warp Packet pac ket=null;    
256           /* * Wether < code>close ()</code>  was called  or not. * /    
257           pr ivate bool ean closed =false;    
258      
259           /* *    
260            *  Construct  a new ins tance of a  <code>War pResponse. Stream</co de>    
261            *  associate d with a p arent <cod e>WarpResp onse</code >.    
262            * /    
263           pr otected St ream(WarpR esponse re sponse) {    
264                super();    
265                this.res ponse=resp onse;    
266                this.pac ket=new Wa rpPacket() ;    
267           }    
268      
269           /* *    
270            *  Write one  byte of d ata to the  <code>War pPacket</c ode> neste d    
271            *  within th is <code>W arpRespons e.Stream</ code>. All  data is b uffered    
272            *  until the  <code>flu sh()</code > or <code >close()</ code> meth od is    
273            *  not calle d.    
274            * /    
275           pu blic void  write(int  b)    
276           th rows IOExc eption {    
277                if (clos ed) throw  new IOExce ption("Str eam closed ");    
278                if (pack et.size>=p acket.buff er.length)  this.flus h();    
279                packet.b uffer[pack et.size++] =(byte)b;    
280           }    
281      
282           /* *    
283            *  Flush the  current p acket to t he WARP cl ient.    
284            * /    
285           pu blic void  flush()    
286           th rows IOExc eption {    
287                if (clos ed) throw  new IOExce ption("Str eam closed ");    
288                packet.s etType(Con stants.TYP E_RES_BODY );    
289                response .getConnec tion().sen d(packet);    
290                packet.r eset();    
291           }    
292      
293           /* *    
294            *  Flush thi s <code>Wa rpResponse .Stream</c ode> and c lose it.    
295            * /    
296           pu blic void  close()    
297           th rows IOExc eption {    
298                if (clos ed) throw  new IOExce ption("Str eam closed ");    
299                flush();    
300                packet.s etType(Con stants.TYP E_RES_DONE );    
301                response .getConnec tion().sen d(packet);    
302                packet.r eset();    
303           }    
304      
305           /* *    
306            *  Flush thi s <code>Wa rpResponse .Stream</c ode> and c lose it.    
307            * /    
308           pu blic void  finish()    
309           th rows IOExc eption {    
310                if (clos ed) return ;    
311                else thi s.close();    
312           }    
313      
314           /* *    
315            *  Recycle t his <code> WarpRespon se.Stream< /code> ins tance.    
316            * /    
317           pu blic void  recycle()  {    
318                this.pac ket.reset( );    
319                this.clo sed=false;    
320           }    
321       }    
322   }