Forum: JRuby How to destoy / Invalidate java servlet session

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andres K. (Guest)
on 2009-05-25 16:35
(Received via mailing list)
Hello,

I'm trying do invalidate a java servlet session in an application.
The glassfish (v2) server is configured to use container based auth
which allows us to use the REMOTE_USER request variable.
However I've not yet figured out how to logout :).

The application is configured to use active_record_store for its
sessions.
The app is running on jruby-1.2.0 and jruby-rack-0.9.4.

I've tried to use

    java_session = java.servlet_request.getSession( false )
    java_session.invalidate if java_session

But it errors out giving me "Invalid number of arguments (1 for 0)"

Removing the argument from the getSession and calling invalidate does
not seem to do anything.

Any help would be appreciated,
Regards,

Andres
Nick S. (Guest)
on 2009-05-25 19:53
(Received via mailing list)
On Mon, May 25, 2009 at 7:34 AM, Andres K. 
<removed_email_address@domain.invalid>
wrote:
> I've tried to use
>
>     java_session = java.servlet_request.getSession( false )

Can you try just "servlet_request.getSession(false)" here? I'm not
sure what you're getting with the "java." bit out front.

>     java_session.invalidate if java_session
>
> But it errors out giving me "Invalid number of arguments (1 for 0)"
>
> Removing the argument from the getSession and calling invalidate does not
> seem to do anything.

Looks like a possible method selection bug to me. Could you try with a
more recent JRuby to verify that it hasn't been fixed and then file a
bug at http://jira.codehaus.org/browse/JRUBY?

Thanks,
/Nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Andres K. (Guest)
on 2009-05-26 14:07
(Received via mailing list)
>> I've tried to use
>>
>>     java_session = java.servlet_request.getSession( false )
>>
>
> Can you try just "servlet_request.getSession(false)" here? I'm not
> sure what you're getting with the "java." bit out front.
>
The servlet_request variable is not defined in the controller. The
java.servlet_request part comes from the
jruby-rack kenai page. Maybe the java.servlet_request is only available
in middleware?
> more recent JRuby to verify that it hasn't been fixed and then file a
> bug at http://jira.codehaus.org/browse/JRUBY?
>
I'll give it a go using jruby-1.3-rc1 soon. The strange thing is it
happens with all calls.

  java.servlet_request.getSession().getAttribute( key )

gives me the same error.

Regards Andres
This topic is locked and can not be replied to.