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

Reply via email to