Produced by Araxis Merge on Mon Mar 6 16:03:39 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Merge Test Files\4.0.6\catalina\src\share\org\apache\catalina\connector | HttpRequestBase.java | Tue Oct 8 15:15:34 2002 UTC |
| 2 | C:\Merge Test Files\4.1.18\catalina\src\share\org\apache\catalina\connector | HttpRequestBase.java | Thu Dec 19 13:49:44 2002 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 9 | 1251 |
| Changed | 2 | 9 |
| Inserted | 6 | 62 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /* | 1 | /* | |||
| 2 |
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/Ht
tpRequestB
ase.java,v
1.3
1.2.4
2002/04/
|
2 |
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/Ht
tpRequestB
ase.java,v
1.3
9
2002/04/
22
0
0
|
|||
| 3 | * $Revision: 1.3 1.2.4 $ | 3 | * $Revision: 1.3 9 $ | |||
| 4 |
*
$Date:
2002/04/
|
4 |
*
$Date:
2002/04/
22
0
0
|
|||
| 5 | * | 5 | * | |||
| 6 | * ======= ========== ========== ========== ========== ========== ========== = | 6 | * ======= ========== ========== ========== ========== ========== ========== = | |||
| 7 | * | 7 | * | |||
| 8 | * The Apa che Softwa re License , Version 1.1 | 8 | * The Apa che Softwa re License , Version 1.1 | |||
| 9 | * | 9 | * | |||
| 10 | * Copyrig ht (c) 199 9 The Apac he Softwar e Foundati on. All r ights | 10 | * Copyrig ht (c) 199 9 The Apac he Softwar e Foundati on. All r ights | |||
| 11 | * reserve d. | 11 | * reserve d. | |||
| 12 | * | 12 | * | |||
| 13 | * Redistr ibution an d use in s ource and binary for ms, with o r without | 13 | * Redistr ibution an d use in s ource and binary for ms, with o r without | |||
| 14 | * modific ation, are permitted provided that the f ollowing c onditions | 14 | * modific ation, are permitted provided that the f ollowing c onditions | |||
| 15 | * are met : | 15 | * are met : | |||
| 16 | * | 16 | * | |||
| 17 | * 1. Redi stribution s of sourc e code mus t retain t he above c opyright | 17 | * 1. Redi stribution s of sourc e code mus t retain t he above c opyright | |||
| 18 | * noti ce, this l ist of con ditions an d the foll owing disc laimer. | 18 | * noti ce, this l ist of con ditions an d the foll owing disc laimer. | |||
| 19 | * | 19 | * | |||
| 20 | * 2. Redi stribution s in binar y form mus t reproduc e the abov e copyrigh t | 20 | * 2. Redi stribution s in binar y form mus t reproduc e the abov e copyrigh t | |||
| 21 | * noti ce, this l ist of con ditions an d the foll owing disc laimer in | 21 | * noti ce, this l ist of con ditions an d the foll owing disc laimer in | |||
| 22 | * the documentat ion and/or other mat erials pro vided with the | 22 | * the documentat ion and/or other mat erials pro vided with the | |||
| 23 | * dist ribution. | 23 | * dist ribution. | |||
| 24 | * | 24 | * | |||
| 25 | * 3. The end-user d ocumentati on include d with the redistrib ution, if | 25 | * 3. The end-user d ocumentati on include d with the redistrib ution, if | |||
| 26 | * any, must incl ude the fo llowing ac knowlegeme nt: | 26 | * any, must incl ude the fo llowing ac knowlegeme nt: | |||
| 27 | * " This produ ct include s software developed by the | 27 | * " This produ ct include s software developed by the | |||
| 28 | * Apache Sof tware Foun dation (ht tp://www.a pache.org/ )." | 28 | * Apache Sof tware Foun dation (ht tp://www.a pache.org/ )." | |||
| 29 | * Alte rnately, t his acknow legement m ay appear in the sof tware itse lf, | 29 | * Alte rnately, t his acknow legement m ay appear in the sof tware itse lf, | |||
| 30 | * if a nd whereve r such thi rd-party a cknowlegem ents norma lly appear . | 30 | * if a nd whereve r such thi rd-party a cknowlegem ents norma lly appear . | |||
| 31 | * | 31 | * | |||
| 32 | * 4. The names "The Jakarta P roject", " Tomcat", a nd "Apache Software | 32 | * 4. The names "The Jakarta P roject", " Tomcat", a nd "Apache Software | |||
| 33 | * Foun dation" mu st not be used to en dorse or p romote pro ducts deri ved | 33 | * Foun dation" mu st not be used to en dorse or p romote pro ducts deri ved | |||
| 34 | * from this soft ware witho ut prior w ritten per mission. F or written | 34 | * from this soft ware witho ut prior w ritten per mission. F or written | |||
| 35 | * perm ission, pl ease conta ct apache@ apache.org . | 35 | * perm ission, pl ease conta ct apache@ apache.org . | |||
| 36 | * | 36 | * | |||
| 37 | * 5. Prod ucts deriv ed from th is softwar e may not be called "Apache" | 37 | * 5. Prod ucts deriv ed from th is softwar e may not be called "Apache" | |||
| 38 | * nor may "Apach e" appear in their n ames witho ut prior w ritten | 38 | * nor may "Apach e" appear in their n ames witho ut prior w ritten | |||
| 39 | * perm ission of the Apache Group. | 39 | * perm ission of the Apache Group. | |||
| 40 | * | 40 | * | |||
| 41 | * THIS SO FTWARE IS PROVIDED ` `AS IS'' A ND ANY EXP RESSED OR IMPLIED | 41 | * THIS SO FTWARE IS PROVIDED ` `AS IS'' A ND ANY EXP RESSED OR IMPLIED | |||
| 42 | * WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES | 42 | * WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES | |||
| 43 | * OF MERC HANTABILIT Y AND FITN ESS FOR A PARTICULAR PURPOSE A RE | 43 | * OF MERC HANTABILIT Y AND FITN ESS FOR A PARTICULAR PURPOSE A RE | |||
| 44 | * DISCLAI MED. IN N O EVENT SH ALL THE AP ACHE SOFTW ARE FOUNDA TION OR | 44 | * DISCLAI MED. IN N O EVENT SH ALL THE AP ACHE SOFTW ARE FOUNDA TION OR | |||
| 45 | * ITS CON TRIBUTORS BE LIABLE FOR ANY DI RECT, INDI RECT, INCI DENTAL, | 45 | * ITS CON TRIBUTORS BE LIABLE FOR ANY DI RECT, INDI RECT, INCI DENTAL, | |||
| 46 | * SPECIAL , EXEMPLAR Y, OR CONS EQUENTIAL DAMAGES (I NCLUDING, BUT NOT | 46 | * SPECIAL , EXEMPLAR Y, OR CONS EQUENTIAL DAMAGES (I NCLUDING, BUT NOT | |||
| 47 | * LIMITED TO, PROCU REMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 47 | * LIMITED TO, PROCU REMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| 48 | * USE, DA TA, OR PRO FITS; OR B USINESS IN TERRUPTION ) HOWEVER CAUSED AND | 48 | * USE, DA TA, OR PRO FITS; OR B USINESS IN TERRUPTION ) HOWEVER CAUSED AND | |||
| 49 | * ON ANY THEORY OF LIABILITY, WHETHER I N CONTRACT , STRICT L IABILITY, | 49 | * ON ANY THEORY OF LIABILITY, WHETHER I N CONTRACT , STRICT L IABILITY, | |||
| 50 | * OR TORT (INCLUDIN G NEGLIGEN CE OR OTHE RWISE) ARI SING IN AN Y WAY OUT | 50 | * OR TORT (INCLUDIN G NEGLIGEN CE OR OTHE RWISE) ARI SING IN AN Y WAY OUT | |||
| 51 | * OF THE USE OF THI S SOFTWARE , EVEN IF ADVISED OF THE POSSI BILITY OF | 51 | * OF THE USE OF THI S SOFTWARE , EVEN IF ADVISED OF THE POSSI BILITY OF | |||
| 52 | * SUCH DA MAGE. | 52 | * SUCH DA MAGE. | |||
| 53 | * ======= ========== ========== ========== ========== ========== ========== = | 53 | * ======= ========== ========== ========== ========== ========== ========== = | |||
| 54 | * | 54 | * | |||
| 55 | * This so ftware con sists of v oluntary c ontributio ns made by many | 55 | * This so ftware con sists of v oluntary c ontributio ns made by many | |||
| 56 | * individ uals on be half of th e Apache S oftware Fo undation. For more | 56 | * individ uals on be half of th e Apache S oftware Fo undation. For more | |||
| 57 | * informa tion on th e Apache S oftware Fo undation, please see | 57 | * informa tion on th e Apache S oftware Fo undation, please see | |||
| 58 | * <http:/ /www.apach e.org/>. | 58 | * <http:/ /www.apach e.org/>. | |||
| 59 | * | 59 | * | |||
| 60 | * [Additi onal notic es, if req uired by p rior licen sing condi tions] | 60 | * [Additi onal notic es, if req uired by p rior licen sing condi tions] | |||
| 61 | * | 61 | * | |||
| 62 | */ | 62 | */ | |||
| 63 | 63 | |||||
| 64 | 64 | |||||
| 65 | package or g.apache.c atalina.co nnector; | 65 | package or g.apache.c atalina.co nnector; | |||
| 66 | 66 | |||||
| 67 | 67 | |||||
| 68 | import jav a.io.IOExc eption; | 68 | import jav a.io.IOExc eption; | |||
| 69 | import jav a.io.Unsup portedEnco dingExcept ion; | 69 | import jav a.io.Unsup portedEnco dingExcept ion; | |||
| 70 | import jav a.security .AccessCon troller; | 70 | import jav a.security .AccessCon troller; | |||
| 71 | import jav a.security .Principal ; | 71 | import jav a.security .Principal ; | |||
| 72 | import jav a.security .Privilege dAction; | 72 | import jav a.security .Privilege dAction; | |||
| 73 | import jav a.text.Par seExceptio n; | 73 | import jav a.text.Par seExceptio n; | |||
| 74 | import jav a.text.Sim pleDateFor mat; | 74 | import jav a.text.Sim pleDateFor mat; | |||
| 75 | import jav a.util.Arr ayList; | 75 | import jav a.util.Arr ayList; | |||
| 76 | import jav a.util.Dat e; | 76 | import jav a.util.Dat e; | |||
| 77 | import jav a.util.Enu meration; | 77 | import jav a.util.Enu meration; | |||
| 78 | import jav a.util.Has hMap; | 78 | import jav a.util.Has hMap; | |||
| 79 | import jav a.util.Has htable; | 79 | import jav a.util.Has htable; | |||
| 80 | import jav a.util.Loc ale; | 80 | import jav a.util.Loc ale; | |||
| 81 | import jav a.util.Map ; | 81 | import jav a.util.Map ; | |||
| 82 | import jav ax.servlet .RequestDi spatcher; | 82 | import jav ax.servlet .RequestDi spatcher; | |||
| 83 | import jav ax.servlet .ServletRe quest; | 83 | import jav ax.servlet .ServletRe quest; | |||
| 84 | import jav ax.servlet .ServletIn putStream; | 84 | import jav ax.servlet .ServletIn putStream; | |||
| 85 | import jav ax.servlet .http.Cook ie; | 85 | import jav ax.servlet .http.Cook ie; | |||
| 86 | import jav ax.servlet .http.Http ServletReq uest; | 86 | import jav ax.servlet .http.Http ServletReq uest; | |||
| 87 | import jav ax.servlet .http.Http Session; | 87 | import jav ax.servlet .http.Http Session; | |||
| 88 | import org .apache.ca talina.Glo bals; | 88 | import org .apache.ca talina.Glo bals; | |||
| 89 | import org .apache.ca talina.Htt pRequest; | 89 | import org .apache.ca talina.Htt pRequest; | |||
| 90 | import org .apache.ca talina.Log ger; | |||||
| 90 | import org .apache.ca talina.Man ager; | 91 | import org .apache.ca talina.Man ager; | |||
| 91 | import org .apache.ca talina.Rea lm; | 92 | import org .apache.ca talina.Rea lm; | |||
| 92 | import org .apache.ca talina.Ses sion; | 93 | import org .apache.ca talina.Ses sion; | |||
| 93 | import org .apache.ca talina.uti l.Enumerat or; | 94 | import org .apache.ca talina.uti l.Enumerat or; | |||
| 94 | import org .apache.ca talina.uti l.Paramete rMap; | 95 | import org .apache.ca talina.uti l.Paramete rMap; | |||
| 95 | import org .apache.ca talina.uti l.RequestU til; | 96 | import org .apache.ca talina.uti l.RequestU til; | |||
| 96 | import org .apache.ca talina.uti l.StringPa rser; | 97 | import org .apache.ca talina.uti l.StringPa rser; | |||
| 97 | 98 | |||||
| 98 | 99 | |||||
| 99 | /** | 100 | /** | |||
| 100 | * Conveni ence base implementa tion of th e <b>HttpR equest</b> interface , which | 101 | * Conveni ence base implementa tion of th e <b>HttpR equest</b> interface , which | |||
| 101 | * can be used for t he Request implement ation requ ired by mo st Connect ors that | 102 | * can be used for t he Request implement ation requ ired by mo st Connect ors that | |||
| 102 | * impleme nt the HTT P protocol . Only th e connecto r-specific methods n eed to | 103 | * impleme nt the HTT P protocol . Only th e connecto r-specific methods n eed to | |||
| 103 | * be impl emented. | 104 | * be impl emented. | |||
| 104 | * | 105 | * | |||
| 105 | * @author Craig R. McClanahan | 106 | * @author Craig R. McClanahan | |||
| 106 |
*
@version
$Revision:
1.3
1.2.4
$
$Date:
2002/04/
|
107 |
*
@version
$Revision:
1.3
9
$
$Date:
2002/04/
22
0
0
|
|||
| 108 | * @deprec ated | |||||
| 107 | */ | 109 | */ | |||
| 108 | 110 | |||||
| 109 | public cla ss HttpReq uestBase | 111 | public cla ss HttpReq uestBase | |||
| 110 | extend s RequestB ase | 112 | extend s RequestB ase | |||
| 111 | implem ents HttpR equest, Ht tpServletR equest { | 113 | implem ents HttpR equest, Ht tpServletR equest { | |||
| 112 | 114 | |||||
| 113 | 115 | |||||
| 114 | protec ted class Privileged GetSession | 116 | protec ted class Privileged GetSession | |||
| 115 | im plements P rivilegedA ction { | 117 | im plements P rivilegedA ction { | |||
| 116 | 118 | |||||
| 117 | pr ivate bool ean create ; | 119 | pr ivate bool ean create ; | |||
| 118 | 120 | |||||
| 119 | Pr ivilegedGe tSession(b oolean cre ate) { | 121 | Pr ivilegedGe tSession(b oolean cre ate) { | |||
| 120 | this.cre ate = crea te; | 122 | this.cre ate = crea te; | |||
| 121 | } | 123 | } | |||
| 122 | 124 | |||||
| 123 | pu blic Objec t run() { | 125 | pu blic Objec t run() { | |||
| 124 | return d oGetSessio n(create); | 126 | return d oGetSessio n(create); | |||
| 125 | } | 127 | } | |||
| 126 | 128 | |||||
| 127 | } | 129 | } | |||
| 128 | 130 | |||||
| 129 | 131 | |||||
| 130 | // --- ---------- ---------- ---------- ---------- ---------- Instance Variables | 132 | // --- ---------- ---------- ---------- ---------- ---------- Instance Variables | |||
| 131 | 133 | |||||
| 132 | 134 | |||||
| 133 | /** | 135 | /** | |||
| 134 | * The authentic ation type used for this reque st. | 136 | * The authentic ation type used for this reque st. | |||
| 135 | */ | 137 | */ | |||
| 136 | protec ted String authType = null; | 138 | protec ted String authType = null; | |||
| 137 | 139 | |||||
| 138 | 140 | |||||
| 139 | /** | 141 | /** | |||
| 140 | * The context p ath for th is request . | 142 | * The context p ath for th is request . | |||
| 141 | */ | 143 | */ | |||
| 142 | protec ted String contextPa th = ""; | 144 | protec ted String contextPa th = ""; | |||
| 143 | 145 | |||||
| 144 | 146 | |||||
| 145 | /** | 147 | /** | |||
| 146 | * The set of co okies asso ciated wit h this Req uest. | 148 | * The set of co okies asso ciated wit h this Req uest. | |||
| 147 | */ | 149 | */ | |||
| 148 | protec ted ArrayL ist cookie s = new Ar rayList(); | 150 | protec ted ArrayL ist cookie s = new Ar rayList(); | |||
| 149 | 151 | |||||
| 150 | 152 | |||||
| 151 | /** | 153 | /** | |||
| 152 | * An empty coll ection to use for re turning em pty Enumer ations. D o not | 154 | * An empty coll ection to use for re turning em pty Enumer ations. D o not | |||
| 153 | * add any eleme nts to thi s collecti on! | 155 | * add any eleme nts to thi s collecti on! | |||
| 154 | */ | 156 | */ | |||
| (49 unchanged lines omitted) | ||||||
| 204 | * syn chronized. | 206 | * syn chronized. | |||
| 205 | */ | 207 | */ | |||
| 206 | protec ted Parame terMap par ameters = null; | 208 | protec ted Parame terMap par ameters = null; | |||
| 207 | 209 | |||||
| 208 | 210 | |||||
| 209 | /** | 211 | /** | |||
| 210 | * Hav e the para meters for this requ est been p arsed yet? | 212 | * Hav e the para meters for this requ est been p arsed yet? | |||
| 211 | */ | 213 | */ | |||
| 212 | protec ted boolea n parsed = false; | 214 | protec ted boolea n parsed = false; | |||
| 213 | 215 | |||||
| 214 | 216 | |||||
| 215 | /** | 217 | /** | |||
| 216 | * The path info rmation fo r this req uest. | 218 | * The path info rmation fo r this req uest. | |||
| 217 | */ | 219 | */ | |||
| 218 | protec ted String pathInfo = null; | 220 | protec ted String pathInfo = null; | |||
| 219 | 221 | |||||
| 220 | 222 | |||||
| 221 | /** | 223 | /** | |||
| 222 | * The query str ing for th is request . | 224 | * The query str ing for th is request . | |||
| 223 | */ | 225 | */ | |||
| 224 | protec ted String queryStri ng = null; | 226 | protec ted String queryStri ng = null; | |||
| 225 | 227 | |||||
| 226 | 228 | |||||
| 227 | /** | 229 | /** | |||
| 228 | * Was the reque sted sessi on ID rece ived in a cookie? | 230 | * Was the reque sted sessi on ID rece ived in a cookie? | |||
| 229 | */ | 231 | */ | |||
| 230 | protec ted boolea n requeste dSessionCo okie = fal se; | 232 | protec ted boolea n requeste dSessionCo okie = fal se; | |||
| 231 | 233 | |||||
| 232 | 234 | |||||
| 233 | /** | 235 | /** | |||
| 234 | * The requested session I D (if any) for this request. | 236 | * The requested session I D (if any) for this request. | |||
| 235 | */ | 237 | */ | |||
| 236 | protec ted String requested SessionId = null; | 238 | protec ted String requested SessionId = null; | |||
| 237 | 239 | |||||
| 238 | 240 | |||||
| 239 | /** | 241 | /** | |||
| 240 | * Was the reque sted sessi on ID rece ived in a URL? | 242 | * Was the reque sted sessi on ID rece ived in a URL? | |||
| 241 | */ | 243 | */ | |||
| 242 | protec ted boolea n requeste dSessionUR L = false; | 244 | protec ted boolea n requeste dSessionUR L = false; | |||
| 243 | 245 | |||||
| 244 | 246 | |||||
| 245 | /** | 247 | /** | |||
| 246 | * The request U RI associa ted with t his reques t. | 248 | * The request U RI associa ted with t his reques t. | |||
| 247 | */ | 249 | */ | |||
| 248 | protec ted String requestUR I = null; | 250 | protec ted String requestUR I = null; | |||
| 249 | 251 | |||||
| 250 | 252 | |||||
| 251 | /** | 253 | /** | |||
| 254 | * The decoded r equest URI associate d with thi s request. | |||||
| 255 | */ | |||||
| 256 | protec ted String decodedRe questURI = null; | |||||
| 257 | ||||||
| 258 | ||||||
| 259 | /** | |||||
| 252 | * Was this requ est receiv ed on a se cure chann el? | 260 | * Was this requ est receiv ed on a se cure chann el? | |||
| 253 | */ | 261 | */ | |||
| 254 | protec ted boolea n secure = false; | 262 | protec ted boolea n secure = false; | |||
| 255 | 263 | |||||
| 256 | 264 | |||||
| 257 | /** | 265 | /** | |||
| 258 | * The servlet p ath for th is request . | 266 | * The servlet p ath for th is request . | |||
| 259 | */ | 267 | */ | |||
| 260 | protec ted String servletPa th = null; | 268 | protec ted String servletPa th = null; | |||
| 261 | 269 | |||||
| 262 | 270 | |||||
| 263 | /** | 271 | /** | |||
| 264 | * The currently active se ssion for this reque st. | 272 | * The currently active se ssion for this reque st. | |||
| 265 | */ | 273 | */ | |||
| 266 | protec ted Sessio n session = null; | 274 | protec ted Sessio n session = null; | |||
| 267 | 275 | |||||
| 268 | 276 | |||||
| 269 | /** | 277 | /** | |||
| 270 | * The Principal who has b een authen ticated fo r this Req uest. | 278 | * The Principal who has b een authen ticated fo r this Req uest. | |||
| 271 | */ | 279 | */ | |||
| 272 | protec ted Princi pal userPr incipal = null; | 280 | protec ted Princi pal userPr incipal = null; | |||
| 273 | 281 | |||||
| 274 | 282 | |||||
| 275 | // --- ---------- ---------- ---------- ---------- ---------- -------- P roperties | 283 | // --- ---------- ---------- ---------- ---------- ---------- -------- P roperties | |||
| 276 | 284 | |||||
| 277 | 285 | |||||
| 278 | /** | 286 | /** | |||
| 279 | * Ret urn descri ptive info rmation ab out this R equest imp lementatio n and | 287 | * Ret urn descri ptive info rmation ab out this R equest imp lementatio n and | |||
| 280 | * the correspon ding versi on number, in the fo rmat | 288 | * the correspon ding versi on number, in the fo rmat | |||
| 281 | * <co de><des cription&g t;/<ver sion></ code>. | 289 | * <co de><des cription&g t;/<ver sion></ code>. | |||
| 282 | */ | 290 | */ | |||
| 283 | public String ge tInfo() { | 291 | public String ge tInfo() { | |||
| 284 | 292 | |||||
| 285 | re turn (info ); | 293 | re turn (info ); | |||
| 286 | 294 | |||||
| 287 | } | 295 | } | |||
| 288 | 296 | |||||
| 289 | 297 | |||||
| 290 | /** | 298 | /** | |||
| 291 | * Ret urn the <c ode>Servle tRequest</ code> for which this object | 299 | * Ret urn the <c ode>Servle tRequest</ code> for which this object | |||
| 292 | * is the facade . This me thod must be impleme nted by a subclass. | 300 | * is the facade . This me thod must be impleme nted by a subclass. | |||
| 293 | */ | 301 | */ | |||
| 294 | public ServletRe quest getR equest() { | 302 | public ServletRe quest getR equest() { | |||
| 295 | 303 | |||||
| 296 | re turn (faca de); | 304 | re turn (faca de); | |||
| 297 | 305 | |||||
| 298 | } | 306 | } | |||
| 299 | 307 | |||||
| (78 unchanged lines omitted) | ||||||
| 378 | /** | 386 | /** | |||
| 379 | * Cle ar the col lection of Locales a ssociated with this Request. | 387 | * Cle ar the col lection of Locales a ssociated with this Request. | |||
| 380 | */ | 388 | */ | |||
| 381 | public void clea rLocales() { | 389 | public void clea rLocales() { | |||
| 382 | 390 | |||||
| 383 | lo cales.clea r(); | 391 | lo cales.clea r(); | |||
| 384 | 392 | |||||
| 385 | } | 393 | } | |||
| 386 | 394 | |||||
| 387 | 395 | |||||
| 388 | /** | 396 | /** | |||
| 389 | * Cle ar the col lection of parameter s associat ed with th is Request . | 397 | * Cle ar the col lection of parameter s associat ed with th is Request . | |||
| 390 | */ | 398 | */ | |||
| 391 | public void clea rParameter s() { | 399 | public void clea rParameter s() { | |||
| 392 | 400 | |||||
| 393 | if (paramete rs != null ) { | 401 | if (paramete rs != null ) { | |||
| 394 | paramete rs.setLock ed(false); | 402 | paramete rs.setLock ed(false); | |||
| 395 | paramete rs.clear() ; | 403 | paramete rs.clear() ; | |||
| 396 | } else { | 404 | } else { | |||
| 397 | paramete rs = new P arameterMa p(); | 405 | paramete rs = new P arameterMa p(); | |||
| 398 | } | 406 | } | |||
| 399 | 407 | |||||
| 400 | } | 408 | } | |||
| 401 | 409 | |||||
| 402 | 410 | |||||
| 403 | /** | 411 | /** | |||
| 404 | * Rel ease all o bject refe rences, an d initiali ze instanc e variable s, in | 412 | * Rel ease all o bject refe rences, an d initiali ze instanc e variable s, in | |||
| 405 | * pre paration f or reuse o f this obj ect. | 413 | * pre paration f or reuse o f this obj ect. | |||
| 406 | */ | 414 | */ | |||
| 407 | public void recy cle() { | 415 | public void recy cle() { | |||
| 408 | 416 | |||||
| 409 | su per.recycl e(); | 417 | su per.recycl e(); | |||
| 410 | au thType = n ull; | 418 | au thType = n ull; | |||
| 411 | co ntextPath = ""; | 419 | co ntextPath = ""; | |||
| 412 | co okies.clea r(); | 420 | co okies.clea r(); | |||
| 413 | he aders.clea r(); | 421 | he aders.clea r(); | |||
| 414 | me thod = nul l; | 422 | me thod = nul l; | |||
| 415 | if (paramete rs != null ) { | 423 | if (paramete rs != null ) { | |||
| 416 | paramete rs.setLock ed(false); | 424 | paramete rs.setLock ed(false); | |||
| 417 | paramete rs.clear() ; | 425 | paramete rs.clear() ; | |||
| 418 | } | 426 | } | |||
| 419 | pa rsed = fal se; | 427 | pa rsed = fal se; | |||
| 420 | pa thInfo = n ull; | 428 | pa thInfo = n ull; | |||
| 421 | qu eryString = null; | 429 | qu eryString = null; | |||
| 422 | re questedSes sionCookie = false; | 430 | re questedSes sionCookie = false; | |||
| 423 | re questedSes sionId = n ull; | 431 | re questedSes sionId = n ull; | |||
| 424 | re questedSes sionURL = false; | 432 | re questedSes sionURL = false; | |||
| 425 | re questURI = null; | 433 | re questURI = null; | |||
| 434 | de codedReque stURI = nu ll; | |||||
| 426 | se cure = fal se; | 435 | se cure = fal se; | |||
| 427 | se rvletPath = null; | 436 | se rvletPath = null; | |||
| 428 | se ssion = nu ll; | 437 | se ssion = nu ll; | |||
| 429 | us erPrincipa l = null; | 438 | us erPrincipa l = null; | |||
| 430 | 439 | |||||
| 431 | } | 440 | } | |||
| 432 | 441 | |||||
| 433 | 442 | |||||
| 434 | /** | 443 | /** | |||
| 435 | * Set the authe ntication type used for this r equest, if any; othe rwise | 444 | * Set the authe ntication type used for this r equest, if any; othe rwise | |||
| 436 | * set the type to <code>n ull</code> . Typical values ar e "BASIC", | 445 | * set the type to <code>n ull</code> . Typical values ar e "BASIC", | |||
| 437 | * "DI GEST", or "SSL". | 446 | * "DI GEST", or "SSL". | |||
| 438 | * | 447 | * | |||
| 439 | * @pa ram authTy pe The aut henticatio n type use d | 448 | * @pa ram authTy pe The aut henticatio n type use d | |||
| 440 | */ | 449 | */ | |||
| 441 | public void setA uthType(St ring authT ype) { | 450 | public void setA uthType(St ring authT ype) { | |||
| 442 | 451 | |||||
| 443 | th is.authTyp e = authTy pe; | 452 | th is.authTyp e = authTy pe; | |||
| 444 | 453 | |||||
| 445 | } | 454 | } | |||
| 446 | 455 | |||||
| 447 | 456 | |||||
| 448 | /** | 457 | /** | |||
| 449 | * Set the conte xt path fo r this Req uest. Thi s will nor mally be c alled | 458 | * Set the conte xt path fo r this Req uest. Thi s will nor mally be c alled | |||
| 450 | * whe n the asso ciated Con text is ma pping the Request to a particu lar | 459 | * whe n the asso ciated Con text is ma pping the Request to a particu lar | |||
| 451 | * Wra pper. | 460 | * Wra pper. | |||
| 452 | * | 461 | * | |||
| 453 | * @pa ram path T he context path | 462 | * @pa ram path T he context path | |||
| 454 | */ | 463 | */ | |||
| 455 | public void setC ontextPath (String pa th) { | 464 | public void setC ontextPath (String pa th) { | |||
| 456 | 465 | |||||
| 457 | if (path == null) | 466 | if (path == null) | |||
| 458 | this.con textPath = ""; | 467 | this.con textPath = ""; | |||
| 459 | el se | 468 | el se | |||
| 460 | this.con textPath = path; | 469 | this.con textPath = path; | |||
| 461 | 470 | |||||
| 462 | } | 471 | } | |||
| 463 | 472 | |||||
| 464 | 473 | |||||
| 465 | /** | 474 | /** | |||
| 466 | * Set the HTTP request me thod used for this R equest. | 475 | * Set the HTTP request me thod used for this R equest. | |||
| 467 | * | 476 | * | |||
| 468 | * @pa ram method The reque st method | 477 | * @pa ram method The reque st method | |||
| 469 | */ | 478 | */ | |||
| 470 | public void setM ethod(Stri ng method) { | 479 | public void setM ethod(Stri ng method) { | |||
| 471 | 480 | |||||
| 472 | th is.method = method; | 481 | th is.method = method; | |||
| 473 | 482 | |||||
| (136 unchanged lines omitted) | ||||||
| 610 | if (parsed) | 619 | if (parsed) | |||
| 611 | return; | 620 | return; | |||
| 612 | 621 | |||||
| 613 | Pa rameterMap results = parameter s; | 622 | Pa rameterMap results = parameter s; | |||
| 614 | if (results == null) | 623 | if (results == null) | |||
| 615 | results = new Para meterMap() ; | 624 | results = new Para meterMap() ; | |||
| 616 | re sults.setL ocked(fals e); | 625 | re sults.setL ocked(fals e); | |||
| 617 | 626 | |||||
| 618 | St ring encod ing = getC haracterEn coding(); | 627 | St ring encod ing = getC haracterEn coding(); | |||
| 619 | if (encoding == null) | 628 | if (encoding == null) | |||
| 620 | encoding = "ISO-88 59-1"; | 629 | encoding = "ISO-88 59-1"; | |||
| 621 | 630 | |||||
| 622 | // Parse any parameter s specifie d in the q uery strin g | 631 | // Parse any parameter s specifie d in the q uery strin g | |||
| 623 | St ring query String = g etQueryStr ing(); | 632 | St ring query String = g etQueryStr ing(); | |||
| 624 | tr y { | 633 | tr y { | |||
| 625 | RequestU til.parseP arameters( results, q ueryString , encoding ); | 634 | RequestU til.parseP arameters( results, q ueryString , encoding ); | |||
| 626 | } catch (Uns upportedEn codingExce ption e) { | 635 | } catch (Uns upportedEn codingExce ption e) { | |||
| 627 | ; | 636 | ; | |||
| 628 | } | 637 | } | |||
| 629 | 638 | |||||
| 630 | // Parse any parameter s specifie d in the i nput strea m | 639 | // Parse any parameter s specifie d in the i nput strea m | |||
| 631 | St ring conte ntType = g etContentT ype(); | 640 | St ring conte ntType = g etContentT ype(); | |||
| 632 | if (contentT ype == nul l) | 641 | if (contentT ype == nul l) | |||
| 633 | contentT ype = ""; | 642 | contentT ype = ""; | |||
| 634 | in t semicolo n = conten tType.inde xOf(';'); | 643 | in t semicolo n = conten tType.inde xOf(';'); | |||
| 635 | if (semicolo n >= 0) { | 644 | if (semicolo n >= 0) { | |||
| 636 | contentT ype = cont entType.su bstring(0, semicolon ).trim(); | 645 | contentT ype = cont entType.su bstring(0, semicolon ).trim(); | |||
| 637 | } else { | 646 | } else { | |||
| 638 | contentT ype = cont entType.tr im(); | 647 | contentT ype = cont entType.tr im(); | |||
| 639 | } | 648 | } | |||
| 640 | if ("POST".e quals(getM ethod()) & & (getCont entLength( ) > 0) | 649 | if ("POST".e quals(getM ethod()) & & (getCont entLength( ) > 0) | |||
| 641 | && (this .stream == null) | 650 | && (this .stream == null) | |||
| 642 | && "appl ication/x- www-form-u rlencoded" .equals(co ntentType) ) { | 651 | && "appl ication/x- www-form-u rlencoded" .equals(co ntentType) ) { | |||
| 643 | 652 | |||||
| 644 | try { | 653 | try { | |||
| 645 | int max = getC ontentLeng th(); | 654 | int max = getC ontentLeng th(); | |||
| 646 | int len = 0; | 655 | int len = 0; | |||
| 647 | byte buf[] = n ew byte[ge tContentLe ngth()]; | 656 | byte buf[] = n ew byte[ge tContentLe ngth()]; | |||
| 648 | Serv letInputSt ream is = getInputSt ream(); | 657 | Serv letInputSt ream is = getInputSt ream(); | |||
| 649 | whil e (len < m ax) { | 658 | whil e (len < m ax) { | |||
| 650 | int next = is.read(b uf, len, m ax - len); | 659 | int next = is.read(b uf, len, m ax - len); | |||
| 651 | if (next < 0 ) { | 660 | if (next < 0 ) { | |||
| 652 | break; | 661 | break; | |||
| 653 | } | 662 | } | |||
| 654 | len += nex t; | 663 | len += nex t; | |||
| 655 | } | 664 | } | |||
| 656 | is.c lose(); | 665 | is.c lose(); | |||
| 657 | if ( len < max) { | 666 | if ( len < max) { | |||
| 667 | // FIX ME, mod_jk wh en sending an HTTP P OST will s ometimes | |||||
| 668 | // have an actual co ntent leng th receive d < conten t length. | |||||
| 669 | // Checkin g for a re ad of -1 a bove preve nts this c ode from | |||||
| 670 | // going i nto an inf inite loop . But the bug must be in mod_ jk. | |||||
| 671 | // Log add itional da ta when th is occurs to help de bug mod_jk | |||||
| 672 | StringBuff er msg = n ew StringB uffer(); | |||||
| 673 | msg.append ("HttpRequ estBase.pa rseParamet ers conten t length m ismatch\n" ); | |||||
| 674 | msg.append (" URL: " ); | |||||
| 675 | msg.append (getReques tURL()); | |||||
| 676 | msg.append (" Content Length: " ); | |||||
| 677 | msg.append (max); | |||||
| 678 | msg.append (" Read: " ); | |||||
| 679 | msg.append (len); | |||||
| 680 | msg.append ("\n Byte s Read: ") ; | |||||
| 681 | if ( len > 0 ) { | |||||
| 682 | msg.ap pend(new S tring(buf, 0,len)); | |||||
| 683 | } | |||||
| 684 | log(msg.to String()); | |||||
| 658 | throw new RuntimeExc eption | 685 | throw new RuntimeExc eption | |||
| 659 | (sm.ge tString("h ttpRequest Base.conte ntLengthMi smatch")); | 686 | (sm.ge tString("h ttpRequest Base.conte ntLengthMi smatch")); | |||
| 660 | } | 687 | } | |||
| 661 | Requ estUtil.pa rseParamet ers(result s, buf, en coding); | 688 | Requ estUtil.pa rseParamet ers(result s, buf, en coding); | |||
| 662 | } catch (Unsuppor tedEncodin gException ue) { | 689 | } catch (Unsupport edEncoding Exception ue) { | |||
| 663 | ; | 690 | ; | |||
| 664 | } catch (IOExcept ion e) { | 691 | } catch (IOExcepti on e) { | |||
| 665 | thr ow new Run timeExcept ion | 692 | thro w new Runt imeExcepti on | |||
| 666 | (sm.ge tString("h ttpRequest Base.conte ntReadFail ") + | 693 | (sm.ge tString("h ttpRequest Base.conte ntReadFail ") + | |||
| 667 | e.get Message()) ; | 694 | e.get Message()) ; | |||
| 668 | } | 695 | } | |||
| 669 | } | 696 | } | |||
| 670 | 697 | |||||
| 671 | // Store the final res ults | 698 | // Store the final res ults | |||
| 672 | re sults.setL ocked(true ); | 699 | re sults.setL ocked(true ); | |||
| 673 | pa rsed = tru e; | 700 | pa rsed = tru e; | |||
| 674 | pa rameters = results; | 701 | pa rameters = results; | |||
| 675 | 702 | |||||
| 676 | } | 703 | } | |||
| 677 | 704 | |||||
| 678 | 705 | |||||
| 679 | // --- ---------- ---------- ---------- ---------- ------ Ser vletReques t Methods | 706 | // --- ---------- ---------- ---------- ---------- ------ Ser vletReques t Methods | |||
| 680 | 707 | |||||
| 681 | 708 | |||||
| 682 | /** | 709 | /** | |||
| 683 | * Ret urn the va lue of the specified request p arameter, if any; ot herwise, | 710 | * Ret urn the va lue of the specified request p arameter, if any; ot herwise, | |||
| 684 | * ret urn <code> null</code >. If the re is more than one value defi ned, | 711 | * ret urn <code> null</code >. If the re is more than one value defi ned, | |||
| 685 | * ret urn only t he first o ne. | 712 | * ret urn only t he first o ne. | |||
| 686 | * | 713 | * | |||
| 687 | * @pa ram name N ame of the desired r equest par ameter | 714 | * @pa ram name N ame of the desired r equest par ameter | |||
| 688 | */ | 715 | */ | |||
| 689 | public String ge tParameter (String na me) { | 716 | public String ge tParameter (String na me) { | |||
| 690 | 717 | |||||
| 691 | pa rseParamet ers(); | 718 | pa rseParamet ers(); | |||
| 692 | St ring value s[] = (Str ing[]) par ameters.ge t(name); | 719 | St ring value s[] = (Str ing[]) par ameters.ge t(name); | |||
| 693 | if (values ! = null) | 720 | if (values ! = null) | |||
| 694 | return ( values[0]) ; | 721 | return ( values[0]) ; | |||
| 695 | el se | 722 | el se | |||
| 696 | return ( null); | 723 | return ( null); | |||
| 697 | 724 | |||||
| 698 | } | 725 | } | |||
| 699 | 726 | |||||
| 700 | 727 | |||||
| 701 | /** | 728 | /** | |||
| 702 | * Ret urns a <co de>Map</co de> of the parameter s of this request. | 729 | * Ret urns a <co de>Map</co de> of the parameter s of this request. | |||
| 703 | * Req uest param eters are extra info rmation se nt with th e request. | 730 | * Req uest param eters are extra info rmation se nt with th e request. | |||
| 704 | * For HTTP serv lets, para meters are contained in the qu ery string | 731 | * For HTTP serv lets, para meters are contained in the qu ery string | |||
| 705 | * or posted for m data. | 732 | * or posted for m data. | |||
| (265 unchanged lines omitted) | ||||||
| 971 | } | 998 | } | |||
| 972 | 999 | |||||
| 973 | 1000 | |||||
| 974 | /** | 1001 | /** | |||
| 975 | * Ret urn the qu ery string associate d with thi s request. | 1002 | * Ret urn the qu ery string associate d with thi s request. | |||
| 976 | */ | 1003 | */ | |||
| 977 | public String ge tQueryStri ng() { | 1004 | public String ge tQueryStri ng() { | |||
| 978 | 1005 | |||||
| 979 | re turn (quer yString); | 1006 | re turn (quer yString); | |||
| 980 | 1007 | |||||
| 981 | } | 1008 | } | |||
| 982 | 1009 | |||||
| 983 | 1010 | |||||
| 984 | /** | 1011 | /** | |||
| 985 | * Ret urn the na me of the remote use r that has been auth enticated | 1012 | * Ret urn the na me of the remote use r that has been auth enticated | |||
| 986 | * for this Requ est. | 1013 | * for this Requ est. | |||
| 987 | */ | 1014 | */ | |||
| 988 | public String ge tRemoteUse r() { | 1015 | public String ge tRemoteUse r() { | |||
| 989 | 1016 | |||||
| 990 | if (userPrin cipal != n ull) | 1017 | if (userPrin cipal != n ull) | |||
| 991 | return ( userPrinci pal.getNam e()); | 1018 | return ( userPrinci pal.getNam e()); | |||
| 992 | el se | 1019 | el se | |||
| 993 | return ( null); | 1020 | return ( null); | |||
| 994 | 1021 | |||||
| 995 | } | 1022 | } | |||
| 996 | 1023 | |||||
| 997 | 1024 | |||||
| 998 | /** | 1025 | /** | |||
| 999 | * Ret urn the se ssion iden tifier inc luded in t his reques t, if any. | 1026 | * Ret urn the se ssion iden tifier inc luded in t his reques t, if any. | |||
| 1000 | */ | 1027 | */ | |||
| 1001 | public String ge tRequested SessionId( ) { | 1028 | public String ge tRequested SessionId( ) { | |||
| 1002 | 1029 | |||||
| 1003 | re turn (requ estedSessi onId); | 1030 | re turn (requ estedSessi onId); | |||
| 1004 | 1031 | |||||
| 1005 | } | 1032 | } | |||
| 1006 | 1033 | |||||
| 1007 | 1034 | |||||
| 1008 | /** | 1035 | /** | |||
| 1009 | * Ret urn the re quest URI for this r equest. | 1036 | * Ret urn the re quest URI for this r equest. | |||
| 1010 | */ | 1037 | */ | |||
| 1011 | public String ge tRequestUR I() { | 1038 | public String ge tRequestUR I() { | |||
| 1012 | 1039 | |||||
| 1013 | re turn (requ estURI); | 1040 | re turn (requ estURI); | |||
| 1014 | 1041 | |||||
| 1015 | } | 1042 | } | |||
| 1016 | 1043 | |||||
| 1017 | 1044 | |||||
| 1018 | /** | 1045 | /** | |||
| 1046 | * Set the decod ed request URI. | |||||
| 1047 | * | |||||
| 1048 | * @pa ram uri Th e decoded request UR I | |||||
| 1049 | */ | |||||
| 1050 | public void setD ecodedRequ estURI(Str ing uri) { | |||||
| 1051 | ||||||
| 1052 | th is.decoded RequestURI = uri; | |||||
| 1053 | ||||||
| 1054 | } | |||||
| 1055 | ||||||
| 1056 | ||||||
| 1057 | /** | |||||
| 1058 | * Ret urn the UR L decoded request UR I. | |||||
| 1059 | */ | |||||
| 1060 | public String ge tDecodedRe questURI() { | |||||
| 1061 | ||||||
| 1062 | if (decodedR equestURI == null) | |||||
| 1063 | decodedR equestURI = RequestU til.URLDec ode(getReq uestURI()) ; | |||||
| 1064 | ||||||
| 1065 | re turn decod edRequestU RI; | |||||
| 1066 | ||||||
| 1067 | } | |||||
| 1068 | ||||||
| 1069 | ||||||
| 1070 | /** | |||||
| 1019 | * Rec onstructs the URL th e client u sed to mak e the requ est. | 1071 | * Rec onstructs the URL th e client u sed to mak e the requ est. | |||
| 1020 | * The returned URL contai ns a proto col, serve r name, po rt | 1072 | * The returned URL contai ns a proto col, serve r name, po rt | |||
| 1021 | * num ber, and s erver path , but it d oes not in clude quer y | 1073 | * num ber, and s erver path , but it d oes not in clude quer y | |||
| 1022 | * str ing parame ters. | 1074 | * str ing parame ters. | |||
| 1023 | * <p> | 1075 | * <p> | |||
| 1024 | * Bec ause this method ret urns a <co de>StringB uffer</cod e>, | 1076 | * Bec ause this method ret urns a <co de>StringB uffer</cod e>, | |||
| 1025 | * not a <code>S tring</cod e>, you ca n modify t he URL eas ily, | 1077 | * not a <code>S tring</cod e>, you ca n modify t he URL eas ily, | |||
| 1026 | * for example, to append query para meters. | 1078 | * for example, to append query para meters. | |||
| 1027 | * <p> | 1079 | * <p> | |||
| 1028 | * Thi s method i s useful f or creatin g redirect messages and | 1080 | * Thi s method i s useful f or creatin g redirect messages and | |||
| 1029 | * for reporting errors. | 1081 | * for reporting errors. | |||
| 1030 | * | 1082 | * | |||
| 1031 | * @re turn A <co de>StringB uffer</cod e> object containing the | 1083 | * @re turn A <co de>StringB uffer</cod e> object containing the | |||
| 1032 | * re constructe d URL | 1084 | * re constructe d URL | |||
| 1033 | */ | 1085 | */ | |||
| 1034 | public StringBuf fer getReq uestURL() { | 1086 | public StringBuf fer getReq uestURL() { | |||
| 1035 | 1087 | |||||
| 1036 | St ringBuffer url = new StringBuf fer(); | 1088 | St ringBuffer url = new StringBuf fer(); | |||
| 1037 | St ring schem e = getSch eme(); | 1089 | St ring schem e = getSch eme(); | |||
| 1038 | in t port = g etServerPo rt(); | 1090 | in t port = g etServerPo rt(); | |||
| 1039 | if (port < 0 ) | 1091 | if (port < 0 ) | |||
| 1040 | port = 8 0; // Work around ja va.net.URL bug | 1092 | port = 8 0; // Work around ja va.net.URL bug | |||
| 1041 | 1093 | |||||
| 1042 | ur l.append(s cheme); | 1094 | ur l.append(s cheme); | |||
| 1043 | ur l.append(" ://"); | 1095 | ur l.append(" ://"); | |||
| 1044 | ur l.append(g etServerNa me()); | 1096 | ur l.append(g etServerNa me()); | |||
| 1045 | if ((scheme. equals("ht tp") && (p ort != 80) ) | 1097 | if ((scheme. equals("ht tp") && (p ort != 80) ) | |||
| 1046 | || (sche me.equals( "https") & & (port != 443))) { | 1098 | || (sche me.equals( "https") & & (port != 443))) { | |||
| 1047 | url.appe nd(':'); | 1099 | url.appe nd(':'); | |||
| 1048 | url.appe nd(port); | 1100 | url.appe nd(port); | |||
| 1049 | } | 1101 | } | |||
| 1050 | ur l.append(g etRequestU RI()); | 1102 | ur l.append(g etRequestU RI()); | |||
| 1051 | 1103 | |||||
| 1052 | re turn (url) ; | 1104 | re turn (url) ; | |||
| 1053 | 1105 | |||||
| 1054 | } | 1106 | } | |||
| 1055 | 1107 | |||||
| 1056 | 1108 | |||||
| 1057 | /** | 1109 | /** | |||
| 1058 | * Ret urn the po rtion of t he request URI used to select the servle t | 1110 | * Ret urn the po rtion of t he request URI used to select the servle t | |||
| 1059 | * tha t will pro cess this request. | 1111 | * tha t will pro cess this request. | |||
| 1060 | */ | 1112 | */ | |||
| 1061 | public String ge tServletPa th() { | 1113 | public String ge tServletPa th() { | |||
| 1062 | 1114 | |||||
| 1063 | re turn (serv letPath); | 1115 | re turn (serv letPath); | |||
| 1064 | 1116 | |||||
| 1065 | } | 1117 | } | |||
| 1066 | 1118 | |||||
| (140 unchanged lines omitted) | ||||||
| 1207 | return ( false); | 1259 | return ( false); | |||
| 1208 | 1260 | |||||
| 1209 | } | 1261 | } | |||
| 1210 | 1262 | |||||
| 1211 | 1263 | |||||
| 1212 | /** | 1264 | /** | |||
| 1213 | * Ret urn <code> true</code > if the a uthenticat ed user pr incipal | 1265 | * Ret urn <code> true</code > if the a uthenticat ed user pr incipal | |||
| 1214 | * pos sesses the specified role name . | 1266 | * pos sesses the specified role name . | |||
| 1215 | * | 1267 | * | |||
| 1216 | * @pa ram role R ole name t o be valid ated | 1268 | * @pa ram role R ole name t o be valid ated | |||
| 1217 | */ | 1269 | */ | |||
| 1218 | public boolean i sUserInRol e(String r ole) { | 1270 | public boolean i sUserInRol e(String r ole) { | |||
| 1219 | 1271 | |||||
| 1220 | // Have we g ot an auth enticated principal at all? | 1272 | // Have we g ot an auth enticated principal at all? | |||
| 1221 | if (userPrin cipal == n ull) | 1273 | if (userPrin cipal == n ull) | |||
| 1222 | return ( false); | 1274 | return ( false); | |||
| 1223 | 1275 | |||||
| 1224 | // Identify the Realm we will us e for chec king role assignmene ts | 1276 | // Identify the Realm we will us e for chec king role assignmene ts | |||
| 1225 | if (context == null) | 1277 | if (context == null) | |||
| 1226 | return ( false); | 1278 | return ( false); | |||
| 1227 | Re alm realm = context. getRealm() ; | 1279 | Re alm realm = context. getRealm() ; | |||
| 1228 | if (realm == null) | 1280 | if (realm == null) | |||
| 1229 | return ( false); | 1281 | return ( false); | |||
| 1230 | 1282 | |||||
| 1231 | // Check for a role al ias define d in a <se curity-rol e-ref> ele ment | 1283 | // Check for a role al ias define d in a <se curity-rol e-ref> ele ment | |||
| 1232 | if (wrapper != null) { | 1284 | if (wrapper != null) { | |||
| 1233 | String r ealRole = wrapper.fi ndSecurity Reference( role); | 1285 | String r ealRole = wrapper.fi ndSecurity Reference( role); | |||
| 1234 | if ((rea lRole != n ull) && | 1286 | if ((rea lRole != n ull) && | |||
| 1235 | real m.hasRole( userPrinci pal, realR ole)) | 1287 | real m.hasRole( userPrinci pal, realR ole)) | |||
| 1236 | retu rn (true); | 1288 | retu rn (true); | |||
| 1237 | } | 1289 | } | |||
| 1238 | 1290 | |||||
| 1239 | // Check for a role de fined dire ctly as a <security- role> | 1291 | // Check for a role de fined dire ctly as a <security- role> | |||
| 1240 | re turn (real m.hasRole( userPrinci pal, role) ); | 1292 | re turn (real m.hasRole( userPrinci pal, role) ); | |||
| 1241 | 1293 | |||||
| 1242 | } | 1294 | } | |||
| 1243 | 1295 | |||||
| 1244 | 1296 | |||||
| 1245 | /** | 1297 | /** | |||
| 1246 | * Ret urn the pr incipal th at has bee n authenti cated for this Reque st. | 1298 | * Ret urn the pr incipal th at has bee n authenti cated for this Reque st. | |||
| 1247 | */ | 1299 | */ | |||
| 1248 | public Principal getUserPr incipal() { | 1300 | public Principal getUserPr incipal() { | |||
| 1249 | 1301 | |||||
| 1250 | re turn (user Principal) ; | 1302 | re turn (user Principal) ; | |||
| 1251 | 1303 | |||||
| 1252 | } | 1304 | } | |||
| 1253 | 1305 | |||||
| 1254 | 1306 | |||||
| 1307 | privat e void log (String me ssage) { | |||||
| 1308 | Lo gger logge r = contex t.getLogge r(); | |||||
| 1309 | lo gger.log(m essage); | |||||
| 1310 | } | |||||
| 1311 | ||||||
| 1312 | ||||||
| 1313 | privat e void log (String me ssage, Thr owable thr owable) { | |||||
| 1314 | Lo gger logge r = contex t.getLogge r(); | |||||
| 1315 | lo gger.log(m essage, th rowable); | |||||
| 1316 | } | |||||
| 1317 | ||||||
| 1255 | } | 1318 | } | |||
Araxis Merge (but not this generated report) is Copyright © 1993-2005 Araxis Ltd (www.araxis.com). All rights reserved.