| 1 |
|
/*
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/ht
tp/HttpPro
cessor.jav
a,v
1.
3
6
.2.5
2002/04/04
17:
46:
0
8
remm
Exp
$
|
|
1 |
|
/*
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/ht
tp/HttpPro
cessor.jav
a,v
1.
4
6
2002/04/04
17:
5
0
:34
remm
Exp
$
|
|
1 |
|
/* * $Head
er: /home/
cvs/jakart
a-tomcat-4
.0/catalin
a/src/shar
e/org/apac
he/catalin
a/connecto
r/http/Htt
pProcessor
.java,v 1.
46 2002/04
/04 17:50:
34 remm Ex
p $
|
| 2 |
|
*
$Revision:
1.
3
6
.2.5
$
|
|
2 |
|
*
$Revision:
1.
4
6
$
|
|
2 |
|
* $Revisi
on: 1.46 $
|
| 3 |
|
*
$Date:
2002/04/04
17:
46:
0
8
$
|
|
3 |
|
*
$Date:
2002/04/04
17:
5
0
:34
$
|
|
3 |
|
* $Date:
2002/04/04
17:50:34
$
|
| 4 |
|
*
|
|
4 |
|
*
|
|
4 |
|
*
|
| 5 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
|
5 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
|
5 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
| 6 |
|
*
|
|
6 |
|
*
|
|
6 |
|
*
|
| 7 |
|
* The Apa
che Softwa
re License
, Version
1.1
|
|
7 |
|
* The Apa
che Softwa
re License
, Version
1.1
|
|
7 |
|
* The Apa
che Softwa
re License
, Version
1.1
|
| 8 |
|
*
|
|
8 |
|
*
|
|
8 |
|
*
|
| 9 |
|
* Copyrig
ht (c) 199
9 The Apac
he Softwar
e Foundati
on. All r
ights
|
|
9 |
|
* Copyrig
ht (c) 199
9 The Apac
he Softwar
e Foundati
on. All r
ights
|
|
9 |
|
* Copyrig
ht (c) 199
9 The Apac
he Softwar
e Foundati
on. All r
ights
|
| 10 |
|
* reserve
d.
|
|
10 |
|
* reserve
d.
|
|
10 |
|
* reserve
d.
|
| 11 |
|
*
|
|
11 |
|
*
|
|
11 |
|
*
|
| 12 |
|
* Redistr
ibution an
d use in s
ource and
binary for
ms, with o
r without
|
|
12 |
|
* Redistr
ibution an
d use in s
ource and
binary for
ms, with o
r without
|
|
12 |
|
* Redistr
ibution an
d use in s
ource and
binary for
ms, with o
r without
|
| 13 |
|
* modific
ation, are
permitted
provided
that the f
ollowing c
onditions
|
|
13 |
|
* modific
ation, are
permitted
provided
that the f
ollowing c
onditions
|
|
13 |
|
* modific
ation, are
permitted
provided
that the f
ollowing c
onditions
|
| 14 |
|
* are met
:
|
|
14 |
|
* are met
:
|
|
14 |
|
* are met
:
|
| 15 |
|
*
|
|
15 |
|
*
|
|
15 |
|
*
|
| 16 |
|
* 1. Redi
stribution
s of sourc
e code mus
t retain t
he above c
opyright
|
|
16 |
|
* 1. Redi
stribution
s of sourc
e code mus
t retain t
he above c
opyright
|
|
16 |
|
* 1. Redi
stribution
s of sourc
e code mus
t retain t
he above c
opyright
|
| 17 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer.
|
|
17 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer.
|
|
17 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer.
|
| 18 |
|
*
|
|
18 |
|
*
|
|
18 |
|
*
|
| 19 |
|
* 2. Redi
stribution
s in binar
y form mus
t reproduc
e the abov
e copyrigh
t
|
|
19 |
|
* 2. Redi
stribution
s in binar
y form mus
t reproduc
e the abov
e copyrigh
t
|
|
19 |
|
* 2. Redi
stribution
s in binar
y form mus
t reproduc
e the abov
e copyrigh
t
|
| 20 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer in
|
|
20 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer in
|
|
20 |
|
* noti
ce, this l
ist of con
ditions an
d the foll
owing disc
laimer in
|
| 21 |
|
* the
documentat
ion and/or
other mat
erials pro
vided with
the
|
|
21 |
|
* the
documentat
ion and/or
other mat
erials pro
vided with
the
|
|
21 |
|
* the
documentat
ion and/or
other mat
erials pro
vided with
the
|
| 22 |
|
* dist
ribution.
|
|
22 |
|
* dist
ribution.
|
|
22 |
|
* dist
ribution.
|
| 23 |
|
*
|
|
23 |
|
*
|
|
23 |
|
*
|
| 24 |
|
* 3. The
end-user d
ocumentati
on include
d with the
redistrib
ution, if
|
|
24 |
|
* 3. The
end-user d
ocumentati
on include
d with the
redistrib
ution, if
|
|
24 |
|
* 3. The
end-user d
ocumentati
on include
d with the
redistrib
ution, if
|
| 25 |
|
* any,
must incl
ude the fo
llowing ac
knowlegeme
nt:
|
|
25 |
|
* any,
must incl
ude the fo
llowing ac
knowlegeme
nt:
|
|
25 |
|
* any,
must incl
ude the fo
llowing ac
knowlegeme
nt:
|
| 26 |
|
* "
This produ
ct include
s software
developed
by the
|
|
26 |
|
* "
This produ
ct include
s software
developed
by the
|
|
26 |
|
* "
This produ
ct include
s software
developed
by the
|
| 27 |
|
*
Apache Sof
tware Foun
dation (ht
tp://www.a
pache.org/
)."
|
|
27 |
|
*
Apache Sof
tware Foun
dation (ht
tp://www.a
pache.org/
)."
|
|
27 |
|
*
Apache Sof
tware Foun
dation (ht
tp://www.a
pache.org/
)."
|
| 28 |
|
* Alte
rnately, t
his acknow
legement m
ay appear
in the sof
tware itse
lf,
|
|
28 |
|
* Alte
rnately, t
his acknow
legement m
ay appear
in the sof
tware itse
lf,
|
|
28 |
|
* Alte
rnately, t
his acknow
legement m
ay appear
in the sof
tware itse
lf,
|
| 29 |
|
* if a
nd whereve
r such thi
rd-party a
cknowlegem
ents norma
lly appear
.
|
|
29 |
|
* if a
nd whereve
r such thi
rd-party a
cknowlegem
ents norma
lly appear
.
|
|
29 |
|
* if a
nd whereve
r such thi
rd-party a
cknowlegem
ents norma
lly appear
.
|
| 30 |
|
*
|
|
30 |
|
*
|
|
30 |
|
*
|
| 31 |
|
* 4. The
names "The
Jakarta P
roject", "
Tomcat", a
nd "Apache
Software
|
|
31 |
|
* 4. The
names "The
Jakarta P
roject", "
Tomcat", a
nd "Apache
Software
|
|
31 |
|
* 4. The
names "The
Jakarta P
roject", "
Tomcat", a
nd "Apache
Software
|
| 32 |
|
* Foun
dation" mu
st not be
used to en
dorse or p
romote pro
ducts deri
ved
|
|
32 |
|
* Foun
dation" mu
st not be
used to en
dorse or p
romote pro
ducts deri
ved
|
|
32 |
|
* Foun
dation" mu
st not be
used to en
dorse or p
romote pro
ducts deri
ved
|
| 33 |
|
* from
this soft
ware witho
ut prior w
ritten per
mission. F
or written
|
|
33 |
|
* from
this soft
ware witho
ut prior w
ritten per
mission. F
or written
|
|
33 |
|
* from
this soft
ware witho
ut prior w
ritten per
mission. F
or written
|
| 34 |
|
* perm
ission, pl
ease conta
ct apache@
apache.org
.
|
|
34 |
|
* perm
ission, pl
ease conta
ct apache@
apache.org
.
|
|
34 |
|
* perm
ission, pl
ease conta
ct apache@
apache.org
.
|
| 35 |
|
*
|
|
35 |
|
*
|
|
35 |
|
*
|
| 36 |
|
* 5. Prod
ucts deriv
ed from th
is softwar
e may not
be called
"Apache"
|
|
36 |
|
* 5. Prod
ucts deriv
ed from th
is softwar
e may not
be called
"Apache"
|
|
36 |
|
* 5. Prod
ucts deriv
ed from th
is softwar
e may not
be called
"Apache"
|
| 37 |
|
* nor
may "Apach
e" appear
in their n
ames witho
ut prior w
ritten
|
|
37 |
|
* nor
may "Apach
e" appear
in their n
ames witho
ut prior w
ritten
|
|
37 |
|
* nor
may "Apach
e" appear
in their n
ames witho
ut prior w
ritten
|
| 38 |
|
* perm
ission of
the Apache
Group.
|
|
38 |
|
* perm
ission of
the Apache
Group.
|
|
38 |
|
* perm
ission of
the Apache
Group.
|
| 39 |
|
*
|
|
39 |
|
*
|
|
39 |
|
*
|
| 40 |
|
* THIS SO
FTWARE IS
PROVIDED `
`AS IS'' A
ND ANY EXP
RESSED OR
IMPLIED
|
|
40 |
|
* THIS SO
FTWARE IS
PROVIDED `
`AS IS'' A
ND ANY EXP
RESSED OR
IMPLIED
|
|
40 |
|
* THIS SO
FTWARE IS
PROVIDED `
`AS IS'' A
ND ANY EXP
RESSED OR
IMPLIED
|
| 41 |
|
* WARRANT
IES, INCLU
DING, BUT
NOT LIMITE
D TO, THE
IMPLIED WA
RRANTIES
|
|
41 |
|
* WARRANT
IES, INCLU
DING, BUT
NOT LIMITE
D TO, THE
IMPLIED WA
RRANTIES
|
|
41 |
|
* WARRANT
IES, INCLU
DING, BUT
NOT LIMITE
D TO, THE
IMPLIED WA
RRANTIES
|
| 42 |
|
* OF MERC
HANTABILIT
Y AND FITN
ESS FOR A
PARTICULAR
PURPOSE A
RE
|
|
42 |
|
* OF MERC
HANTABILIT
Y AND FITN
ESS FOR A
PARTICULAR
PURPOSE A
RE
|
|
42 |
|
* OF MERC
HANTABILIT
Y AND FITN
ESS FOR A
PARTICULAR
PURPOSE A
RE
|
| 43 |
|
* DISCLAI
MED. IN N
O EVENT SH
ALL THE AP
ACHE SOFTW
ARE FOUNDA
TION OR
|
|
43 |
|
* DISCLAI
MED. IN N
O EVENT SH
ALL THE AP
ACHE SOFTW
ARE FOUNDA
TION OR
|
|
43 |
|
* DISCLAI
MED. IN N
O EVENT SH
ALL THE AP
ACHE SOFTW
ARE FOUNDA
TION OR
|
| 44 |
|
* ITS CON
TRIBUTORS
BE LIABLE
FOR ANY DI
RECT, INDI
RECT, INCI
DENTAL,
|
|
44 |
|
* ITS CON
TRIBUTORS
BE LIABLE
FOR ANY DI
RECT, INDI
RECT, INCI
DENTAL,
|
|
44 |
|
* ITS CON
TRIBUTORS
BE LIABLE
FOR ANY DI
RECT, INDI
RECT, INCI
DENTAL,
|
| 45 |
|
* SPECIAL
, EXEMPLAR
Y, OR CONS
EQUENTIAL
DAMAGES (I
NCLUDING,
BUT NOT
|
|
45 |
|
* SPECIAL
, EXEMPLAR
Y, OR CONS
EQUENTIAL
DAMAGES (I
NCLUDING,
BUT NOT
|
|
45 |
|
* SPECIAL
, EXEMPLAR
Y, OR CONS
EQUENTIAL
DAMAGES (I
NCLUDING,
BUT NOT
|
| 46 |
|
* LIMITED
TO, PROCU
REMENT OF
SUBSTITUTE
GOODS OR
SERVICES;
LOSS OF
|
|
46 |
|
* LIMITED
TO, PROCU
REMENT OF
SUBSTITUTE
GOODS OR
SERVICES;
LOSS OF
|
|
46 |
|
* LIMITED
TO, PROCU
REMENT OF
SUBSTITUTE
GOODS OR
SERVICES;
LOSS OF
|
| 47 |
|
* USE, DA
TA, OR PRO
FITS; OR B
USINESS IN
TERRUPTION
) HOWEVER
CAUSED AND
|
|
47 |
|
* USE, DA
TA, OR PRO
FITS; OR B
USINESS IN
TERRUPTION
) HOWEVER
CAUSED AND
|
|
47 |
|
* USE, DA
TA, OR PRO
FITS; OR B
USINESS IN
TERRUPTION
) HOWEVER
CAUSED AND
|
| 48 |
|
* ON ANY
THEORY OF
LIABILITY,
WHETHER I
N CONTRACT
, STRICT L
IABILITY,
|
|
48 |
|
* ON ANY
THEORY OF
LIABILITY,
WHETHER I
N CONTRACT
, STRICT L
IABILITY,
|
|
48 |
|
* ON ANY
THEORY OF
LIABILITY,
WHETHER I
N CONTRACT
, STRICT L
IABILITY,
|
| 49 |
|
* OR TORT
(INCLUDIN
G NEGLIGEN
CE OR OTHE
RWISE) ARI
SING IN AN
Y WAY OUT
|
|
49 |
|
* OR TORT
(INCLUDIN
G NEGLIGEN
CE OR OTHE
RWISE) ARI
SING IN AN
Y WAY OUT
|
|
49 |
|
* OR TORT
(INCLUDIN
G NEGLIGEN
CE OR OTHE
RWISE) ARI
SING IN AN
Y WAY OUT
|
| 50 |
|
* OF THE
USE OF THI
S SOFTWARE
, EVEN IF
ADVISED OF
THE POSSI
BILITY OF
|
|
50 |
|
* OF THE
USE OF THI
S SOFTWARE
, EVEN IF
ADVISED OF
THE POSSI
BILITY OF
|
|
50 |
|
* OF THE
USE OF THI
S SOFTWARE
, EVEN IF
ADVISED OF
THE POSSI
BILITY OF
|
| 51 |
|
* SUCH DA
MAGE.
|
|
51 |
|
* SUCH DA
MAGE.
|
|
51 |
|
* SUCH DA
MAGE.
|
| 52 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
|
52 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
|
52 |
|
* =======
==========
==========
==========
==========
==========
==========
=
|
| 53 |
|
*
|
|
53 |
|
*
|
|
53 |
|
*
|
| 54 |
|
* This so
ftware con
sists of v
oluntary c
ontributio
ns made by
many
|
|
54 |
|
* This so
ftware con
sists of v
oluntary c
ontributio
ns made by
many
|
|
54 |
|
* This so
ftware con
sists of v
oluntary c
ontributio
ns made by
many
|
| 55 |
|
* individ
uals on be
half of th
e Apache S
oftware Fo
undation.
For more
|
|
55 |
|
* individ
uals on be
half of th
e Apache S
oftware Fo
undation.
For more
|
|
55 |
|
* individ
uals on be
half of th
e Apache S
oftware Fo
undation.
For more
|
| 56 |
|
* informa
tion on th
e Apache S
oftware Fo
undation,
please see
|
|
56 |
|
* informa
tion on th
e Apache S
oftware Fo
undation,
please see
|
|
56 |
|
* informa
tion on th
e Apache S
oftware Fo
undation,
please see
|
| 57 |
|
* <http:/
/www.apach
e.org/>.
|
|
57 |
|
* <http:/
/www.apach
e.org/>.
|
|
57 |
|
* <http:/
/www.apach
e.org/>.
|
| 58 |
|
*
|
|
58 |
|
*
|
|
58 |
|
*
|
| 59 |
|
* [Additi
onal notic
es, if req
uired by p
rior licen
sing condi
tions]
|
|
59 |
|
* [Additi
onal notic
es, if req
uired by p
rior licen
sing condi
tions]
|
|
59 |
|
* [Additi
onal notic
es, if req
uired by p
rior licen
sing condi
tions]
|
| 60 |
|
*
|
|
60 |
|
*
|
|
60 |
|
*
|
| 61 |
|
*/
|
|
61 |
|
*/
|
|
61 |
|
*/
|
| 62 |
|
|
|
62 |
|
|
|
62 |
|
|
| 63 |
|
|
|
63 |
|
|
|
63 |
|
|
| 64 |
|
package or
g.apache.c
atalina.co
nnector.ht
tp;
|
|
64 |
|
package or
g.apache.c
atalina.co
nnector.ht
tp;
|
|
64 |
|
package or
g.apache.c
atalina.co
nnector.ht
tp;
|
| 65 |
|
|
|
65 |
|
|
|
65 |
|
|
| 66 |
|
|
|
66 |
|
|
|
66 |
|
|
| 67 |
|
import jav
a.io.Buffe
redInputSt
ream;
|
|
67 |
|
import jav
a.io.Buffe
redInputSt
ream;
|
|
67 |
|
import jav
a.io.Buffe
redInputSt
ream;
|
| 68 |
|
import jav
a.io.EOFEx
ception;
|
|
68 |
|
import jav
a.io.EOFEx
ception;
|
|
68 |
|
import jav
a.io.EOFEx
ception;
|
| 69 |
|
import jav
a.io.Inter
ruptedIOEx
ception;
|
|
69 |
|
import jav
a.io.Inter
ruptedIOEx
ception;
|
|
69 |
|
import jav
a.io.Inter
ruptedIOEx
ception;
|
| 70 |
|
import jav
a.io.Input
Stream;
|
|
70 |
|
import jav
a.io.Input
Stream;
|
|
70 |
|
import jav
a.io.Input
Stream;
|
| 71 |
|
import jav
a.io.IOExc
eption;
|
|
71 |
|
import jav
a.io.IOExc
eption;
|
|
71 |
|
import jav
a.io.IOExc
eption;
|
| 72 |
|
import jav
a.io.Outpu
tStream;
|
|
72 |
|
import jav
a.io.Outpu
tStream;
|
|
72 |
|
import jav
a.io.Outpu
tStream;
|
| 73 |
|
import jav
a.net.Inet
Address;
|
|
73 |
|
import jav
a.net.Inet
Address;
|
|
73 |
|
import jav
a.net.Inet
Address;
|
| 74 |
|
import jav
a.net.Sock
et;
|
|
74 |
|
import jav
a.net.Sock
et;
|
|
74 |
|
import jav
a.net.Sock
et;
|
| 75 |
|
import jav
a.util.Arr
ayList;
|
|
75 |
|
import jav
a.util.Arr
ayList;
|
|
75 |
|
import jav
a.util.Arr
ayList;
|
| 76 |
|
import jav
a.util.Ite
rator;
|
|
76 |
|
import jav
a.util.Ite
rator;
|
|
76 |
|
import jav
a.util.Ite
rator;
|
| 77 |
|
import jav
a.util.Loc
ale;
|
|
77 |
|
import jav
a.util.Loc
ale;
|
|
77 |
|
import jav
a.util.Loc
ale;
|
| 78 |
|
import jav
a.util.Str
ingTokeniz
er;
|
|
78 |
|
import jav
a.util.Str
ingTokeniz
er;
|
|
78 |
|
import jav
a.util.Str
ingTokeniz
er;
|
| 79 |
|
import jav
a.util.Tre
eMap;
|
|
79 |
|
import jav
a.util.Tre
eMap;
|
|
79 |
|
import jav
a.util.Tre
eMap;
|
| 80 |
|
import jav
ax.servlet
.ServletEx
ception;
|
|
80 |
|
import jav
ax.servlet
.ServletEx
ception;
|
|
80 |
|
import jav
ax.servlet
.ServletEx
ception;
|
| 81 |
|
import jav
ax.servlet
.http.Cook
ie;
|
|
81 |
|
import jav
ax.servlet
.http.Cook
ie;
|
|
81 |
|
import jav
ax.servlet
.http.Cook
ie;
|
| 82 |
|
import jav
ax.servlet
.http.Http
ServletReq
uest;
|
|
82 |
|
import jav
ax.servlet
.http.Http
ServletReq
uest;
|
|
82 |
|
import jav
ax.servlet
.http.Http
ServletReq
uest;
|
| 83 |
|
import jav
ax.servlet
.http.Http
ServletRes
ponse;
|
|
83 |
|
import jav
ax.servlet
.http.Http
ServletRes
ponse;
|
|
83 |
|
import jav
ax.servlet
.http.Http
ServletRes
ponse;
|
| 84 |
|
import org
.apache.ca
talina.Con
nector;
|
|
84 |
|
import org
.apache.ca
talina.Con
nector;
|
|
84 |
|
import org
.apache.ca
talina.Con
nector;
|
| 85 |
|
import org
.apache.ca
talina.Con
tainer;
|
|
85 |
|
import org
.apache.ca
talina.Con
tainer;
|
|
85 |
|
import org
.apache.ca
talina.Con
tainer;
|
| 86 |
|
import org
.apache.ca
talina.Glo
bals;
|
|
86 |
|
import org
.apache.ca
talina.Glo
bals;
|
|
86 |
|
import org
.apache.ca
talina.Glo
bals;
|
| 87 |
|
import org
.apache.ca
talina.Htt
pRequest;
|
|
87 |
|
import org
.apache.ca
talina.Htt
pRequest;
|
|
87 |
|
import org
.apache.ca
talina.Htt
pRequest;
|
| 88 |
|
import org
.apache.ca
talina.Htt
pResponse;
|
|
88 |
|
import org
.apache.ca
talina.Htt
pResponse;
|
|
88 |
|
import org
.apache.ca
talina.Htt
pResponse;
|
| 89 |
|
import org
.apache.ca
talina.Lif
ecycle;
|
|
89 |
|
import org
.apache.ca
talina.Lif
ecycle;
|
|
89 |
|
import org
.apache.ca
talina.Lif
ecycle;
|
| 90 |
|
import org
.apache.ca
talina.Lif
ecycleEven
t;
|
|
90 |
|
import org
.apache.ca
talina.Lif
ecycleEven
t;
|
|
90 |
|
import org
.apache.ca
talina.Lif
ecycleEven
t;
|
| 91 |
|
import org
.apache.ca
talina.Lif
ecycleExce
ption;
|
|
91 |
|
import org
.apache.ca
talina.Lif
ecycleExce
ption;
|
|
91 |
|
import org
.apache.ca
talina.Lif
ecycleExce
ption;
|
| 92 |
|
import org
.apache.ca
talina.Lif
ecycleList
ener;
|
|
92 |
|
import org
.apache.ca
talina.Lif
ecycleList
ener;
|
|
92 |
|
import org
.apache.ca
talina.Lif
ecycleList
ener;
|
| 93 |
|
import org
.apache.ca
talina.Log
ger;
|
|
93 |
|
import org
.apache.ca
talina.Log
ger;
|
|
93 |
|
import org
.apache.ca
talina.Log
ger;
|
| 94 |
|
import
org.apache
.catalina.
util.
Reque
st
U
t
il
;
|
|
94 |
|
import
org.apache
.catalina.
util.
Fa
st
HttpDateFo
rma
t
;
|
|
94 |
|
import org
.apache.ca
talina.uti
l.FastHttp
DateFormat
;
|
| 95 |
|
import org
.apache.ca
talina.uti
l.Lifecycl
eSupport;
|
|
95 |
|
import org
.apache.ca
talina.uti
l.Lifecycl
eSupport;
|
|
95 |
|
import org
.apache.ca
talina.uti
l.Lifecycl
eSupport;
|
| |
|
96 |
|
import org
.apache.ca
talina.uti
l.RequestU
til;
|
|
96 |
|
import org
.apache.ca
talina.uti
l.RequestU
til;
|
| |
|
97 |
|
import org
.apache.ca
talina.uti
l.ServerIn
fo;
|
|
97 |
|
import org
.apache.ca
talina.uti
l.ServerIn
fo;
|
| 96 |
|
import org
.apache.ca
talina.uti
l.StringMa
nager;
|
|
98 |
|
import org
.apache.ca
talina.uti
l.StringMa
nager;
|
|
98 |
|
import org
.apache.ca
talina.uti
l.StringMa
nager;
|
| 97 |
|
import org
.apache.ca
talina.uti
l.StringPa
rser;
|
|
99 |
|
import org
.apache.ca
talina.uti
l.StringPa
rser;
|
|
99 |
|
import org
.apache.ca
talina.uti
l.StringPa
rser;
|
| 98 |
|
|
|
100 |
|
|
|
100 |
|
|
| 99 |
|
|
|
101 |
|
|
|
101 |
|
|
| 100 |
|
/**
|
|
102 |
|
/**
|
|
102 |
|
/**
|
| 101 |
|
* Impleme
ntation of
a request
processor
(and its
associated
thread) t
hat may
|
|
103 |
|
* Impleme
ntation of
a request
processor
(and its
associated
thread) t
hat may
|
|
103 |
|
* Impleme
ntation of
a request
processor
(and its
associated
thread) t
hat may
|
| 102 |
|
* be used
by an Htt
pConnector
to proces
s individu
al request
s. The co
nnector
|
|
104 |
|
* be used
by an Htt
pConnector
to proces
s individu
al request
s. The co
nnector
|
|
104 |
|
* be used
by an Htt
pConnector
to proces
s individu
al request
s. The co
nnector
|
| 103 |
|
* will al
locate a p
rocessor f
rom its po
ol, assign
a particu
lar socket
to it,
|
|
105 |
|
* will al
locate a p
rocessor f
rom its po
ol, assign
a particu
lar socket
to it,
|
|
105 |
|
* will al
locate a p
rocessor f
rom its po
ol, assign
a particu
lar socket
to it,
|
| 104 |
|
* and the
processor
will then
execute t
he process
ing requir
ed to comp
lete
|
|
106 |
|
* and the
processor
will then
execute t
he process
ing requir
ed to comp
lete
|
|
106 |
|
* and the
processor
will then
execute t
he process
ing requir
ed to comp
lete
|
| 105 |
|
* the req
uest. Whe
n the proc
essor is c
ompleted,
it will re
cycle itse
lf.
|
|
107 |
|
* the req
uest. Whe
n the proc
essor is c
ompleted,
it will re
cycle itse
lf.
|
|
107 |
|
* the req
uest. Whe
n the proc
essor is c
ompleted,
it will re
cycle itse
lf.
|
| 106 |
|
*
|
|
108 |
|
*
|
|
108 |
|
*
|
| 107 |
|
* @author
Craig R.
McClanahan
|
|
109 |
|
* @author
Craig R.
McClanahan
|
|
109 |
|
* @author
Craig R.
McClanahan
|
| 108 |
|
* @author
Remy Mauc
herat
|
|
110 |
|
* @author
Remy Mauc
herat
|
|
110 |
|
* @author
Remy Mauc
herat
|
| 109 |
|
*
@version
$Revision:
1.
3
6
.2.5
$
$Date:
2002/04/04
17:
46:
0
8
$
|
|
111 |
|
*
@version
$Revision:
1.
4
6
$
$Date:
2002/04/04
17:
5
0
:34
$
|
|
111 |
|
* @versio
n $Revisio
n: 1.46 $
$Date: 200
2/04/04 17
:50:34 $
|
| |
|
112 |
|
* @deprec
ated
|
|
112 |
|
* @deprec
ated
|
| 110 |
|
*/
|
|
113 |
|
*/
|
|
113 |
|
*/
|
| 111 |
|
|
|
114 |
|
|
|
114 |
|
|
| 112 |
|
final clas
s HttpProc
essor
|
|
115 |
|
final clas
s HttpProc
essor
|
|
115 |
|
final clas
s HttpProc
essor
|
| 113 |
|
implem
ents Lifec
ycle, Runn
able {
|
|
116 |
|
implem
ents Lifec
ycle, Runn
able {
|
|
116 |
|
implem
ents Lifec
ycle, Runn
able {
|
| 114 |
|
|
|
117 |
|
|
|
117 |
|
|
| 115 |
|
|
|
118 |
|
|
|
118 |
|
|
| |
|
119 |
|
// ---
----------
----------
----------
----------
----------
Manifest
Constants
|
|
119 |
|
// ---
----------
----------
----------
----------
----------
Manifest
Constants
|
| |
|
120 |
|
|
|
120 |
|
|
| |
|
121 |
|
|
|
121 |
|
|
| |
|
122 |
|
/**
|
|
122 |
|
/**
|
| |
|
123 |
|
* Ser
ver inform
ation stri
ng for thi
s server.
|
|
123 |
|
* Ser
ver inform
ation stri
ng for thi
s server.
|
| |
|
124 |
|
*/
|
|
124 |
|
*/
|
| |
|
125 |
|
privat
e static f
inal Strin
g SERVER_I
NFO =
|
|
125 |
|
privat
e static f
inal Strin
g SERVER_I
NFO =
|
| |
|
126 |
|
Se
rverInfo.g
etServerIn
fo() + " (
HTTP/1.1 C
onnector)"
;
|
|
126 |
|
Se
rverInfo.g
etServerIn
fo() + " (
HTTP/1.1 C
onnector)"
;
|
| |
|
127 |
|
|
|
127 |
|
|
| |
|
128 |
|
|
|
128 |
|
|
| 116 |
|
// ---
----------
----------
----------
----------
----------
------ Con
structors
|
|
129 |
|
// ---
----------
----------
----------
----------
----------
------ Con
structors
|
|
129 |
|
// ---
----------
----------
----------
----------
----------
------ Con
structors
|
| 117 |
|
|
|
130 |
|
|
|
130 |
|
|
| 118 |
|
|
|
131 |
|
|
|
131 |
|
|
| 119 |
|
/**
|
|
132 |
|
/**
|
|
132 |
|
/**
|
| 120 |
|
* Con
struct a n
ew HttpPro
cessor ass
ociated wi
th the spe
cified con
nector.
|
|
133 |
|
* Con
struct a n
ew HttpPro
cessor ass
ociated wi
th the spe
cified con
nector.
|
|
133 |
|
* Con
struct a n
ew HttpPro
cessor ass
ociated wi
th the spe
cified con
nector.
|
| 121 |
|
*
|
|
134 |
|
*
|
|
134 |
|
*
|
| 122 |
|
* @pa
ram connec
tor HttpCo
nnector th
at owns th
is process
or
|
|
135 |
|
* @pa
ram connec
tor HttpCo
nnector th
at owns th
is process
or
|
|
135 |
|
* @pa
ram connec
tor HttpCo
nnector th
at owns th
is process
or
|
| 123 |
|
* @pa
ram id Ide
ntifier of
this Http
Processor
(unique pe
r connecto
r)
|
|
136 |
|
* @pa
ram id Ide
ntifier of
this Http
Processor
(unique pe
r connecto
r)
|
|
136 |
|
* @pa
ram id Ide
ntifier of
this Http
Processor
(unique pe
r connecto
r)
|
| 124 |
|
*/
|
|
137 |
|
*/
|
|
137 |
|
*/
|
| 125 |
|
public
HttpProce
ssor(HttpC
onnector c
onnector,
int id) {
|
|
138 |
|
public
HttpProce
ssor(HttpC
onnector c
onnector,
int id) {
|
|
138 |
|
public
HttpProce
ssor(HttpC
onnector c
onnector,
int id) {
|
| 126 |
|
|
|
139 |
|
|
|
139 |
|
|
| 127 |
|
su
per();
|
|
140 |
|
su
per();
|
|
140 |
|
su
per();
|
| 128 |
|
th
is.connect
or = conne
ctor;
|
|
141 |
|
th
is.connect
or = conne
ctor;
|
|
141 |
|
th
is.connect
or = conne
ctor;
|
| 129 |
|
th
is.debug =
connector
.getDebug(
);
|
|
142 |
|
th
is.debug =
connector
.getDebug(
);
|
|
142 |
|
th
is.debug =
connector
.getDebug(
);
|
| 130 |
|
th
is.id = id
;
|
|
143 |
|
th
is.id = id
;
|
|
143 |
|
th
is.id = id
;
|
| 131 |
|
th
is.proxyNa
me = conne
ctor.getPr
oxyName();
|
|
144 |
|
th
is.proxyNa
me = conne
ctor.getPr
oxyName();
|
|
144 |
|
th
is.proxyNa
me = conne
ctor.getPr
oxyName();
|
| 132 |
|
th
is.proxyPo
rt = conne
ctor.getPr
oxyPort();
|
|
145 |
|
th
is.proxyPo
rt = conne
ctor.getPr
oxyPort();
|
|
145 |
|
th
is.proxyPo
rt = conne
ctor.getPr
oxyPort();
|
| 133 |
|
th
is.request
= (HttpRe
questImpl)
connector
.createReq
uest();
|
|
146 |
|
th
is.request
= (HttpRe
questImpl)
connector
.createReq
uest();
|
|
146 |
|
th
is.request
= (HttpRe
questImpl)
connector
.createReq
uest();
|
| 134 |
|
th
is.respons
e = (HttpR
esponseImp
l) connect
or.createR
esponse();
|
|
147 |
|
th
is.respons
e = (HttpR
esponseImp
l) connect
or.createR
esponse();
|
|
147 |
|
th
is.respons
e = (HttpR
esponseImp
l) connect
or.createR
esponse();
|
| 135 |
|
th
is.serverP
ort = conn
ector.getP
ort();
|
|
148 |
|
th
is.serverP
ort = conn
ector.getP
ort();
|
|
148 |
|
th
is.serverP
ort = conn
ector.getP
ort();
|
| 136 |
|
th
is.threadN
ame =
|
|
149 |
|
th
is.threadN
ame =
|
|
149 |
|
th
is.threadN
ame =
|
| 137 |
|
"HttpProce
ssor[" + c
onnector.g
etPort() +
"][" + id
+ "]";
|
|
150 |
|
"HttpProce
ssor[" + c
onnector.g
etPort() +
"][" + id
+ "]";
|
|
150 |
|
"HttpProce
ssor[" + c
onnector.g
etPort() +
"][" + id
+ "]";
|
| 138 |
|
|
|
151 |
|
|
|
151 |
|
|
| 139 |
|
}
|
|
152 |
|
}
|
|
152 |
|
}
|
| 140 |
|
|
|
153 |
|
|
|
153 |
|
|
| 141 |
|
|
|
154 |
|
|
|
154 |
|
|
| 142 |
|
// ---
----------
----------
----------
----------
----------
Instance
Variables
|
|
155 |
|
// ---
----------
----------
----------
----------
----------
Instance
Variables
|
|
155 |
|
// ---
----------
----------
----------
----------
----------
Instance
Variables
|
| 143 |
|
|
|
156 |
|
|
|
156 |
|
|
| 144 |
|
|
|
157 |
|
|
|
157 |
|
|
| 145 |
|
/**
|
|
158 |
|
/**
|
|
158 |
|
/**
|
| 146 |
|
* Is
there a ne
w socket a
vailable?
|
|
159 |
|
* Is
there a ne
w socket a
vailable?
|
|
159 |
|
* Is
there a ne
w socket a
vailable?
|
| 147 |
|
*/
|
|
160 |
|
*/
|
|
160 |
|
*/
|
| 148 |
|
privat
e boolean
available
= false;
|
|
161 |
|
privat
e boolean
available
= false;
|
|
161 |
|
privat
e boolean
available
= false;
|
| 149 |
|
|
|
162 |
|
|
|
162 |
|
|
| 150 |
|
|
|
163 |
|
|
|
163 |
|
|
| 151 |
|
/**
|
|
164 |
|
/**
|
|
164 |
|
/**
|
| 152 |
|
* The
HttpConne
ctor with
which this
processor
is associ
ated.
|
|
165 |
|
* The
HttpConne
ctor with
which this
processor
is associ
ated.
|
|
165 |
|
* The
HttpConne
ctor with
which this
processor
is associ
ated.
|
| 153 |
|
*/
|
|
166 |
|
*/
|
|
166 |
|
*/
|
| 154 |
|
privat
e HttpConn
ector conn
ector = nu
ll;
|
|
167 |
|
privat
e HttpConn
ector conn
ector = nu
ll;
|
|
167 |
|
privat
e HttpConn
ector conn
ector = nu
ll;
|
| 155 |
|
|
|
168 |
|
|
|
168 |
|
|
| 156 |
|
|
|
169 |
|
|
|
169 |
|
|
| 157 |
|
/**
|
|
170 |
|
/**
|
|
170 |
|
/**
|
| 158 |
|
* The
debugging
detail le
vel for th
is compone
nt.
|
|
171 |
|
* The
debugging
detail le
vel for th
is compone
nt.
|
|
171 |
|
* The
debugging
detail le
vel for th
is compone
nt.
|
| 159 |
|
*/
|
|
172 |
|
*/
|
|
172 |
|
*/
|
| 160 |
|
privat
e int debu
g = 0;
|
|
173 |
|
privat
e int debu
g = 0;
|
|
173 |
|
privat
e int debu
g = 0;
|
| 161 |
|
|
|
174 |
|
|
|
174 |
|
|
| 162 |
|
|
|
175 |
|
|
|
175 |
|
|
| 163 |
|
/**
|
|
176 |
|
/**
|
|
176 |
|
/**
|
| (752 unchanged lines omitted) |
| 916 |
|
* Sen
d a confir
mation tha
t a reques
t has been
processed
when pipe
lining.
|
|
929 |
|
* Sen
d a confir
mation tha
t a reques
t has been
processed
when pipe
lining.
|
|
929 |
|
* Sen
d a confir
mation tha
t a reques
t has been
processed
when pipe
lining.
|
| 917 |
|
* HTT
P/1.1 100
Continue i
s sent bac
k to the c
lient.
|
|
930 |
|
* HTT
P/1.1 100
Continue i
s sent bac
k to the c
lient.
|
|
930 |
|
* HTT
P/1.1 100
Continue i
s sent bac
k to the c
lient.
|
| 918 |
|
*
|
|
931 |
|
*
|
|
931 |
|
*
|
| 919 |
|
* @pa
ram output
Socket ou
tput strea
m
|
|
932 |
|
* @pa
ram output
Socket ou
tput strea
m
|
|
932 |
|
* @pa
ram output
Socket ou
tput strea
m
|
| 920 |
|
*/
|
|
933 |
|
*/
|
|
933 |
|
*/
|
| 921 |
|
privat
e void ack
Request(Ou
tputStream
output)
|
|
934 |
|
privat
e void ack
Request(Ou
tputStream
output)
|
|
934 |
|
privat
e void ack
Request(Ou
tputStream
output)
|
| 922 |
|
th
rows IOExc
eption {
|
|
935 |
|
th
rows IOExc
eption {
|
|
935 |
|
th
rows IOExc
eption {
|
| 923 |
|
if
(sendAck)
|
|
936 |
|
if
(sendAck)
|
|
936 |
|
if
(sendAck)
|
| 924 |
|
output.w
rite(ack);
|
|
937 |
|
output.w
rite(ack);
|
|
937 |
|
output.w
rite(ack);
|
| 925 |
|
}
|
|
938 |
|
}
|
|
938 |
|
}
|
| 926 |
|
|
|
939 |
|
|
|
939 |
|
|
| 927 |
|
|
|
940 |
|
|
|
940 |
|
|
| 928 |
|
/**
|
|
941 |
|
/**
|
|
941 |
|
/**
|
| 929 |
|
* Pro
cess an in
coming HTT
P request
on the Soc
ket that h
as been as
signed
|
|
942 |
|
* Pro
cess an in
coming HTT
P request
on the Soc
ket that h
as been as
signed
|
|
942 |
|
* Pro
cess an in
coming HTT
P request
on the Soc
ket that h
as been as
signed
|
| 930 |
|
* to
this Proce
ssor. Any
exception
s that occ
ur during
processing
must be
|
|
943 |
|
* to
this Proce
ssor. Any
exception
s that occ
ur during
processing
must be
|
|
943 |
|
* to
this Proce
ssor. Any
exception
s that occ
ur during
processing
must be
|
| 931 |
|
* swa
llowed and
dealt wit
h.
|
|
944 |
|
* swa
llowed and
dealt wit
h.
|
|
944 |
|
* swa
llowed and
dealt wit
h.
|
| 932 |
|
*
|
|
945 |
|
*
|
|
945 |
|
*
|
| 933 |
|
* @pa
ram socket
The socke
t on which
we are co
nnected to
the clien
t
|
|
946 |
|
* @pa
ram socket
The socke
t on which
we are co
nnected to
the clien
t
|
|
946 |
|
* @pa
ram socket
The socke
t on which
we are co
nnected to
the clien
t
|
| 934 |
|
*/
|
|
947 |
|
*/
|
|
947 |
|
*/
|
| 935 |
|
privat
e void pro
cess(Socke
t socket)
{
|
|
948 |
|
privat
e void pro
cess(Socke
t socket)
{
|
|
948 |
|
privat
e void pro
cess(Socke
t socket)
{
|
| 936 |
|
|
|
949 |
|
|
|
949 |
|
|
| 937 |
|
bo
olean ok =
true;
|
|
950 |
|
bo
olean ok =
true;
|
|
950 |
|
bo
olean ok =
true;
|
| 938 |
|
bo
olean fini
shResponse
= true;
|
|
951 |
|
bo
olean fini
shResponse
= true;
|
|
951 |
|
bo
olean fini
shResponse
= true;
|
| 939 |
|
So
cketInputS
tream inpu
t = null;
|
|
952 |
|
So
cketInputS
tream inpu
t = null;
|
|
952 |
|
So
cketInputS
tream inpu
t = null;
|
| 940 |
|
Ou
tputStream
output =
null;
|
|
953 |
|
Ou
tputStream
output =
null;
|
|
953 |
|
Ou
tputStream
output =
null;
|
| 941 |
|
|
|
954 |
|
|
|
954 |
|
|
| 942 |
|
//
Construct
and initi
alize the
objects we
will need
|
|
955 |
|
//
Construct
and initi
alize the
objects we
will need
|
|
955 |
|
//
Construct
and initi
alize the
objects we
will need
|
| 943 |
|
tr
y {
|
|
956 |
|
tr
y {
|
|
956 |
|
tr
y {
|
| 944 |
|
input =
new Socket
InputStrea
m(socket.g
etInputStr
eam(),
|
|
957 |
|
input =
new Socket
InputStrea
m(socket.g
etInputStr
eam(),
|
|
957 |
|
input =
new Socket
InputStrea
m(socket.g
etInputStr
eam(),
|
| 945 |
|
connecto
r.getBuffe
rSize());
|
|
958 |
|
connecto
r.getBuffe
rSize());
|
|
958 |
|
connecto
r.getBuffe
rSize());
|
| 946 |
|
}
catch (Exc
eption e)
{
|
|
959 |
|
}
catch (Exc
eption e)
{
|
|
959 |
|
}
catch (Exc
eption e)
{
|
| 947 |
|
log("pro
cess.creat
e", e);
|
|
960 |
|
log("pro
cess.creat
e", e);
|
|
960 |
|
log("pro
cess.creat
e", e);
|
| 948 |
|
ok = fal
se;
|
|
961 |
|
ok = fal
se;
|
|
961 |
|
ok = fal
se;
|
| 949 |
|
}
|
|
962 |
|
}
|
|
962 |
|
}
|
| 950 |
|
|
|
963 |
|
|
|
963 |
|
|
| 951 |
|
ke
epAlive =
true;
|
|
964 |
|
ke
epAlive =
true;
|
|
964 |
|
ke
epAlive =
true;
|
| 952 |
|
|
|
965 |
|
|
|
965 |
|
|
| 953 |
|
wh
ile (!stop
ped && ok
&& keepAli
ve) {
|
|
966 |
|
wh
ile (!stop
ped && ok
&& keepAli
ve) {
|
|
966 |
|
wh
ile (!stop
ped && ok
&& keepAli
ve) {
|
| 954 |
|
|
|
967 |
|
|
|
967 |
|
|
| 955 |
|
finishRe
sponse = t
rue;
|
|
968 |
|
finishRe
sponse = t
rue;
|
|
968 |
|
finishRe
sponse = t
rue;
|
| 956 |
|
|
|
969 |
|
|
|
969 |
|
|
| 957 |
|
try {
|
|
970 |
|
try {
|
|
970 |
|
try {
|
| 958 |
|
requ
est.setStr
eam(input)
;
|
|
971 |
|
requ
est.setStr
eam(input)
;
|
|
971 |
|
requ
est.setStr
eam(input)
;
|
| 959 |
|
requ
est.setRes
ponse(resp
onse);
|
|
972 |
|
requ
est.setRes
ponse(resp
onse);
|
|
972 |
|
requ
est.setRes
ponse(resp
onse);
|
| 960 |
|
outp
ut = socke
t.getOutpu
tStream();
|
|
973 |
|
outp
ut = socke
t.getOutpu
tStream();
|
|
973 |
|
outp
ut = socke
t.getOutpu
tStream();
|
| 961 |
|
resp
onse.setSt
ream(outpu
t);
|
|
974 |
|
resp
onse.setSt
ream(outpu
t);
|
|
974 |
|
resp
onse.setSt
ream(outpu
t);
|
| 962 |
|
resp
onse.setRe
quest(requ
est);
|
|
975 |
|
resp
onse.setRe
quest(requ
est);
|
|
975 |
|
resp
onse.setRe
quest(requ
est);
|
| 963 |
|
((Ht
tpServletR
esponse) r
esponse.ge
tResponse(
)).setHead
er
|
|
976 |
|
((Ht
tpServletR
esponse) r
esponse.ge
tResponse(
)).setHead
er
|
|
976 |
|
((Ht
tpServletR
esponse) r
esponse.ge
tResponse(
)).setHead
er
|
| 964 |
|
("Server",
Constants.
S
erver
I
nfo
);
|
|
977 |
|
("Server",
S
ERVER_
I
NFO
);
|
|
977 |
|
("Server",
SERVER_IN
FO);
|
| 965 |
|
} catch
(Exception
e) {
|
|
978 |
|
} catch
(Exception
e) {
|
|
978 |
|
} catch
(Exception
e) {
|
| 966 |
|
log(
"process.c
reate", e)
;
|
|
979 |
|
log(
"process.c
reate", e)
;
|
|
979 |
|
log(
"process.c
reate", e)
;
|
| 967 |
|
ok =
false;
|
|
980 |
|
ok =
false;
|
|
980 |
|
ok =
false;
|
| 968 |
|
}
|
|
981 |
|
}
|
|
981 |
|
}
|
| 969 |
|
|
|
982 |
|
|
|
982 |
|
|
| 970 |
|
// Parse
the incom
ing reques
t
|
|
983 |
|
// Parse
the incom
ing reques
t
|
|
983 |
|
// Parse
the incom
ing reques
t
|
| 971 |
|
try {
|
|
984 |
|
try {
|
|
984 |
|
try {
|
| 972 |
|
if (
ok) {
|
|
985 |
|
if (
ok) {
|
|
985 |
|
if (
ok) {
|
| 973 |
|
parseConne
ction(sock
et);
|
|
986 |
|
parseConne
ction(sock
et);
|
|
986 |
|
parseConne
ction(sock
et);
|
| 974 |
|
parseReque
st(input,
output);
|
|
987 |
|
parseReque
st(input,
output);
|
|
987 |
|
parseReque
st(input,
output);
|
| 975 |
|
if (!reque
st.getRequ
est().getP
rotocol()
|
|
988 |
|
if (!reque
st.getRequ
est().getP
rotocol()
|
|
988 |
|
if (!reque
st.getRequ
est().getP
rotocol()
|
| 976 |
|
.start
sWith("HTT
P/0"))
|
|
989 |
|
.start
sWith("HTT
P/0"))
|
|
989 |
|
.start
sWith("HTT
P/0"))
|
| 977 |
|
parseH
eaders(inp
ut);
|
|
990 |
|
parseH
eaders(inp
ut);
|
|
990 |
|
parseH
eaders(inp
ut);
|
| 978 |
|
if (http11
) {
|
|
991 |
|
if (http11
) {
|
|
991 |
|
if (http11
) {
|
| 979 |
|
// Sen
ding a req
uest ackno
wledge bac
k to the c
lient if
|
|
992 |
|
// Sen
ding a req
uest ackno
wledge bac
k to the c
lient if
|
|
992 |
|
// Sen
ding a req
uest ackno
wledge bac
k to the c
lient if
|
| 980 |
|
// req
uested.
|
|
993 |
|
// req
uested.
|
|
993 |
|
// req
uested.
|
| 981 |
|
ackReq
uest(outpu
t);
|
|
994 |
|
ackReq
uest(outpu
t);
|
|
994 |
|
ackReq
uest(outpu
t);
|
| 982 |
|
// If
the protoc
ol is HTTP
/1.1, chun
king is al
lowed.
|
|
995 |
|
// If
the protoc
ol is HTTP
/1.1, chun
king is al
lowed.
|
|
995 |
|
// If
the protoc
ol is HTTP
/1.1, chun
king is al
lowed.
|
| 983 |
|
if (co
nnector.is
ChunkingAl
lowed())
|
|
996 |
|
if (co
nnector.is
ChunkingAl
lowed())
|
|
996 |
|
if (co
nnector.is
ChunkingAl
lowed())
|
| 984 |
|
re
sponse.set
AllowChunk
ing(true);
|
|
997 |
|
re
sponse.set
AllowChunk
ing(true);
|
|
997 |
|
re
sponse.set
AllowChunk
ing(true);
|
| 985 |
|
}
|
|
998 |
|
}
|
|
998 |
|
}
|
| 986 |
|
}
|
|
999 |
|
}
|
|
999 |
|
}
|
| 987 |
|
} catch
(EOFExcept
ion e) {
|
|
1000 |
|
} catch
(EOFExcept
ion e) {
|
|
1000 |
|
} catch
(EOFExcept
ion e) {
|
| 988 |
|
// I
t's very l
ikely to b
e a socket
disconnec
t on eithe
r the
|
|
1001 |
|
// I
t's very l
ikely to b
e a socket
disconnec
t on eithe
r the
|
|
1001 |
|
// I
t's very l
ikely to b
e a socket
disconnec
t on eithe
r the
|
| 989 |
|
// c
lient or t
he server
|
|
1002 |
|
// c
lient or t
he server
|
|
1002 |
|
// c
lient or t
he server
|
| 990 |
|
ok =
false;
|
|
1003 |
|
ok =
false;
|
|
1003 |
|
ok =
false;
|
| 991 |
|
fini
shResponse
= false;
|
|
1004 |
|
fini
shResponse
= false;
|
|
1004 |
|
fini
shResponse
= false;
|
| 992 |
|
} catch
(ServletEx
ception e)
{
|
|
1005 |
|
} catch
(ServletEx
ception e)
{
|
|
1005 |
|
} catch
(ServletEx
ception e)
{
|
| 993 |
|
ok =
false;
|
|
1006 |
|
ok =
false;
|
|
1006 |
|
ok =
false;
|
| 994 |
|
try
{
|
|
1007 |
|
try
{
|
|
1007 |
|
try
{
|
| 995 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse())
|
|
1008 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse())
|
|
1008 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse())
|
| 996 |
|
.sendE
rror(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
|
1009 |
|
.sendE
rror(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
|
1009 |
|
.sendE
rror(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
| 997 |
|
} ca
tch (Excep
tion f) {
|
|
1010 |
|
} ca
tch (Excep
tion f) {
|
|
1010 |
|
} ca
tch (Excep
tion f) {
|
| 998 |
|
;
|
|
1011 |
|
;
|
|
1011 |
|
;
|
| 999 |
|
}
|
|
1012 |
|
}
|
|
1012 |
|
}
|
| 1000 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
|
1013 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
|
1013 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
| 1001 |
|
if (
debug > 1)
{
|
|
1014 |
|
if (
debug > 1)
{
|
|
1014 |
|
if (
debug > 1)
{
|
| 1002 |
|
try {
|
|
1015 |
|
try {
|
|
1015 |
|
try {
|
| 1003 |
|
log("p
rocess.par
se", e);
|
|
1016 |
|
log("p
rocess.par
se", e);
|
|
1016 |
|
log("p
rocess.par
se", e);
|
| 1004 |
|
((Http
ServletRes
ponse) res
ponse.getR
esponse())
|
|
1017 |
|
((Http
ServletRes
ponse) res
ponse.getR
esponse())
|
|
1017 |
|
((Http
ServletRes
ponse) res
ponse.getR
esponse())
|
| 1005 |
|
.s
endError(H
ttpServlet
Response.S
C_BAD_REQU
EST);
|
|
1018 |
|
.s
endError(H
ttpServlet
Response.S
C_BAD_REQU
EST);
|
|
1018 |
|
.s
endError(H
ttpServlet
Response.S
C_BAD_REQU
EST);
|
| 1006 |
|
} catch (E
xception f
) {
|
|
1019 |
|
} catch (E
xception f
) {
|
|
1019 |
|
} catch (E
xception f
) {
|
| 1007 |
|
;
|
|
1020 |
|
;
|
|
1020 |
|
;
|
| 1008 |
|
}
|
|
1021 |
|
}
|
|
1021 |
|
}
|
| 1009 |
|
}
|
|
1022 |
|
}
|
|
1022 |
|
}
|
| 1010 |
|
ok =
false;
|
|
1023 |
|
ok =
false;
|
|
1023 |
|
ok =
false;
|
| 1011 |
|
} catch
(Exception
e) {
|
|
1024 |
|
} catch
(Exception
e) {
|
|
1024 |
|
} catch
(Exception
e) {
|
| 1012 |
|
try
{
|
|
1025 |
|
try
{
|
|
1025 |
|
try
{
|
| 1013 |
|
log("proce
ss.parse",
e);
|
|
1026 |
|
log("proce
ss.parse",
e);
|
|
1026 |
|
log("proce
ss.parse",
e);
|
| 1014 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1027 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1027 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
| 1015 |
|
(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
|
1028 |
|
(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
|
1028 |
|
(HttpS
ervletResp
onse.SC_BA
D_REQUEST)
;
|
| 1016 |
|
} ca
tch (Excep
tion f) {
|
|
1029 |
|
} ca
tch (Excep
tion f) {
|
|
1029 |
|
} ca
tch (Excep
tion f) {
|
| 1017 |
|
;
|
|
1030 |
|
;
|
|
1030 |
|
;
|
| 1018 |
|
}
|
|
1031 |
|
}
|
|
1031 |
|
}
|
| 1019 |
|
ok =
false;
|
|
1032 |
|
ok =
false;
|
|
1032 |
|
ok =
false;
|
| 1020 |
|
}
|
|
1033 |
|
}
|
|
1033 |
|
}
|
| 1021 |
|
|
|
1034 |
|
|
|
1034 |
|
|
| 1022 |
|
// Ask o
ur Contain
er to proc
ess this r
equest
|
|
1035 |
|
// Ask o
ur Contain
er to proc
ess this r
equest
|
|
1035 |
|
// Ask o
ur Contain
er to proc
ess this r
equest
|
| 1023 |
|
try {
|
|
1036 |
|
try {
|
|
1036 |
|
try {
|
| 1024 |
|
((HttpServ
letRespons
e)
response).
addDat
e
Header
|
|
1037 |
|
((HttpServ
letRespons
e)
response).
s
e
t
Header
|
|
1037 |
|
((Ht
tpServletR
esponse) r
esponse).s
etHeader
|
| 1025 |
|
("Date",
Sy
st
e
m
.
c
urrent
Tim
e
Millis
());
|
|
1038 |
|
("Date
",
Fa
st
HttpDat
e
For
m
at
.
getC
urrent
Dat
e
());
|
|
1038 |
|
("Date
InsertedTe
xt
",
FastHttpDa
teFormat.g
etCurrentD
ate());
|
| 1026 |
|
if (
ok) {
|
|
1039 |
|
if (
ok) {
|
|
1039 |
|
if (
ok) {
|
| 1027 |
|
connector.
getContain
er().invok
e(request,
response)
;
|
|
1040 |
|
connector.
getContain
er().invok
e(request,
response)
;
|
|
1040 |
|
connector.
getContain
er().invok
e(request,
response)
;
|
| 1028 |
|
}
|
|
1041 |
|
}
|
|
1041 |
|
}
|
| 1029 |
|
} catch
(ServletEx
ception e)
{
|
|
1042 |
|
} catch
(ServletEx
ception e)
{
|
|
1042 |
|
} catch
(ServletEx
ception e)
{
|
| 1030 |
|
log(
"process.i
nvoke", e)
;
|
|
1043 |
|
log(
"process.i
nvoke", e)
;
|
|
1043 |
|
log(
"process.i
nvoke", e)
;
|
| 1031 |
|
try
{
|
|
1044 |
|
try
{
|
|
1044 |
|
try
{
|
| 1032 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1045 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1045 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
| 1033 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
|
1046 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
|
1046 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
| 1034 |
|
} ca
tch (Excep
tion f) {
|
|
1047 |
|
} ca
tch (Excep
tion f) {
|
|
1047 |
|
} ca
tch (Excep
tion f) {
|
| 1035 |
|
;
|
|
1048 |
|
;
|
|
1048 |
|
;
|
| 1036 |
|
}
|
|
1049 |
|
}
|
|
1049 |
|
}
|
| 1037 |
|
ok =
false;
|
|
1050 |
|
ok =
false;
|
|
1050 |
|
ok =
false;
|
| 1038 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
|
1051 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
|
1051 |
|
} catch
(Interrupt
edIOExcept
ion e) {
|
| 1039 |
|
ok =
false;
|
|
1052 |
|
ok =
false;
|
|
1052 |
|
ok =
false;
|
| 1040 |
|
} catch
(Throwable
e) {
|
|
1053 |
|
} catch
(Throwable
e) {
|
|
1053 |
|
} catch
(Throwable
e) {
|
| 1041 |
|
log(
"process.i
nvoke", e)
;
|
|
1054 |
|
log(
"process.i
nvoke", e)
;
|
|
1054 |
|
log(
"process.i
nvoke", e)
;
|
| 1042 |
|
try
{
|
|
1055 |
|
try
{
|
|
1055 |
|
try
{
|
| 1043 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1056 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
|
1056 |
|
((HttpServ
letRespons
e) respons
e.getRespo
nse()).sen
dError
|
| 1044 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
|
1057 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
|
1057 |
|
(HttpS
ervletResp
onse.SC_IN
TERNAL_SER
VER_ERROR)
;
|
| 1045 |
|
} ca
tch (Excep
tion f) {
|
|
1058 |
|
} ca
tch (Excep
tion f) {
|
|
1058 |
|
} ca
tch (Excep
tion f) {
|
| 1046 |
|
;
|
|
1059 |
|
;
|
|
1059 |
|
;
|
| 1047 |
|
}
|
|
1060 |
|
}
|
|
1060 |
|
}
|
| 1048 |
|
ok =
false;
|
|
1061 |
|
ok =
false;
|
|
1061 |
|
ok =
false;
|
| 1049 |
|
}
|
|
1062 |
|
}
|
|
1062 |
|
}
|
| 1050 |
|
|
|
1063 |
|
|
|
1063 |
|
|
| 1051 |
|
// Finis
h up the h
andling of
the reque
st
|
|
1064 |
|
// Finis
h up the h
andling of
the reque
st
|
|
1064 |
|
// Finis
h up the h
andling of
the reque
st
|
| 1052 |
|
try {
|
|
|
|
|
| 1053 |
|
if (
finishResp
onse) {
|
|
1065 |
|
if (fini
shResponse
) {
|
|
1065 |
|
if (fini
shResponse
) {
|
| |
|
1066 |
|
try
{
|
|
1066 |
|
try
{
|
| 1054 |
|
response.f
inishRespo
nse();
|
|
1067 |
|
response.f
inishRespo
nse();
|
|
1067 |
|
response.f
inishRespo
nse();
|
| |
|
1068 |
|
} ca
tch (IOExc
eption e)
{
|
|
1068 |
|
} ca
tch (IOExc
eption e)
{
|
| |
|
1069 |
|
ok = false
;
|
|
1069 |
|
ok = false
;
|
| |
|
1070 |
|
} ca
tch (Throw
able e) {
|
|
1070 |
|
} ca
tch (Throw
able e) {
|
| |
|
1071 |
|
log("proce
ss.invoke"
, e);
|
|
1071 |
|
log("proce
ss.invoke"
, e);
|
| |
|
1072 |
|
ok = false
;
|
|
1072 |
|
ok = false
;
|
| |
|
1073 |
|
}
|
|
1073 |
|
}
|
| |
|
1074 |
|
try
{
|
|
1074 |
|
try
{
|
| 1055 |
|
request.fi
nishReques
t();
|
|
1075 |
|
request.fi
nishReques
t();
|
|
1075 |
|
request.fi
nishReques
t();
|
| |
|
1076 |
|
} ca
tch (IOExc
eption e)
{
|
|
1076 |
|
} ca
tch (IOExc
eption e)
{
|
| |
|
1077 |
|
ok = false
;
|
|
1077 |
|
ok = false
;
|
| |
|
1078 |
|
} ca
tch (Throw
able e) {
|
|
1078 |
|
} ca
tch (Throw
able e) {
|
| |
|
1079 |
|
log("proce
ss.invoke"
, e);
|
|
1079 |
|
log("proce
ss.invoke"
, e);
|
| |
|
1080 |
|
ok = false
;
|
|
1080 |
|
ok = false
;
|
| |
|
1081 |
|
}
|
|
1081 |
|
}
|
| |
|
1082 |
|
try
{
|
|
1082 |
|
try
{
|
| 1056 |
|
if (output
!= null)
|
|
1083 |
|
if (output
!= null)
|
|
1083 |
|
if (output
!= null)
|
| 1057 |
|
output
.flush();
|
|
1084 |
|
output
.flush();
|
|
1084 |
|
output
.flush();
|
| 1058 |
|
}
|
|
|
|
|
| 1059 |
|
} catch
(IOExcepti
on e) {
|
|
1085 |
|
} ca
tch (IOExc
eption e)
{
|
|
1085 |
|
} ca
tch (IOExc
eption e)
{
|
| 1060 |
|
ok =
false;
|
|
1086 |
|
ok = false
;
|
|
1086 |
|
ok = false
;
|
| 1061 |
|
}
catch (Exc
eption e)
{
|
|
1087 |
|
}
|
|
1087 |
|
}
|
| 1062 |
|
log(
"process.f
inish", e)
;
|
|
|
|
|
| 1063 |
|
}
|
|
1088 |
|
}
|
|
1088 |
|
}
|
| 1064 |
|
|
|
1089 |
|
|
|
1089 |
|
|
| 1065 |
|
// We ha
ve to chec
k if the c
onnection
closure ha
s been req
uested
|
|
1090 |
|
// We ha
ve to chec
k if the c
onnection
closure ha
s been req
uested
|
|
1090 |
|
// We ha
ve to chec
k if the c
onnection
closure ha
s been req
uested
|
| 1066 |
|
// by th
e applicat
ion or the
response
stream (in
case of H
TTP/1.0
|
|
1091 |
|
// by th
e applicat
ion or the
response
stream (in
case of H
TTP/1.0
|
|
1091 |
|
// by th
e applicat
ion or the
response
stream (in
case of H
TTP/1.0
|
| 1067 |
|
// and k
eep-alive)
.
|
|
1092 |
|
// and k
eep-alive)
.
|
|
1092 |
|
// and k
eep-alive)
.
|
| 1068 |
|
if ( "cl
ose".equal
s(response
.getHeader
("Connecti
on")) ) {
|
|
1093 |
|
if ( "cl
ose".equal
s(response
.getHeader
("Connecti
on")) ) {
|
|
1093 |
|
if ( "cl
ose".equal
s(response
.getHeader
("Connecti
on")) ) {
|
| 1069 |
|
keep
Alive = fa
lse;
|
|
1094 |
|
keep
Alive = fa
lse;
|
|
1094 |
|
keep
Alive = fa
lse;
|
| 1070 |
|
}
|
|
1095 |
|
}
|
|
1095 |
|
}
|
| 1071 |
|
|
|
1096 |
|
|
|
1096 |
|
|
| 1072 |
|
// End o
f request
processing
|
|
1097 |
|
// End o
f request
processing
|
|
1097 |
|
// End o
f request
processing
|
| 1073 |
|
status =
Constants
.PROCESSOR
_IDLE;
|
|
1098 |
|
status =
Constants
.PROCESSOR
_IDLE;
|
|
1098 |
|
status =
Constants
.PROCESSOR
_IDLE;
|
| 1074 |
|
|
|
1099 |
|
|
|
1099 |
|
|
| 1075 |
|
// Recyc
ling the r
equest and
the respo
nse object
s
|
|
1100 |
|
// Recyc
ling the r
equest and
the respo
nse object
s
|
|
1100 |
|
// Recyc
ling the r
equest and
the respo
nse object
s
|
| 1076 |
|
request.
recycle();
|
|
1101 |
|
request.
recycle();
|
|
1101 |
|
request.
recycle();
|
| 1077 |
|
response
.recycle()
;
|
|
1102 |
|
response
.recycle()
;
|
|
1102 |
|
response
.recycle()
;
|
| 1078 |
|
|
|
1103 |
|
|
|
1103 |
|
|
| 1079 |
|
}
|
|
1104 |
|
}
|
|
1104 |
|
}
|
| 1080 |
|
|
|
1105 |
|
|
|
1105 |
|
|
| 1081 |
|
tr
y {
|
|
1106 |
|
tr
y {
|
|
1106 |
|
tr
y {
|
| 1082 |
|
shutdown
Input(inpu
t);
|
|
1107 |
|
shutdown
Input(inpu
t);
|
|
1107 |
|
shutdown
Input(inpu
t);
|
| 1083 |
|
socket.c
lose();
|
|
1108 |
|
socket.c
lose();
|
|
1108 |
|
socket.c
lose();
|
| 1084 |
|
}
catch (IOE
xception e
) {
|
|
1109 |
|
}
catch (IOE
xception e
) {
|
|
1109 |
|
}
catch (IOE
xception e
) {
|
| 1085 |
|
;
|
|
1110 |
|
;
|
|
1110 |
|
;
|
| |
|
1111 |
|
}
catch (Thr
owable e)
{
|
|
1111 |
|
}
catch (Thr
owable e)
{
|
| |
|
1112 |
|
log("pro
cess.invok
e", e);
|
|
1112 |
|
log("pro
cess.invok
e", e);
|
| 1086 |
|
}
|
|
1113 |
|
}
|
|
1113 |
|
}
|
| 1087 |
|
so
cket = nul
l;
|
|
1114 |
|
so
cket = nul
l;
|
|
1114 |
|
so
cket = nul
l;
|
| 1088 |
|
|
|
1115 |
|
|
|
1115 |
|
|
| 1089 |
|
}
|
|
1116 |
|
}
|
|
1116 |
|
}
|
| 1090 |
|
|
|
1117 |
|
|
|
1117 |
|
|
| 1091 |
|
|
|
1118 |
|
|
|
1118 |
|
|
| 1092 |
|
protected
void
shutdownIn
put(InputS
tream
input)
|
|
1119 |
|
protected
void
shutdownIn
put(InputS
tream
input)
{
|
|
1119 |
|
protec
ted void s
hutdownInp
ut(InputSt
ream input
) {
|
| 1093 |
|
th
rows IOExc
eption {
|
|
|
|
|
| 1094 |
|
tr
y {
|
|
1120 |
|
tr
y {
|
|
1120 |
|
tr
y {
|
| 1095 |
|
int avai
lable = in
put.availa
ble();
|
|
1121 |
|
int avai
lable = in
put.availa
ble();
|
|
1121 |
|
int avai
lable = in
put.availa
ble();
|
| 1096 |
|
// skip
any unread
(bogus) b
ytes
|
|
1122 |
|
// skip
any unread
(bogus) b
ytes
|
|
1122 |
|
// skip
any unread
(bogus) b
ytes
|
| 1097 |
|
if (avai
lable > 0)
{
|
|
1123 |
|
if (avai
lable > 0)
{
|
|
1123 |
|
if (avai
lable > 0)
{
|
| 1098 |
|
inpu
t.skip(ava
ilable);
|
|
1124 |
|
inpu
t.skip(ava
ilable);
|
|
1124 |
|
inpu
t.skip(ava
ilable);
|
| 1099 |
|
}
|
|
1125 |
|
}
|
|
1125 |
|
}
|
| 1100 |
|
}
catch
(
Excepti
o
n
e)
{
|
|
1126 |
|
}
catch
(
Thr
o
wable
e)
{
|
|
1126 |
|
}
catch (Thr
owable e)
{
|
| 1101 |
|
;
|
|
1127 |
|
;
|
|
1127 |
|
;
|
| 1102 |
|
}
|
|
1128 |
|
}
|
|
1128 |
|
}
|
| 1103 |
|
}
|
|
1129 |
|
}
|
|
1129 |
|
}
|
| 1104 |
|
|
|
1130 |
|
|
|
1130 |
|
|
| 1105 |
|
|
|
1131 |
|
|
|
1131 |
|
|
| 1106 |
|
// ---
----------
----------
----------
----------
--- Backgr
ound Threa
d Methods
|
|
1132 |
|
// ---
----------
----------
----------
----------
--- Backgr
ound Threa
d Methods
|
|
1132 |
|
// ---
----------
----------
----------
----------
--- Backgr
ound Threa
d Methods
|
| 1107 |
|
|
|
1133 |
|
|
|
1133 |
|
|
| 1108 |
|
|
|
1134 |
|
|
|
1134 |
|
|
| 1109 |
|
/**
|
|
1135 |
|
/**
|
|
1135 |
|
/**
|
| 1110 |
|
* The
backgroun
d thread t
hat listen
s for inco
ming TCP/I
P connecti
ons and
|
|
1136 |
|
* The
backgroun
d thread t
hat listen
s for inco
ming TCP/I
P connecti
ons and
|
|
1136 |
|
* The
backgroun
d thread t
hat listen
s for inco
ming TCP/I
P connecti
ons and
|
| 1111 |
|
* han
ds them of
f to an ap
propriate
processor.
|
|
1137 |
|
* han
ds them of
f to an ap
propriate
processor.
|
|
1137 |
|
* han
ds them of
f to an ap
propriate
processor.
|
| 1112 |
|
*/
|
|
1138 |
|
*/
|
|
1138 |
|
*/
|
| 1113 |
|
public
void run(
) {
|
|
1139 |
|
public
void run(
) {
|
|
1139 |
|
public
void run(
) {
|
| 1114 |
|
|
|
1140 |
|
|
|
1140 |
|
|
| 1115 |
|
//
Process r
equests un
til we rec
eive a shu
tdown sign
al
|
|
1141 |
|
//
Process r
equests un
til we rec
eive a shu
tdown sign
al
|
|
1141 |
|
//
Process r
equests un
til we rec
eive a shu
tdown sign
al
|
| 1116 |
|
wh
ile (!stop
ped) {
|
|
1142 |
|
wh
ile (!stop
ped) {
|
|
1142 |
|
wh
ile (!stop
ped) {
|
| 1117 |
|
|
|
1143 |
|
|
|
1143 |
|
|
| 1118 |
|
// Wait
for the ne
xt socket
to be assi
gned
|
|
1144 |
|
// Wait
for the ne
xt socket
to be assi
gned
|
|
1144 |
|
// Wait
for the ne
xt socket
to be assi
gned
|
| 1119 |
|
Socket s
ocket = aw
ait();
|
|
1145 |
|
Socket s
ocket = aw
ait();
|
|
1145 |
|
Socket s
ocket = aw
ait();
|
| 1120 |
|
if (sock
et == null
)
|
|
1146 |
|
if (sock
et == null
)
|
|
1146 |
|
if (sock
et == null
)
|
| 1121 |
|
cont
inue;
|
|
1147 |
|
cont
inue;
|
|
1147 |
|
cont
inue;
|
| 1122 |
|
|
|
1148 |
|
|
|
1148 |
|
|
| 1123 |
|
// Proce
ss the req
uest from
this socke
t
|
|
1149 |
|
// Proce
ss the req
uest from
this socke
t
|
|
1149 |
|
// Proce
ss the req
uest from
this socke
t
|
| 1124 |
|
try {
|
|
1150 |
|
try {
|
|
1150 |
|
try {
|
| 1125 |
|
proc
ess(socket
);
|
|
1151 |
|
proc
ess(socket
);
|
|
1151 |
|
proc
ess(socket
);
|
| 1126 |
|
} catch
(Throwable
t) {
|
|
1152 |
|
} catch
(Throwable
t) {
|
|
1152 |
|
} catch
(Throwable
t) {
|
| 1127 |
|
log("proce
ss
",
t);
|
|
1153 |
|
log("proce
ss
.invoke
",
t);
|
|
1153 |
|
log(
"process.i
nvoke", t)
;
|
| 1128 |
|
}
|
|
1154 |
|
}
|
|
1154 |
|
}
|
| 1129 |
|
|
|
1155 |
|
|
|
1155 |
|
|
| 1130 |
|
// Finis
h up this
request
|
|
1156 |
|
// Finis
h up this
request
|
|
1156 |
|
// Finis
h up this
request
|
| 1131 |
|
connecto
r.recycle(
this);
|
|
1157 |
|
connecto
r.recycle(
this);
|
|
1157 |
|
connecto
r.recycle(
this);
|
| 1132 |
|
|
|
1158 |
|
|
|
1158 |
|
|
| 1133 |
|
}
|
|
1159 |
|
}
|
|
1159 |
|
}
|
| 1134 |
|
|
|
1160 |
|
|
|
1160 |
|
|
| 1135 |
|
//
Tell thre
adStop() w
e have shu
t ourselve
s down suc
cessfully
|
|
1161 |
|
//
Tell thre
adStop() w
e have shu
t ourselve
s down suc
cessfully
|
|
1161 |
|
//
Tell thre
adStop() w
e have shu
t ourselve
s down suc
cessfully
|
| 1136 |
|
sy
nchronized
(threadSy
nc) {
|
|
1162 |
|
sy
nchronized
(threadSy
nc) {
|
|
1162 |
|
sy
nchronized
(threadSy
nc) {
|
| 1137 |
|
threadSy
nc.notifyA
ll();
|
|
1163 |
|
threadSy
nc.notifyA
ll();
|
|
1163 |
|
threadSy
nc.notifyA
ll();
|
| 1138 |
|
}
|
|
1164 |
|
}
|
|
1164 |
|
}
|
| 1139 |
|
|
|
1165 |
|
|
|
1165 |
|
|
| 1140 |
|
}
|
|
1166 |
|
}
|
|
1166 |
|
}
|
| 1141 |
|
|
|
1167 |
|
|
|
1167 |
|
|
| 1142 |
|
|
|
1168 |
|
|
|
1168 |
|
|
| 1143 |
|
/**
|
|
1169 |
|
/**
|
|
1169 |
|
/**
|
| 1144 |
|
* Sta
rt the bac
kground pr
ocessing t
hread.
|
|
1170 |
|
* Sta
rt the bac
kground pr
ocessing t
hread.
|
|
1170 |
|
* Sta
rt the bac
kground pr
ocessing t
hread.
|
| 1145 |
|
*/
|
|
1171 |
|
*/
|
|
1171 |
|
*/
|
| 1146 |
|
privat
e void thr
eadStart()
{
|
|
1172 |
|
privat
e void thr
eadStart()
{
|
|
1172 |
|
privat
e void thr
eadStart()
{
|
| 1147 |
|
|
|
1173 |
|
|
|
1173 |
|
|
| 1148 |
|
lo
g(sm.getSt
ring("http
Processor.
starting")
);
|
|
1174 |
|
lo
g(sm.getSt
ring("http
Processor.
starting")
);
|
|
1174 |
|
lo
g(sm.getSt
ring("http
Processor.
starting")
);
|
| 1149 |
|
|
|
1175 |
|
|
|
1175 |
|
|
| 1150 |
|
th
read = new
Thread(th
is, thread
Name);
|
|
1176 |
|
th
read = new
Thread(th
is, thread
Name);
|
|
1176 |
|
th
read = new
Thread(th
is, thread
Name);
|
| 1151 |
|
th
read.setDa
emon(true)
;
|
|
1177 |
|
th
read.setDa
emon(true)
;
|
|
1177 |
|
th
read.setDa
emon(true)
;
|
| 1152 |
|
th
read.start
();
|
|
1178 |
|
th
read.start
();
|
|
1178 |
|
th
read.start
();
|
| 1153 |
|
|
|
1179 |
|
|
|
1179 |
|
|
| 1154 |
|
if
(debug >=
1)
|
|
1180 |
|
if
(debug >=
1)
|
|
1180 |
|
if
(debug >=
1)
|
| 1155 |
|
log(" Ba
ckground t
hread has
been start
ed");
|
|
1181 |
|
log(" Ba
ckground t
hread has
been start
ed");
|
|
1181 |
|
log(" Ba
ckground t
hread has
been start
ed");
|
| 1156 |
|
|
|
1182 |
|
|
|
1182 |
|
|
| 1157 |
|
}
|
|
1183 |
|
}
|
|
1183 |
|
}
|
| 1158 |
|
|
|
1184 |
|
|
|
1184 |
|
|
| 1159 |
|
|
|
1185 |
|
|
|
1185 |
|
|
| 1160 |
|
/**
|
|
1186 |
|
/**
|
|
1186 |
|
/**
|
| 1161 |
|
* Sto
p the back
ground pro
cessing th
read.
|
|
1187 |
|
* Sto
p the back
ground pro
cessing th
read.
|
|
1187 |
|
* Sto
p the back
ground pro
cessing th
read.
|
| 1162 |
|
*/
|
|
1188 |
|
*/
|
|
1188 |
|
*/
|
| 1163 |
|
privat
e void thr
eadStop()
{
|
|
1189 |
|
privat
e void thr
eadStop()
{
|
|
1189 |
|
privat
e void thr
eadStop()
{
|
| 1164 |
|
|
|
1190 |
|
|
|
1190 |
|
|
| 1165 |
|
lo
g(sm.getSt
ring("http
Processor.
stopping")
);
|
|
1191 |
|
lo
g(sm.getSt
ring("http
Processor.
stopping")
);
|
|
1191 |
|
lo
g(sm.getSt
ring("http
Processor.
stopping")
);
|
| 1166 |
|
|
|
1192 |
|
|
|
1192 |
|
|
| 1167 |
|
st
opped = tr
ue;
|
|
1193 |
|
st
opped = tr
ue;
|
|
1193 |
|
st
opped = tr
ue;
|
| 1168 |
|
as
sign(null)
;
|
|
1194 |
|
as
sign(null)
;
|
|
1194 |
|
as
sign(null)
;
|
| 1169 |
|
|
|
1195 |
|
|
|
1195 |
|
|
| 1170 |
|
if
(status !
= Constant
s.PROCESSO
R_IDLE) {
|
|
1196 |
|
if
(status !
= Constant
s.PROCESSO
R_IDLE) {
|
|
1196 |
|
if
(status !
= Constant
s.PROCESSO
R_IDLE) {
|
| 1171 |
|
// Only
wait if th
e processo
r is actua
lly proces
sing a com
mand
|
|
1197 |
|
// Only
wait if th
e processo
r is actua
lly proces
sing a com
mand
|
|
1197 |
|
// Only
wait if th
e processo
r is actua
lly proces
sing a com
mand
|
| 1172 |
|
synchron
ized (thre
adSync) {
|
|
1198 |
|
synchron
ized (thre
adSync) {
|
|
1198 |
|
synchron
ized (thre
adSync) {
|
| 1173 |
|
try
{
|
|
1199 |
|
try
{
|
|
1199 |
|
try
{
|
| 1174 |
|
threadSync
.wait(5000
);
|
|
1200 |
|
threadSync
.wait(5000
);
|
|
1200 |
|
threadSync
.wait(5000
);
|
| 1175 |
|
} ca
tch (Inter
ruptedExce
ption e) {
|
|
1201 |
|
} ca
tch (Inter
ruptedExce
ption e) {
|
|
1201 |
|
} ca
tch (Inter
ruptedExce
ption e) {
|
| 1176 |
|
;
|
|
1202 |
|
;
|
|
1202 |
|
;
|
| 1177 |
|
}
|
|
1203 |
|
}
|
|
1203 |
|
}
|
| 1178 |
|
}
|
|
1204 |
|
}
|
|
1204 |
|
}
|
| 1179 |
|
}
|
|
1205 |
|
}
|
|
1205 |
|
}
|
| 1180 |
|
th
read = nul
l;
|
|
1206 |
|
th
read = nul
l;
|
|
1206 |
|
th
read = nul
l;
|
| 1181 |
|
|
|
1207 |
|
|
|
1207 |
|
|
| 1182 |
|
}
|
|
1208 |
|
}
|
|
1208 |
|
}
|
| 1183 |
|
|
|
1209 |
|
|
|
1209 |
|
|
| 1184 |
|
|
|
1210 |
|
|
|
1210 |
|
|
| 1185 |
|
// ---
----------
----------
----------
----------
----------
- Lifecycl
e Methods
|
|
1211 |
|
// ---
----------
----------
----------
----------
----------
- Lifecycl
e Methods
|
|
1211 |
|
// ---
----------
----------
----------
----------
----------
- Lifecycl
e Methods
|
| 1186 |
|
|
|
1212 |
|
|
|
1212 |
|
|
| 1187 |
|
|
|
1213 |
|
|
|
1213 |
|
|
| 1188 |
|
/**
|
|
1214 |
|
/**
|
|
1214 |
|
/**
|
| 1189 |
|
* Add
a lifecyc
le event l
istener to
this comp
onent.
|
|
1215 |
|
* Add
a lifecyc
le event l
istener to
this comp
onent.
|
|
1215 |
|
* Add
a lifecyc
le event l
istener to
this comp
onent.
|
| 1190 |
|
*
|
|
1216 |
|
*
|
|
1216 |
|
*
|
| 1191 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
|
1217 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
|
1217 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
| 1192 |
|
*/
|
|
1218 |
|
*/
|
|
1218 |
|
*/
|
| 1193 |
|
public
void addL
ifecycleLi
stener(Lif
ecycleList
ener liste
ner) {
|
|
1219 |
|
public
void addL
ifecycleLi
stener(Lif
ecycleList
ener liste
ner) {
|
|
1219 |
|
public
void addL
ifecycleLi
stener(Lif
ecycleList
ener liste
ner) {
|
| 1194 |
|
|
|
1220 |
|
|
|
1220 |
|
|
| 1195 |
|
li
fecycle.ad
dLifecycle
Listener(l
istener);
|
|
1221 |
|
li
fecycle.ad
dLifecycle
Listener(l
istener);
|
|
1221 |
|
li
fecycle.ad
dLifecycle
Listener(l
istener);
|
| 1196 |
|
|
|
1222 |
|
|
|
1222 |
|
|
| 1197 |
|
}
|
|
1223 |
|
}
|
|
1223 |
|
}
|
| 1198 |
|
|
|
1224 |
|
|
|
1224 |
|
|
| 1199 |
|
|
|
1225 |
|
|
|
1225 |
|
|
| 1200 |
|
/**
|
|
1226 |
|
/**
|
|
1226 |
|
/**
|
| |
|
1227 |
|
* Get
the lifec
ycle liste
ners assoc
iated with
this life
cycle. If
this
|
|
1227 |
|
* Get
the lifec
ycle liste
ners assoc
iated with
this life
cycle. If
this
|
| |
|
1228 |
|
* Lif
ecycle has
no listen
ers regist
ered, a ze
ro-length
array is r
eturned.
|
|
1228 |
|
* Lif
ecycle has
no listen
ers regist
ered, a ze
ro-length
array is r
eturned.
|
| |
|
1229 |
|
*/
|
|
1229 |
|
*/
|
| |
|
1230 |
|
public
Lifecycle
Listener[]
findLifec
ycleListen
ers() {
|
|
1230 |
|
public
Lifecycle
Listener[]
findLifec
ycleListen
ers() {
|
| |
|
1231 |
|
|
|
1231 |
|
|
| |
|
1232 |
|
re
turn lifec
ycle.findL
ifecycleLi
steners();
|
|
1232 |
|
re
turn lifec
ycle.findL
ifecycleLi
steners();
|
| |
|
1233 |
|
|
|
1233 |
|
|
| |
|
1234 |
|
}
|
|
1234 |
|
}
|
| |
|
1235 |
|
|
|
1235 |
|
|
| |
|
1236 |
|
|
|
1236 |
|
|
| |
|
1237 |
|
/**
|
|
1237 |
|
/**
|
| 1201 |
|
* Rem
ove a life
cycle even
t listener
from this
component
.
|
|
1238 |
|
* Rem
ove a life
cycle even
t listener
from this
component
.
|
|
1238 |
|
* Rem
ove a life
cycle even
t listener
from this
component
.
|
| 1202 |
|
*
|
|
1239 |
|
*
|
|
1239 |
|
*
|
| 1203 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
|
1240 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
|
1240 |
|
* @pa
ram listen
er The lis
tener to a
dd
|
| 1204 |
|
*/
|
|
1241 |
|
*/
|
|
1241 |
|
*/
|
| 1205 |
|
public
void remo
veLifecycl
eListener(
LifecycleL
istener li
stener) {
|
|
1242 |
|
public
void remo
veLifecycl
eListener(
LifecycleL
istener li
stener) {
|
|
1242 |
|
public
void remo
veLifecycl
eListener(
LifecycleL
istener li
stener) {
|
| 1206 |
|
|
|
1243 |
|
|
|
1243 |
|
|
| 1207 |
|
li
fecycle.re
moveLifecy
cleListene
r(listener
);
|
|
1244 |
|
li
fecycle.re
moveLifecy
cleListene
r(listener
);
|
|
1244 |
|
li
fecycle.re
moveLifecy
cleListene
r(listener
);
|
| 1208 |
|
|
|
1245 |
|
|
|
1245 |
|
|
| 1209 |
|
}
|
|
1246 |
|
}
|
|
1246 |
|
}
|
| 1210 |
|
|
|
1247 |
|
|
|
1247 |
|
|
| 1211 |
|
|
|
1248 |
|
|
|
1248 |
|
|
| 1212 |
|
/**
|
|
1249 |
|
/**
|
|
1249 |
|
/**
|
| 1213 |
|
* Sta
rt the bac
kground th
read we wi
ll use for
request p
rocessing.
|
|
1250 |
|
* Sta
rt the bac
kground th
read we wi
ll use for
request p
rocessing.
|
|
1250 |
|
* Sta
rt the bac
kground th
read we wi
ll use for
request p
rocessing.
|
| 1214 |
|
*
|
|
1251 |
|
*
|
|
1251 |
|
*
|
| 1215 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal st
artup erro
r occurs
|
|
1252 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal st
artup erro
r occurs
|
|
1252 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal st
artup erro
r occurs
|
| 1216 |
|
*/
|
|
1253 |
|
*/
|
|
1253 |
|
*/
|
| 1217 |
|
public
void star
t() throws
Lifecycle
Exception
{
|
|
1254 |
|
public
void star
t() throws
Lifecycle
Exception
{
|
|
1254 |
|
public
void star
t() throws
Lifecycle
Exception
{
|
| 1218 |
|
|
|
1255 |
|
|
|
1255 |
|
|
| 1219 |
|
if
(started)
|
|
1256 |
|
if
(started)
|
|
1256 |
|
if
(started)
|
| 1220 |
|
throw ne
w Lifecycl
eException
|
|
1257 |
|
throw ne
w Lifecycl
eException
|
|
1257 |
|
throw ne
w Lifecycl
eException
|
| 1221 |
|
(sm.
getString(
"httpProce
ssor.alrea
dyStarted"
));
|
|
1258 |
|
(sm.
getString(
"httpProce
ssor.alrea
dyStarted"
));
|
|
1258 |
|
(sm.
getString(
"httpProce
ssor.alrea
dyStarted"
));
|
| 1222 |
|
li
fecycle.fi
reLifecycl
eEvent(STA
RT_EVENT,
null);
|
|
1259 |
|
li
fecycle.fi
reLifecycl
eEvent(STA
RT_EVENT,
null);
|
|
1259 |
|
li
fecycle.fi
reLifecycl
eEvent(STA
RT_EVENT,
null);
|
| 1223 |
|
st
arted = tr
ue;
|
|
1260 |
|
st
arted = tr
ue;
|
|
1260 |
|
st
arted = tr
ue;
|
| 1224 |
|
|
|
1261 |
|
|
|
1261 |
|
|
| 1225 |
|
th
readStart(
);
|
|
1262 |
|
th
readStart(
);
|
|
1262 |
|
th
readStart(
);
|
| 1226 |
|
|
|
1263 |
|
|
|
1263 |
|
|
| 1227 |
|
}
|
|
1264 |
|
}
|
|
1264 |
|
}
|
| 1228 |
|
|
|
1265 |
|
|
|
1265 |
|
|
| 1229 |
|
|
|
1266 |
|
|
|
1266 |
|
|
| 1230 |
|
/**
|
|
1267 |
|
/**
|
|
1267 |
|
/**
|
| 1231 |
|
* Sto
p the back
ground thr
ead we wil
l use for
request pr
ocessing.
|
|
1268 |
|
* Sto
p the back
ground thr
ead we wil
l use for
request pr
ocessing.
|
|
1268 |
|
* Sto
p the back
ground thr
ead we wil
l use for
request pr
ocessing.
|
| 1232 |
|
*
|
|
1269 |
|
*
|
|
1269 |
|
*
|
| 1233 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal sh
utdown err
or occurs
|
|
1270 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal sh
utdown err
or occurs
|
|
1270 |
|
* @ex
ception Li
fecycleExc
eption if
a fatal sh
utdown err
or occurs
|
| 1234 |
|
*/
|
|
1271 |
|
*/
|
|
1271 |
|
*/
|
| 1235 |
|
public
void stop
() throws
LifecycleE
xception {
|
|
1272 |
|
public
void stop
() throws
LifecycleE
xception {
|
|
1272 |
|
public
void stop
() throws
LifecycleE
xception {
|
| 1236 |
|
|
|
1273 |
|
|
|
1273 |
|
|
| 1237 |
|
if
(!started
)
|
|
1274 |
|
if
(!started
)
|
|
1274 |
|
if
(!started
)
|
| 1238 |
|
throw ne
w Lifecycl
eException
|
|
1275 |
|
throw ne
w Lifecycl
eException
|
|
1275 |
|
throw ne
w Lifecycl
eException
|
| 1239 |
|
(sm.
getString(
"httpProce
ssor.notSt
arted"));
|
|
1276 |
|
(sm.
getString(
"httpProce
ssor.notSt
arted"));
|
|
1276 |
|
(sm.
getString(
"httpProce
ssor.notSt
arted"));
|
| 1240 |
|
li
fecycle.fi
reLifecycl
eEvent(STO
P_EVENT, n
ull);
|
|
1277 |
|
li
fecycle.fi
reLifecycl
eEvent(STO
P_EVENT, n
ull);
|
|
1277 |
|
li
fecycle.fi
reLifecycl
eEvent(STO
P_EVENT, n
ull);
|
| 1241 |
|
st
arted = fa
lse;
|
|
1278 |
|
st
arted = fa
lse;
|
|
1278 |
|
st
arted = fa
lse;
|
| 1242 |
|
|
|
1279 |
|
|
|
1279 |
|
|
| 1243 |
|
th
readStop()
;
|
|
1280 |
|
th
readStop()
;
|
|
1280 |
|
th
readStop()
;
|
| 1244 |
|
|
|
1281 |
|
|
|
1281 |
|
|
| 1245 |
|
}
|
|
1282 |
|
}
|
|
1282 |
|
}
|
| 1246 |
|
|
|
1283 |
|
|
|
1283 |
|
|
| 1247 |
|
|
|
1284 |
|
|
|
1284 |
|
|
| 1248 |
|
}
|
|
1285 |
|
}
|
|
1285 |
|
}
|