Storing ServletContext attribute

Oliver Schrenk <[email protected]> Tue, 15 Dec 2009 17:59:41 +0100
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
--===============3827982700505302185==
Content-Type: multipart/alternative; boundary=001517475742e906d4047ac75091

--001517475742e906d4047ac75091
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I'm almost sure that I'm overlooking something but I'm searching for a way
to store a ServletContext attribute and can't find it.

I have to test a servlet which depends on

Object o = getServletContext().getAttribute("object");

Right now im just calling

ServletRunner sr = new ServletRunner();
sr.registerServlet("ServletName", Servlet.class.getName())
ServletUnitClient sc = sr.newClient();
WebRequest request = new GetMethodWebRequest("
http://localhost:80/ServletName");

        try {
            request.setParameter("param", "value");
            WebResponse response = sc.getResponse(request);

            [...]

How would I inject the needed attribute?

Thanks
Oliver Schrenk

--001517475742e906d4047ac75091
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<br><br>I&#39;m almost sure that I&#39;m overlooking something but I&#39=
;m searching for a way to store a ServletContext attribute and can&#39;t fi=
nd it.<br><br>I have to test a servlet which depends on <br><br>Object o =
=3D getServletContext().getAttribute(&quot;object&quot;);<br>
<br>Right now im just calling<br><br>ServletRunner sr =3D new ServletRunner=
();<br>sr.registerServlet(&quot;ServletName&quot;, Servlet.class.getName())=
<br>ServletUnitClient sc =3D sr.newClient();<br>WebRequest request =3D new =
GetMethodWebRequest(&quot;<a href=3D"http://localhost:80/ServletName">http:=
//localhost:80/ServletName</a>&quot;);<br>
=A0=A0=A0 =A0=A0=A0 <br>=A0=A0=A0 =A0=A0=A0 try {<br>=A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 request.setParameter(&quot;param&quot;, &quot;value&quot;);<br>=
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 WebResponse response =3D sc.getResponse(reque=
st);<br><br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 [...]<br><br>How would I inject t=
he needed attribute?<br>
<br>Thanks<br>Oliver Schrenk<br><br>

--001517475742e906d4047ac75091--


--===============3827982700505302185==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
--===============3827982700505302185==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop

--===============3827982700505302185==--