Ha! Good catch, and annoying.

For anyone who hasn't addressed this, when I'm in apache fronted
tomcat I use a rewrite rule in apache to make sure everything goes to
the www. url...

I suppose you could also do the same thing in a Tapestry request filter.

Josh

On Wed, Jun 29, 2011 at 9:35 AM, Tim Koop <t...@timkoop.com> wrote:
> I'm replying to this somewhat old thread just to say that I have found the
> problem.
>
> The problem was that I had stored something as a SessionState Object (SSO),
> then I forwarded the user to another website to do some authentication which
> forwarded the user back to my site.  But when the user came back to me site,
> the SSO was null.  Correction:  it was /sometimes/ null.  Sometimes it
> worked fine.
>
> Why was that?  After much scratching of my head I found the answer, and it
> was a very simple answer.  The URL of the site I was originally on didn't
> have the "www." in front of it.  But when the authenticating site forwarded
> the user back to my site, it used the URL with "www." in front, thus causing
> it to be a different site with different cookies, thus a different session
> id, and thus different SSOs.
>
> Thank you to this great community for good suggestions.
>
>
> Tim Koop
> t...@timkoop.com <mailto:t...@timkoop.com>
> www.timkoop.com <http://www.timkoop.com>
>
>
> On 11/05/2011 2:17 PM, Tim Koop wrote:
>>
>> Well, I just tried checking the session id like this, and it is in fact
>> the same after coming back.  And the SessionState objects started working
>> too!
>>
>> So then I took out this session id code, and the SessionState objects are
>> still working.
>>
>> So now it's all working fine, and I am left scratching my head wondering
>> why.
>>
>> Thank you both for your ideas.  Maybe something fixed it, but I don't know
>> what.
>>
>>
>> Tim Koop
>> t...@timkoop.com <mailto:t...@timkoop.com>
>> www.timkoop.com <http://www.timkoop.com>
>>
>> On 11/05/2011 1:33 PM, Josh Canfield wrote:
>>>
>>> Are you sure you're getting the same session when you come back to the
>>> page? try dumping the session id.
>>>
>>>
>>>     @Inject
>>>     private HttpServletRequest request;
>>>
>>>     void onActivate() {
>>>         final HttpSession session = request.getSession(false);
>>>         log.debug(session == null ? "Null session" : ("Session Id: " +
>>> session.getId()));
>>>     }
>>>
>>> Josh
>>>
>>> On Wed, May 11, 2011 at 11:17 AM, Tim Koop<t...@timkoop.com>  wrote:
>>>>
>>>> Thanks Josh (and Thiago).
>>>>
>>>> I added (create = false), and this certainly got rid of the error
>>>> message.
>>>>
>>>> However, my session object is still either not getting set correctly
>>>> (even
>>>> though I clearly visit the page where it gets set, and I even write a
>>>> message to the log saying I was there), or it isn't being retrieved
>>>> correctly, because it is null when I want to read it.
>>>>
>>>> My only thought is this:  On the page where I set the session object,
>>>> that
>>>> page returns a java.net.URL object, redirecting the browser to another
>>>> page.
>>>>  Perhaps this is preventing the session object from being stored
>>>> correctly?
>>>>
>>>> And no, I don't plan to actually use a String as a SessionState Object.
>>>>  I'm
>>>> just testing with it.
>>>>
>>>> Thanks.
>>>>
>>>> Tim Koop
>>>> t...@timkoop.com<mailto:t...@timkoop.com>
>>>> www.timkoop.com<http://www.timkoop.com>
>>>>
>>>> On 11/05/2011 12:39 PM, Josh Canfield wrote:
>>>>>
>>>>>
>>>>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/annotations/SessionState.html
>>>>>
>>>>> Specifically:
>>>>>
>>>>> public abstract boolean create
>>>>> If true (the default), then referencing an field marked with the
>>>>> annotation will create the SSO. If false, then accessing the field
>>>>> will not create the SSO, it will only allow access to it if it already
>>>>> exists.
>>>>> Default:
>>>>> true
>>>>>
>>>>>
>>>>> This thread might be helpful.
>>>>>
>>>>>
>>>>> http://tapestry.1045711.n5.nabble.com/SessionState-for-simple-types-td2839381.html
>>>>> or this one
>>>>> http://tapestry.1045711.n5.nabble.com/SessionState-error-td2432233.html
>>>>>
>>>>>
>>>>> Josh
>>>>>
>>>>> On Wed, May 11, 2011 at 10:01 AM, Tim Koop<t...@timkoop.com>    wrote:
>>>>>>
>>>>>> I'm having a little problem with even a simple SessionState String
>>>>>> object.
>>>>>>
>>>>>> On one page I have this:
>>>>>>
>>>>>>    @SessionState
>>>>>>    private String userColour;
>>>>>>    ...
>>>>>>    userColour = "red";
>>>>>>
>>>>>>
>>>>>> Then on a subsequent page I have this:
>>>>>>
>>>>>>    @SessionState
>>>>>>    private String userColour;
>>>>>>    ...
>>>>>>    System.out.println("colour is " + userColour);
>>>>>>
>>>>>>
>>>>>> But instead of printing "red", the page throws the following error.
>>>>>>  It
>>>>>> looks to me like it is trying to recreate the String object from a
>>>>>> fancy
>>>>>> constructor.  But it isn't supposed to recreate the object, is it?
>>>>>>  Isn't
>>>>>> is
>>>>>> supposed to store the object in memory just the way it is without
>>>>>> recreating
>>>>>> it with a constructor?
>>>>>>
>>>>>>
>>>>>>  An unexpected application exception has occurred.
>>>>>>
>>>>>>   * org.apache.tapestry5.runtime.ComponentEventException
>>>>>>     Error invoking constructor java.lang.String(byte[], int, int, int)
>>>>>>     (at String.java:337) (for service 'ApplicationStateManager'): No
>>>>>>     service implements the interface [B.
>>>>>>
>>>>>>     context
>>>>>>
>>>>>>     eventType
>>>>>>         activate
>>>>>>
>>>>>>   * org.apache.tapestry5.ioc.internal.OperationException
>>>>>>     No service implements the interface [B.
>>>>>>
>>>>>>     trace
>>>>>>             o Triggering event 'activate' on login/OpenId
>>>>>>             o Instantiating instance of SSO class java.lang.String
>>>>>>             o Determining injection value for parameter #1 (byte[])
>>>>>>             o Resolving object of type byte[] using
>>>>>> MasterObjectProvider
>>>>>>
>>>>>>   * java.lang.RuntimeException
>>>>>>     No service implements the interface [B.
>>>>>>
>>>>>>     Hide uninteresting stack frames Stack trace
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:665)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:45)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:56)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:41)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:806)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:50)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:233)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:60)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:273)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:277)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForConstructor(InternalUtils.java:248)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:56)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$4.invoke(ServiceResourcesImpl.java:160)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.autobuild(ServiceResourcesImpl.java:146)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl$1.create(ApplicationStateManagerImpl.java:104)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.getOrCreate(SessionApplicationStatePersistenceStrategy.java:57)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.get(SessionApplicationStatePersistenceStrategy.java:44)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter.getOrCreate(ApplicationStateManagerImpl.java:50)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl.get(ApplicationStateManagerImpl.java:133)
>>>>>>
>>>>>>             o
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.transform.ApplicationStateWorker$1.get(ApplicationStateWorker.java:91)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Tim Koop
>>>>>> t...@timkoop.com<mailto:t...@timkoop.com>
>>>>>> www.timkoop.com<http://www.timkoop.com>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to