jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karthik Guru <karthik_guru2...@yahoo.com>
Subject Regarding BUG: 17933 (FormAuthentication assumes "localhost" when adding cookies )
Date Fri, 01 Aug 2003 13:10:48 GMT

Hi,

This is regarding the bug listed here.

http://issues.apache.org/bugzilla/show_bug.cgi?id=17933

I was trying to fix it .

File: FormAuthentication.java
Method:

public void configure(WebRequest theRequest,
        Configuration theConfiguration);


I guess i can get the context URL set in the
cactus.properties file this way 
String contextURL = theConfiguration.getContextURL();

Now can i do a substring operation to extract the
domain name from the context URL and call

theRequest.addCookie(domainName,this.sessionIdCookieName,
this.sessionId);

I mean does cactus have some utility methods /
something that knows how to extract the domain name
properly from the contextURL?

I just want to make sure that i'm doing the right
thing in a right way.

I guess we can also do 

webRequest.setURL() when using FormAuthentication;

if that is the case, i guess , I can extract the
domain/host name using ServletURL.getHost()

So what s'd i be doing in the implementation  
FormAuthentication::configure()?

1. Do substring on contextURL OR
2. ServletURL.getHost()

OR try doing 1) and if it fails do 2)

Hope am not bugging the cactus commiters too much
here.

thanks,
karthik

--- Sachin <csachin@pisoftek.com> wrote:
> Hi All,
>         I am trying to write TestCase of example
> Specified in StrutsTestCase
> which says that we can use both CactusStrutsTestCase
> or MockStrutsTestCase..
> 
> But when i am trying to run it it is giving error
> like this..
> 
> 
>  [main] INFO util.PropertyMessageResources  -
> Initializing,
> config='org.apache.struts.util.LocalStrings',
> returnNull=true
>  [main] INFO util.PropertyMessageResources  -
> Initializing,
> config='org.apache.struts.action.ActionResources',
> returnNull=true
> 
> Time: 0.625
> There was 1 failure:
> 1)
>
testAction(logic.struts.actions.TestFirstAction)junit.framework.AssertionFai
> ledError: Error running action.perform(): class
> java.lang.NullPointerException - null
> 	at
>
servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:
> 339)
> 	at
>
logic.struts.actions.TestFirstAction.testAction(TestFirstAction.java:47)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 	at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> 	at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 	at
>
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
> 
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> 
> Process terminated with exit code -1
> 
> 
> 
> 
> My Code is
> 
> 
> package logic.struts.actions;
> 
> import servletunit.struts.MockStrutsTestCase;
> import servletunit.struts.CactusStrutsTestCase;
> 
> import javax.servlet.ServletException;
> 
> public class TestFirstAction extends
> MockStrutsTestCase{
> 
>     public TestFirstAction(String testName) {
> super(testName); }
> 
>     public void testAction() {
>        setRequestPathInfo("/firstAction");
>        actionPerform();
>        verifyForward("second");
>     }
> 
>     public void setUp() throws Exception {
>         super.setUp();
>     }
> 
>     protected void tearDown() throws Exception {
>         super.tearDown();
>     }
> 
> }
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> cactus-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Mime
View raw message