session-id is not consistent for a browsing session when using request params.

10 views
Skip to first unread message

himangshu

unread,
Oct 14, 2010, 7:05:05 AM10/14/10
to Conjure
Hi,
I was trying to display all the contents in session in a view. I found
it inconsistent with the stored data. Hence I resorted to using
session id in request params. A strange thing happened here. The
session id that was automatically appended to tabs and right-menu bar
had entirely different session ids. In order to force-fed the session
id I used a link constructed with {: params {:session-id session-utils/
session-id}}. This was the only way I could display the contents of
the session object.Am I doing something wrong here.

Regards Himangshu

Matthew Courtney

unread,
Oct 15, 2010, 9:00:25 AM10/15/10
to clojure...@googlegroups.com
That doesn't make any sense. Session ids should be the same for all
partial views, unless you're calling them from another thread. Do the
session ids in the tabs and right menu bar look like real session ids?
How is your view called? Is it different from the tabs and right menu
bar partial views?

I'll take a look at it.

-Matt

himangshu hazarika

unread,
Oct 15, 2010, 9:48:35 AM10/15/10
to clojure...@googlegroups.com
Hi Matt,
the site i am developing is a part of test framework for our website. the view is located in the name-space scrape.index.
I am getting a different session-id in the helper links as well as tabs. The session-ids are valid. on manually typing the correct session-id in the url, I am able to access the session objects. I will soon attach as much of the codes as possible after checking with my team lead

Regards
Himangshu 

himangshu

unread,
Oct 23, 2010, 2:57:11 AM10/23/10
to Conjure
Hi Matt
Please find the inline html output

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/
xhtml"><head><meta content="text/html; charset=utf-8" http-
equiv="content-type" /><meta content="en" http-equiv="content-
language" /><meta content="Design/Code: Vit Dlouhy [Nuvio - www.nuvio.cz];
e-mail: vit.d...@nuvio.cz" name="copyright" /><title>On Call
Dashboard</title><meta content="..." name="description" /><meta
content="..." name=="keywords" /><link href="/images/favicon.ico"
rel="icon" type="image/vnd.microsoft.icon" /><link href="./"
rel="index" title="Home" /><link href="/stylesheets/main.css"
media="screen,projection" rel="stylesheet" type="text/css" /><link
href="/stylesheets/print.css" media="print" rel="stylesheet"
type="text/css" /><link href="/stylesheets/aural.css" media="aural"
rel="stylesheet" type="text/css" /><script src="/javascripts/
jquery-1.3.2.min.js" type="text/javascript"></script><script src="/
javascripts/conjure.js" type="text/javascript"></script></head><body
id="www-url-cz"><div class="box" id="main"><div id="header"><h1
id="logo"><img align="center" alt="Conjure Bunny" height="86" src="/
images/conjure96white.png" width="93" />&nbsp;<a href="./" title="On
Call Dashboard [Go to homepage]">On Call Dashboard<span></span></a></
h1><hr class="noscreen" /><div class="noscreen noprint"><p><em>Quick
links: <a href="#content">content</a>,<a href="#tabs">navigation</
a>,<a href="#search">search</a>.</em></p><hr /></div></div><div
class="noprint" id="tabs"><h3 class="noscreen">Navigation</h3><ul
class="box"><li><a href="http://localhost:10000/home/index?session-
id=8477268c54813c09fca28a1da7500d51">Home<span class="tab-l"></
span><span class="tab-r"></span></a></li><li id="active"><a
href="http://localhost:10000/scraper/index?session-
id=418563261d96ceac2be1632951f8a0c4">Scraper<span class="tab-l"></
span><span class="tab-r"></span></a></li></ul><hr class="noscreen" /></
div><div class=="box" id="page"><div class="box" id="page-in"><div
class="box noprint" id="strip"><p id="breadcrumbs">You are here: <a
href="http://localhost:10000/scraper/index?session-
id=406eae6b3e3930afb9db5f58d4650825"><strong>Scraper</strong></a> &gt;
<a href="http://localhost:10000/scraper/index?session-
id=58215eb0b6fe6cfae46db32b1ec35800"><strong>Index</strong></a></p><hr
class="noscreen" /></div><div id="content"><div><div
class="article">&nbsp;&nbsp;&nbsp;</div><script src="/javascripts/
scraper.js" type="text/javascript"></script></div></div><div
class="noprint" id="col"><div id="col-in"><h3><span>Actions</span></
h3><ul id="links"><li><a href="http://localhost:10000/scraper/scrape?
session-id=8bee207dd1a121a64033cb7f4836232e&amp;stage=local">Fresh
Scrape in local</a></li><li><a href="http://localhost:10000/scraper/
scrape?session-
id=7f9e03991f13fa278b51a23ba43d0ba4&amp;stage=prod">Fresh Scrape in
prod</a></li><li><a href="http://localhost:10000/scraper/scrape?
session-id=fadf185b7a21b53eb7af48204701e42e&amp;stage=dev">Fresh
Scrape in dev</a></li></ul><hr class="noscreen" /></div></div></div></
div><div id="footer"><div class="noprint" id="top"><p><span
class="noscreen">Back on top</span><a href="#header" title="Back on
top ^">^<span></span></a></p></div><hr class="noscreen" /><p
id="createdby">created by <a href="http://www.nuvio.cz">Nuvio |
Webdesign</a></p><p id="copyright">&copy; 2007 <a
href="mailto:m...@mail.com">My Name</a></p></div></div></body><script
type="text/javascript">$(document).ready(function () {
$('#add-action-link').hide();
}
)</script></html>

This is the session config file
(ns config.session-config
(:require [conjure.core.model.database-session-store :as database-
session-store]))

(def use-session-cookie false) ; Causes Conjure to save session ids as
cookies. If this is false, Conjure uses a parameter in html.

(def session-store database-session-store/session-store)

This is the helper file
(ns helpers.scraper-helper
(:require [conjure.core.server.request :as request]))

(defn
#^{ :doc "Creates the Scraper links and adds them to the layout info
in request-map." }
scraper-request-map [request-map]
(assoc
request-map
:layout-info
{ :links
[{ :text "Fresh Scrape in local", :url-for
{ :controller :scraper, :action :scrape , :params { :stage
"local"}} }
{ :text "Fresh Scrape in prod", :url-for
{ :controller :scraper, :action :scrape , :params { :stage "prod"}} }
{ :text "Fresh Scrape in dev", :url-for
{ :controller :scraper, :action :scrape , :params { :stage "dev"}} }
]
}))

(defmacro
with-scraper-request-map [& body]
`(request/with-request-map-fn scraper-request-map ~@body))
Regards
Himangshu

On Oct 15, 6:48 pm, himangshu hazarika <hjhazar...@gmail.com> wrote:
> Hi Matt,
> the site i am developing is a part of test framework for our website. the
> view is located in the name-space scrape.index.
> I am getting a different session-id in the helper links as well as tabs. The
> session-ids are valid. on manually typing the correct session-id in the url,
> I am able to access the session objects. I will soon attach as much of the
> codes as possible after checking with my team lead
>
> Regards
> Himangshu
>
> On 15 October 2010 18:30, Matthew Courtney <macourt...@gmail.com> wrote:
>
>
>
>
>
>
>
> > That doesn't make any sense. Session ids should be the same for all
> > partial views, unless you're calling them from another thread. Do the
> > session ids in the tabs and right menu bar look like real session ids?
> > How is your view called? Is it different from the tabs and right menu
> > bar partial views?
>
> > I'll take a look at it.
>
> > -Matt
>

Matthew Courtney

unread,
Oct 24, 2010, 8:31:13 PM10/24/10
to clojure...@googlegroups.com
I was able to reproduce the error, and I just checked in a fix for it
on the master branch. Basically, Conjure wasn't propagating the
temp-session-ids and session-ids properly when using session id
parameters instead of the session id cookie.

If you check out and build Conjure from the github master branch, it
should work just fine. I plan to have a final 0.8 release soon.

-Matt Courtney

Reply all
Reply to author
Forward
0 new messages