• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting forum context (user session) from jsp files

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am adding some jsp pages to extend some parts of JForum (2.1.8) - I am trying to access all the users session information (username, etc) a logged in session just has Threadstracked and logged 1 in it - so I need to get the execution context and session context etc (I am unclear at to what problems this topology solves...)

I am calling:

and I get the following NPE.


from the source:



userData appears to be null...

I guess this isn't so much a bug as I am doing the wrong thing.

I would like to access the users session from jsp pages outside of the /forum/ context (my app context is mapped to root, which redirects to /forum/xxx.page)

What is the correct way of getting the session information of a user / logged in / logged out, and at least, displaying their username...
[originally posted on jforum.net by jforumapp]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, AFAIK, there is no easy way to do what you want.

jForum's security is specific to the *.page calls (which use the jForum servlet to define the security context). It is not designed to be a security mechanism for JSP files in the same webapp as jForum or in another webapp.

But, FWIW, it can use other globlal security mechanisms via SSO. Given that you have two separate web apps (the Root webapp and the jForum webapp) with the need to have SSO between them, I suggest looking at third party SSO solutions (like Tomcat's J2EE security based SSO solution).

[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just want to access the session... nothing more. I can tell they are logged in - but not who they are, I just need the string.

Now, I guess because it looks for the context to do certain things, doesn't mean I can't write a new method that just grabs the session tied to the request (without a forum context?) and returns a value?

Otherwise, looking at .page and a freemarker solution, what is a 'hello world' implementation:

helloworld.page

That will grab the context, pull in the session, and just <# if logged > lolcats ${session.username} <# else > no lulz <#end if>

Not sure of the syntax, but that is something I am looking to do.

Thanks for any help you can offer, even if you just point me to a simple and useful existing page and how it is mapped..

monroe wrote:Sorry, AFAIK, there is no easy way to do what you want.

jForum's security is specific to the *.page calls (which use the jForum servlet to define the security context). It is not designed to be a security mechanism for JSP files in the same webapp as jForum or in another webapp.

But, FWIW, it can use other globlal security mechanisms via SSO. Given that you have two separate web apps (the Root webapp and the jForum webapp) with the need to have SSO between them, I suggest looking at third party SSO solutions (like Tomcat's J2EE security based SSO solution).


[originally posted on jforum.net by jforumapp]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using a .page file, you will need to work within the jForum MCV model. That means that the URL will have to include a module and an action that points to some "Controller" code... which then generally points to a Freemarker Template "View".

See this http://www.jforum.net/posts/list/4159.page#17143 post for the basics on how jForum maps *.page requests to code. This should get you pointed in the right direction.


[originally posted on jforum.net by monroe]
 
reply
    Bookmark Topic Watch Topic
  • New Topic