CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 How to get the Session Id

Print topic Send  topic

Author Message
fady005


Posts: 115
Posted: 06/20/2007, 8:44 AM

Hello,
Does anyone know how to get the current client session id ? I found several functions (getSessionId(), getIds(),...) but I don't know how to use them in CCS.
The command syntax will be welcome...
Thanks
_________________
Be inventive !
View profile  Send private message
matheus

Posts: 386
Posted: 06/20/2007, 10:08 AM

Something like this you want?

inside a custom event event
e.getPage().getRequest().getRequestedSessionId()


_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
fady005


Posts: 115
Posted: 06/21/2007, 7:11 AM

Yes that's it ! Thanks !
_________________
Be inventive !
View profile  Send private message
eserver220

Posts: 41
Posted: 06/21/2007, 5:37 PM

Add code below to your custom event, you can get anything you want.


HttpServletRequest req = e.getPage().getRequest();
HttpSession sess = req.getSession();
ServletContext ctx = sess.getServletContext();

View profile  Send private message
fady005


Posts: 115
Posted: 06/28/2007, 7:29 AM

Hello,
How do you get the Session Id this way ?
Thanks

EDIT : I found it it's "sess.getId()". Thanks
_________________
Be inventive !
View profile  Send private message
fady005


Posts: 115
Posted: 07/02/2007, 1:17 AM

Hello,
Do somebody know a code that could give a list of all stored variable of the session ?
Thanks
_________________
Be inventive !
View profile  Send private message
matheus

Posts: 386
Posted: 07/02/2007, 5:05 AM

You can get Enumeration of:

sessiongetAttributeNames()

and then get which one value.



_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
fady005


Posts: 115
Posted: 07/03/2007, 6:07 AM

Hello,
I think you meant session.getAttributeNames()
It gives me this :
14:57:20,296 INFO  [STDOUT] CcsLocale  
14:57:20,296 INFO  [STDOUT] style  
14:57:20,296 INFO  [STDOUT] SessionStorage  
14:57:20,296 INFO  [STDOUT] ccs.Authenticator
But how can I get an enumeration of SessionStorage Attributes ?
Thanks
_________________
Be inventive !
View profile  Send private message
matheus

Posts: 386
Posted: 07/03/2007, 10:18 AM

Maybe getValue from SessionStorage attribute listed, return a HashMap.

This HashMap must have all SessionStorage Attributes.
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
fady005


Posts: 115
Posted: 07/04/2007, 4:06 AM

I don't know if I've done something wrong but I get this error :
Quote :
java.lang.NullPointerException
at org.apache.jsp.USR0064_jsp$USR0064PageHandler.beforeUnload(org.apache.jsp.USR0064_jsp:87)
at com.codecharge.components.Page.fireBeforeUnloadEvent(Page.java:641)
at org.apache.jsp.USR0064_jsp._jspService(org.apache.jsp.USR0064_jsp:734)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)

This is my code :
HashMap s = (HashMap) e.getPage().getRequest().getAttribute("SessionStorage");  
Iterator i = s.keySet().iterator();  
while (i.hasNext()){  
	System.out.println(" **"+i.next()+"**");  
}

_________________
Be inventive !
View profile  Send private message
matheus

Posts: 386
Posted: 07/04/2007, 4:48 AM

fady005,

I lokk at class SimpleSessionStorage and it didn't had a hashmap from session variable.

His method is:

  
    public void setAttribute( String name, Object value ) {  
        request.getSession().setAttribute( name, value );  
    }  


So you cannot get SessionStorage Attributes, it's only Session Variable.

Try this again:
session.getAttributeNames()

watch what return.

Then SessionStorage -> setAttribute and watch again.

I think it only exists this you listed before.

Which variable do you want to get?
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
fady005


Posts: 115
Posted: 07/11/2007, 1:06 AM

You're right ! session.getAttributeNames is the right expression to get them.

My problem is somehow a little different... I'm trying to get the Session variable of the main window where my page is a frame.

I found a Frame Java class but it seems that it does not help me...

Do someone know how to get the Session variables from the parent frame ? Thanks...
_________________
Be inventive !
View profile  Send private message
matheus

Posts: 386
Posted: 07/11/2007, 4:46 AM

fady005,

Frame doesn't means different Session. It's the same Session.

_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
fady005


Posts: 115
Posted: 07/11/2007, 6:43 AM

That's what I thought...
The link to my page given by another frame of the page is : {...}/USR0064.jsp;jsessionid=41FBBE2315A1B0C63DC325C86043BA06
and when I use session.getId() in my page I have 964356626AC1586145EC50461DF49507... so different sessions... why ?
_________________
Be inventive !
View profile  Send private message
privatemiao


Posts: 17
Posted: 03/23/2008, 9:21 PM



may be request.getSession().getAttribute("userId");
_________________
me was me
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.