Hi Vincent,
I am using the URLConnection method instead of opening a browser and calling
the servlet URL. Per assumption 3 under the Architect link. I did the
URLConnection because I didn't understand how opening a browser and calling
servlet URL was supposed to link the code in my test case and the code I was
trying to test (ie client/server). Maybe you can better explain how I am
supposed to use the servlet URL though the browser.
Carissa
-----Original Message-----
From: Vincent Massol [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 18, 2001 11:16 AM
To: [EMAIL PROTECTED]
Subject: Re: [cactus]ServletContext
Hi Carissa,
I'm not sure I understand your question and what you are trying to achieve.
For a start I don't understand why you create an HTTP connection in your
beginXXX() method ... ? This is supposed to be done for you by Cactus itself
...
Also, check
http://jakarta.apache.org:8080/jyve-faq/Turbine/screen/DisplayQuestionAnswer
/action/SetAll/project_id/2/faq_id/39/topic_id/211/question_id/807 as it
might help.
Thanks
Vincent.
----- Original Message -----
From: "Paus, Carissa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 15, 2001 3:03 PM
Subject: [cactus]ServletContext
> Does anyone know how to pull out the servlet context using cactus? I am
> using the URLConnection method. My client is connecting to the server
just
> fine and the ServletRedirector is getting kicked off (init) on the server
> side great. The problem that I am not sure how to get out the servlet
> config. The current way I am trying is giving me a NullPointerException.
> See example code below:
>
> public void beginXXX( ServletTestRequest servlet )
> {
> try
> {
> System.out.println( "Starting begin" );
> System.out.println( "Setting up URL" );
> URLConnection connect;
> URL open = new URL( "http", "Some IP", Some Port,
>
> "org.apache.commons.cactus.server.ServletTestRedirector");
>
> System.out.println( "Calling openConnection" );
> connect = open.openConnection();
>
> System.out.println( "Setting values on connect" );
> connect.setAllowUserInteraction( true );
> connect.setDoInput( true );
> connect.setDoOutput( true );
> //connect.setIfModifiedSince();
> connect.setUseCaches( true );
>
> System.out.println( "Calling connect" );
> connect.connect();
>
> protected void setUp()
> {
> try
> {
> //I instantiate an inner class and then try to set some
> member variables
>
> System.out.println( "Setting ServletContext" );
> //This is the line that causes the NullPointerException
> //Where can I get this from?
> info.servletContext = config.getServletContext();
> }
> }
>
> public void testExecuteActivity()
> {
>
> //Do some stuff
> }
>
> Thanks
>
> Carissa
>