Upload
ham-giai-doan-cuoi
View
214
Download
0
Embed Size (px)
Citation preview
8/12/2019 PRJ201_F2013_PT1_239574
1/15
FPT University
Source: Exported from FU-EOS
Subject: ADV !P"#$%&'ener(ted Time: %$)*)#$%+ ,:#*:, P.
.U/T0P/E 12O01ES 3UEST0O4S:
345% !%$$*6& T7e met7od 8et9riter returns (n object of type Print9riter T7is c;(ss 7(sprint;n met7ods to 8ener(te output 97ic7 of t7ese c;(sses define t7e 8et9riter
met7od< Se;ect one correct (ns=er
( 2ttpServ;et"e>uest
b 2ttpServ;et"esponse
c Serv;et1onfi8
d Serv;et1ontext
A4S9E": ?
.A"@: %
U40T: T7e Serv;et .ode;.0 12O01ES: Bes
345# !%$%+$& CCCCCCCC is t7e =e;;-no=n 7ost n(me t7(t refers to your o=n computer
( ;oc(;7ost
b computer n(me
c D4S
d ip
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345+ !%$%$#& T7e send"edirect met7od defined in t7e 2ttpServ;et c;(ss is e>uiv(;ent toinvoin8 t7e setSt(tus met7od =it7 t7e fo;;o=in8 p(r(meter (nd ( /oc(tion
7e(der in t7e U"/ Se;ect one correct (ns=er
( S1CO@
b S1C.OVEDCTE.PO"A"0/B
c S1C4OTCFOU4D
d S1C04TE"4A/CSE"VE"CE""O"
e ES1C?ADC"E3UEST
A4S9E": ?
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345 !%$$#& 0f you =(nt t7e s(me Serv;et to 7(nd;e bot7 'ET (nd POST (nd to t(e t7e s(m
(ction for e(c7 you c(n simp;y 7(ve do'et c(;; doPost or vice vers(
( True
8/12/2019 PRJ201_F2013_PT1_239574
2/15
b F(;se
A4S9E": A
.A"@: $,
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345, !%$%%G& Bou 7(ve to send ( 8if im(8e to t7e c;ient (s ( response to ( re>uest 97ic7 of
t7e fo;;o=in8 c(;;s =i;; you 7(ve to m(e< !17oose one&
( responseset1ontentType!Him(8e)8ifH&I
b responsesetType!H(pp;ic(tion)8ifH&I
c responseset1ontentType!H(pp;ic(tion)binH&I
d responsesetType!Him(8e)8ifH&I
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345G !%$%+G& 2ttpSessions expire on;y =7en t7e bro=sin8 session ends or =7en t7e inv(;id(temet7od is c(;;ed
( True
b F(;se
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
3456 !%$%#,& 1onsider t7e 2T./ code be;o= 97ic7 of t7e fo;;o=in8 met7od c(;;s c(n
retrieve t7e Hem(i;H v(;ue sent from t7e bro=ser< !17oose one&
( 8etP(r(meter!Hem(i;H& of Serv;et"e>uest
b 8etFie;d!Hem(i;H& of 2ttpServ;et"e>uest
c 8etFormV(;ue!Hem(i;H& of 2ttpServ;et"e>uest
d 8etP(r(meters!Hem(i;H& of 2ttpServ;et
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345 !%$%%& Serv;et 1ont(iner c(;;s t7e init met7od on ( serv;et inst(nce CCCC( On;y once in t7e ;ife time of t7e serv;et inst(nce
b For e(c7 re>uest to t7e serv;et
c 0f t7e re>uest is from t7e user =7ose session 7(s expired
d For e(c7 re>uest to t7e serv;et t7(t c(uses ( ne= t7re(d to be cre(ted
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
8/12/2019 PRJ201_F2013_PT1_239574
3/15
.0 12O01ES: Bes
345* !%$$*#& 97en ( 9eb server responds to ( re>uest from ( bro=ser or ot7er 9eb c;ientt7e response typic(;;y consists of: !17oose one&
( ( st(tus ;ine some response 7e(ders ( b;(n ;ine (nd t7e document
b ( st(tus ;ine ( b;(n ;ine (nd t7e documentc ( b;(n ;ine ( st(tus ;ine some response 7e(ders (nd t7e document
d ( st(tus ;ine some response 7e(ders (nd t7e document
A4S9E": A
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345%$ !%$$**& To send bin(ry outptut in ( response t7e fo;;o=in8 met7od of
2ttpServ;et"esponse m(y be used to 8et t7e (ppropri(te 9riter)Stre(m object
( 8etStre(m
b 8etOutputStre(mc 8et?in(ryStre(m
d 8et9riter
A4S9E": ?
.A"@: %
U40T: T7e Serv;et .ode;
.0 12O01ES: Bes
345%% !6%,$& Study t7e st(tements:
%& Every =eb (pp;ic(tion =it7in ( =eb cont(iner 7(s ( uni>ue context p(t7
#& T7e context p(t7 (nd (ny directories you c7oose to cre(te =it7in it cont(inresources t7(t (re (ccessib;e t7rou87 2TTP+
( On;y st(tement % is true
b On;y st(tement # is true
c ?ot7 % (nd # (re true
d ?ot7 % (nd # (re not true
A4S9E": 1
.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: 4o
345%# !6%G& Bour =eb (pp;ic(tion n(med HF9orsH uses Speci(;.(t7c;(ss T7is is (n
unbund;ed c;(ss (nd is not cont(ined in (ny j(r fi;e
97ere =i;; you eep t7is c;(ss fi;e
8/12/2019 PRJ201_F2013_PT1_239574
4/15
A4S9E": A
.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: Bes
345%+ !6%G$& 97ic7 of t7e fo;;o=in8 is indic(ted by U"/ =7ic7 is used on t7e 0nternetuest
( Trueb F(;se
A4S9E": ?
.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: Bes
345%, !*#$& 97ic7 interf(ce you 1A44OT use to obt(in ( "e>uestDisp(tc7er Objectuest
A4S9E": ?
.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: Bes
345%G !%$%& A!n& CCCCCCC en(b;es ( =eb (pp;ic(tion to obt(in ( 1onnection to ( d(t(b(se
( 9eb server
b D(t(Source
c 4etbe(n
d Ec;ipse
A4S9E": ?.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: Bes
345%6 !%$%+*& 2ost n(mes (re tr(ns;(ted into 0P (ddresses by =eb servers
( True
b F(;se
8/12/2019 PRJ201_F2013_PT1_239574
5/15
A4S9E": ?
.A"@: %
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: Bes
345% !6%,& T7e s(me serv;et c;(ss c(n be dec;(red usin8 different ;o8ic(; n(mes in t7edep;oyment descriptor,,
( True
b F(;se
A4S9E": A
.A"@: $,
U40T: 9eb App;ic(tions (nd T7e 9eb 1ont(iner .ode;
.0 12O01ES: 4o
345%* !6%6$& Study t7e st(tements:
%& U"/ re=ritin8 m(y be used =7en ( bro=ser is dis(b;ed cooies#& 0n U"/ encodin8 t7e session id is inc;uded (s p(rt of t7e U"/
97ic7 is t7e correct option
8/12/2019 PRJ201_F2013_PT1_239574
6/15
.A"@: $,
U40T: Sessions (nd /isteners
.0 12O01ES: 4o
345## !6%G*& T7e session time-out v(;ue is contro;;ed in =7ic7 =(y!s&
8/12/2019 PRJ201_F2013_PT1_239574
7/15
(;; t7e ot7er imp;icit objects6
( re>uest
b response
c p(8e1ontext
d out
e p(8eA4S9E": 1
.A"@: %
U40T: (v(Server P(8es
.0 12O01ES: 4o
345#G !6#6G& SP CCCCCCCCCC ;et you insert (rbitr(ry code into t7e serv;etJs CjspService
met7od !=7ic7 is c(;;ed by service&6666
( script;ets
b dec;(r(tions
c expressions
A4S9E": A.A"@: %
U40T: (v(Server P(8es
.0 12O01ES: Bes
345#6 !%$%& 97ic7 st(tements (re ?EST describe out imp;icit object of jsp fi;euest T7is object is used imp;icit;y =it7 SP expressions (nd (ctions t7(t
insert strin8 content in ( response
b T7is j(v(;(n8Object object represents t7e t7is reference for t7e current SP
inst(nce
c T7is j(v(xserv;etjspP(8e1ontext object 7ides t7e imp;ement(tion det(i;s of t7
under;yin8 serv;et (nd SP cont(iner (nd provides SP pro8r(mmers =it7 (ccess
to t7e imp;icit objects discussed in t7is t(b;e
d T7is object represents t7e response to t7e c;ient T7e object norm(;;y is (n
inst(nce of ( c;(ss t7(t imp;ements 2ttpServ;et"esponse !p(c(8e
j(v(xserv;et7ttp& 0f ( protoco; ot7er t7(n 2TTP is used t7is object is (ninst(nce of ( c;(ss t7(t imp;ements j(v(xserv;etServ;et"esponse
e T7is object represents t7e c;ient re>uest T7e object norm(;;y is (n inst(nce of (c;(ss t7(t imp;ements 2ttpServ;et"e>uest !p(c(8e j(v(xserv;et7ttp& 0f (
protoco; ot7er t7(n 2TTP is used t7is object is (n inst(nce of ( subc;(ss of
j(v(xserv;etServ;et"e>uest
A4S9E": A
.A"@: %
U40T: (v(Server P(8es
.0 12O01ES: Bes
345# !*G$& Bou c(n set ( p(8e to be (n error p(8e eit7er t7rou87 =ebxm; or by (ddin8 (
p(8e directive CCCCC
8/12/2019 PRJ201_F2013_PT1_239574
8/15
( LNp(8e isErrorP(8e5HtrueH NM
b LNp(8e isErrorP(8e5Hf(;seH NM
c LNp(8e errorP(8e5HerrorP(8ejspH NM
A4S9E": A
.A"@: %
U40T: (v(Server P(8es.0 12O01ES: Bes
345#* !6#,& 97ic7 jsp t(8 is needed to ensure t7(t imp;icit v(ri(b;e exception is (v(i;(b;e in
t7e p(8e t7(t is me(nt to be (n error p(8e< !17oose one&
( LN p(8e isErrorP(8e5HtrueHNM
b LNerrorP(8e5HtrueHNM
c LNisErrorP(8e5HtrueHNM
d LN p(8e errorP(8e5Ht7isHNM
A4S9E": A
.A"@: %
U40T: (v(Server P(8es.0 12O01ES: Bes
345+$ !%$%*& 97ic7 st(tements (re ?EST describe p(8e imp;icit object of jsp fi;euest T7is object is used imp;icit;y =it7 SP expressions (nd (ctions t7(t
insert strin8 content in ( response
b T7is j(v(;(n8Object object represents t7e t7is reference for t7e current SPinst(nce
c T7is j(v(xserv;etjspP(8e1ontext object 7ides t7e imp;ement(tion det(i;s of t7under;yin8 serv;et (nd SP cont(iner (nd provides SP pro8r(mmers =it7 (ccess
to t7e imp;icit objects discussed in t7is t(b;e
d T7is object represents t7e response to t7e c;ient T7e object norm(;;y is (n
inst(nce of ( c;(ss t7(t imp;ements 2ttpServ;et"esponse !p(c(8e
j(v(xserv;et7ttp& 0f ( protoco; ot7er t7(n 2TTP is used t7is object is (n
inst(nce of ( c;(ss t7(t imp;ements j(v(xserv;etServ;et"esponse
e T7is object represents t7e c;ient re>uest T7e object norm(;;y is (n inst(nce of (
c;(ss t7(t imp;ements 2ttpServ;et"e>uest !p(c(8e j(v(xserv;et7ttp& 0f (protoco; ot7er t7(n 2TTP is used t7is object is (n inst(nce of ( subc;(ss of
j(v(xserv;etServ;et"e>uest
A4S9E": ?
.A"@: %
U40T: (v(Server P(8es
.0 12O01ES: Bes
345+% !6#& 97ic7 of t7e fo;;o=in8 SP v(ri(b;e is not (v(i;(b;e =it7in ( SP expressionuest
d response
e 7ttpsession
f p(8e
A4S9E": E
.A"@: %U40T: (v(Server P(8es
.0 12O01ES: 4o
345+# !6#*+& 97ic7 of t7e fo;;o=in8 is true st(tement (bout t7e (v(Server P(8e ;ife cyc;euest to ( SP inst(nce
c jspDestroy!& is on;y ever c(;;ed on t7e ;(st re>uest to ( SP inst(nce
d A;; serv;et met7ods (re (ccessib;e from t7e jsp0nit!& met7od
e Bou c(n override or provide ( no-p(r(meter init!& met7od in ( SP p(8eA4S9E": A
.A"@: %
U40T: (v(Server P(8es
.0 12O01ES: Bes
345++ !*,+& 97ic7 is t7e correct se>uence
8/12/2019 PRJ201_F2013_PT1_239574
10/15
345+, !*,G& 97ic7 of t7e fo;;o=in8 is e>uiv(;ent LNQ < !17oose one&%$
( Ljsp:dec;(r(tion
b LN5
c LN
A4S9E": A
.A"@: %U40T: (v(Server P(8es
.0 12O01ES: Bes
345+G !%$%6& 97ic7 st(tements (re ?EST describe contentType (ttribute of LN p(8e
contentType5RNM directiveu(;ified p(c(8e (nd c;(ss n(me
A4S9E": 1
.A"@: %
U40T: SP St(nd(rd Actions ./(nd E/
.0 12O01ES: Bes
345+6 !6#$& A (v(?e(ns component 7(s t7e fo;;o=in8 fie;d:
priv(te boo;e(n en(b;edI
97ic7 p(irs of met7od dec;(r(tions fo;;o= t7e (v(?e(ns st(nd(rd for (ccessin8t7is fie;d
8/12/2019 PRJ201_F2013_PT1_239574
11/15
345+ !6#+& A be(n =it7 ( property co;or is ;o(ded usin8 t7e fo;;o=in8 st(tement
Ljsp:use?e(n id5HfruitH c;(ss5HFruitH)M97(t 7(ppens =7en t7e fo;;o=in8 st(tement is executed Se;ect t7e one correct
(ns=er
Ljsp:setProperty n(me5HfruitH property5HH)M%%
( T7is is incorrect synt(x of Ljsp:setProperty)M (nd =i;; 8ener(te ( compi;(tionerror Eit7er v(;ue or p(r(m must be defined
b A;; t7e properties of t7e fruit be(n (re initi(;iKed to ( v(;ue of nu;;
c A;; t7e properties of t7e fruit be(n (re (ssi8ned t7e v(;ues of input p(r(meters of
t7e SP p(8e t7(t 7(ve t7e s(me n(me
d A;; t7e properties of t7e fruit be(n (re initi(;iKed to ( v(;ue of
A4S9E": 1
.A"@: %
U40T: SP St(nd(rd Actions ./(nd E/
.0 12O01ES: 4o
345+* !6#& 97ic7 of t7e fo;;o=in8 tec7ni>ues =ou;d correct;y put ( be(n into (pp;ic(tionscope< !Bou c(n (ssume t7(t (ny necess(ry p(8e directives (re present (ndcorrect e;se=7ere in t7e SP p(8e&
!17oose one&%%%%
( Ljsp:use?e(n id5H(pp%H c;(ss5H=ebcertc7$6ex(mp$6$%Address?e(nH
scope5H(pp;ic(tionH )M
b LN Address?e(n (b, 5 ne= Address?e(n!&I
p(8e1ontextsetAttribute!H(pp,H (b,&I NM
c Ljsp:use?e(n n(me5H(ppGH c;(ss5H=ebcertc7$6ex(mp$6$%Address?e(nH
scope5H(pp;ic(tionH )M
A4S9E": A
.A"@: %U40T: SP St(nd(rd Actions ./(nd E/
.0 12O01ES: Bes
345$ !6#,& CCCCCCCCCCCCCCCCCCC inc;udes ( st(tic fi;e in ( SP fi;e p(rsin8 t7e fi;es SP
e;ements%%%%%%
( Ljsp:inc;udeM
b inc;ude directive
c import directive
d Ljsp:use?e(nM
e Ljsp:for=(rdM
A4S9E": ?
.A"@: %
U40T: SP St(nd(rd Actions ./(nd E/
.0 12O01ES: Bes
345% !%$%G& 97ic7 st(tements (re ?EST describe n(me (ttribute of Ljsp:setProperty
n(me5R )M (ction
8/12/2019 PRJ201_F2013_PT1_239574
12/15
( T7e 0D of t7e (v(?e(n for =7ic7 ( property !or properties& =i;; be set
b T7e n(me of t7e property to set Specifyin8 HH for t7is (ttribute c(uses t7e SP
to m(tc7 t7e re>uest p(r(meters to t7e properties of t7e be(n
c 0f re>uest p(r(meter n(mes do not m(tc7 be(n property n(mes t7is (ttribute c(n
be used to specify =7ic7 re>uest p(r(meter s7ou;d be used to obt(in t7e v(;ue
for ( specific be(n propertyd T7e v(;ue to (ssi8n to ( be(n property T7e v(;ue typic(;;y is t7e resu;t of ( SP
expression
A4S9E": A
.A"@: %
U40T: SP St(nd(rd Actions ./(nd E/
.0 12O01ES: Bes
345# !*G& 97ic7 2TTP met7od is used in FO". b(sed Aut7entic(tion
8/12/2019 PRJ201_F2013_PT1_239574
13/15
usern(me (nd p(ss=ord to t7e server =it7out (ny encryption< !17oose one&%+%+
( 2TTP ?AS01 Aut7entic(tion
b 2TTP D0'EST Aut7entic(tion
c 1/0E4T-1E"T Aut7entic(tion
A4S9E": A
.A"@: %U40T: Security
.0 12O01ES: Bes
345G !*6,& 97ic7 of t7e fo;;o=in8 e;ement (re re>uired for ( v(;id Lt(8;ibM t(8 in
=ebxm;
( Lt(8;ibCuriM
b Lt(8;ib-;oc(tionM
c Lt(8-uriM
d Lt(8;ib-n(meM
A4S9E": ?
.A"@: %U40T: SP T(8 /ibr(ries
.0 12O01ES: Bes
3456 !6+$& 97ic7 e;ement defined =it7in t7e t(8;ib e;ement of t(8;ib descriptor fi;e isre>uired< Se;ect one correct (ns=er%+%+%+
( T(8
b Description
c V(;id(tor
d 4(me
A4S9E": A
.A"@: %
U40T: SP T(8 /ibr(ries
.0 12O01ES: 4o
345 !6+$6& A SP fi;e uses ( t(8 (s LmyT(8;ib:myT(8M T7e myT(8 e;ement 7ere s7ou;d be
defined in t7e =7ic7 e;ement of t7e t(8;ib e;ement in t7e t(8 ;ibr(ry descriptor
fi;e < %+%+%+
( t(8n(me
b n(me
c t(8
d prefixA4S9E": ?
.A"@: %
U40T: SP T(8 /ibr(ries
.0 12O01ES: 4o
345* !6+%$& 97ic7 SP directive dec;(res t7e us(8e of ( t(8 ;ibr(ry in ( SP p(8e
8/12/2019 PRJ201_F2013_PT1_239574
14/15
b t(8;ibr(ry
c t(8-;ib
d import
e p(8e
A4S9E": A
.A"@: %U40T: SP T(8 /ibr(ries
.0 12O01ES: Bes
345,$ !6+$%& 'iven t7e fo;;o=in8 SP (nd t(8 7(nd;er code =7(t is t7e resu;t of (ccessin8 t7e
SP