Is it possible to set the session?

2012-01-10 Thread cosmindumy
Hello,
I have 2 questions:
1. I have the situation that if the user press a button an iframe is open.
The problem is that if the user has some settings in browser, the session is
lost. It creates a new session. Is it possible to set the session to iframe? 

2. I've got an error on production server and I cannot reproduce on my
development machine. The error says :
woUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible
org.apache.wicket.WicketRuntimeException: Submit Button
stepTwoUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible

Which can be the cause? The submit button is never hidden, but the container
that holds it. 
I suppose that this is the code where it enters from Form class from wicket
sources :
if (!component.isVisibleInHierarchy())
{
throw new
WicketRuntimeException("Submit Button " +
   
submittingComponent.getInputName() + " (path=" +
   
component.getPageRelativePath() + ") is not visible");
}

Has anyone any idea? 
Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4281720.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Is it possible to set the session?

2012-01-10 Thread Martin Grigorov
On Tue, Jan 10, 2012 at 1:07 PM, cosmindumy  wrote:
> Hello,
> I have 2 questions:
> 1. I have the situation that if the user press a button an iframe is open.
> The problem is that if the user has some settings in browser, the session is
> lost. It creates a new session. Is it possible to set the session to iframe?

See Session.bind(). Call it before as soon as the http session should
be created.

>
> 2. I've got an error on production server and I cannot reproduce on my
> development machine. The error says :
> woUploadFilesContainer:calculateButton
> (path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible
> org.apache.wicket.WicketRuntimeException: Submit Button
> stepTwoUploadFilesContainer:calculateButton
> (path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible
>
> Which can be the cause? The submit button is never hidden, but the container
> that holds it.

Check that any of its parents is not hidden at some point.

> I suppose that this is the code where it enters from Form class from wicket
> sources :
> if (!component.isVisibleInHierarchy())
>                                                        {
>                                                                throw new
> WicketRuntimeException("Submit Button " +
>
> submittingComponent.getInputName() + " (path=" +
>
> component.getPageRelativePath() + ") is not visible");
>                                                        }
>
> Has anyone any idea?
> Thanks!
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4281720.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Is it possible to set the session?

2012-01-10 Thread cosmindumy

See Session.bind(). Call it before as soon as the http session should
be created.

Can you explain a little more what did you mean? 
I tried mySession.bind in method newSession() from MyWebApplication. I don't
know if that's what you mean. 
I'm interested to know if it's possible to pass my application session to
the iframe. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4282241.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Is it possible to set the session?

2012-01-10 Thread Martin Grigorov
iframe shares the same http session with any other url in the app

o.a.w.Session#bind() will create a new http session if it is not
already created.
So create it as soon as you need it and from there on all requests
will share the same http session

On Tue, Jan 10, 2012 at 5:22 PM, cosmindumy  wrote:
>
> See Session.bind(). Call it before as soon as the http session should
> be created.
>
> Can you explain a little more what did you mean?
> I tried mySession.bind in method newSession() from MyWebApplication. I don't
> know if that's what you mean.
> I'm interested to know if it's possible to pass my application session to
> the iframe.
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4282241.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Is it possible to set the session?

2012-01-10 Thread cosmindumy

Martin Grigorov-4 wrote
> 
> iframe shares the same http session with any other url in the app
> 
> That's right.It works fine on normal cases. But if I set " Block sites
> from setting any data" and "Block third-party cookies from being set" when
> it opens the iframe it creates a new session, finding the old one null. So
> I loose all the informations put on session. 
> 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4282292.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Is it possible to set the session?

2012-01-11 Thread cosmindumy
Hi,
It would be enough for me if I could get session by id. Is there a
possibility?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4284724.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread Chris Colman
Did you wan to get or set the session? Your subject said 'set' but the
body asked about 'get'.

>Hi,
>It would be enough for me if I could get session by id. Is there a
>possibility?
>
>--
>View this message in context: http://apache-
>wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-
>tp4281720p4284724.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org


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



RE: Is it possible to set the session?

2012-01-11 Thread cosmindumy

Did you wan to get or set the session? Your subject said 'set' but the
body asked about 'get'.

It would be awesome  if I could set the session with a given one. But it is
an option to get the session by id, as I have some informations on the
session and I want to access them. 
The problem is that if I block third party cookies the iframe I open creates
a new session.  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285130.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
Hello,

Maybe pass the sessionid in the url like a query parameter to the page you
open in an iframe and then read the url parameter and return from that page
a response with a JSESSIONID header equal to the value of the session.
Subsequent requests to the page in the iframe will have this sessionid. 

However using the same session could cause problems with the PageMap? Not
sure about this as it probably should be the same as opening  the
application in two browser windows.

I'd rather go for storing the information that must be shared in a cache/map
and pass around as an url parameter the key to lookup in the cache but since
I don't know the full story...

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285158.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread Chris Colman
I had the exact same 'can I SET the session' requirement today. I
thought of dealing with search engine crawlers and their stateless view
of the site by assigning the same session instance to each request from
a given crawler to avoid creating a new session for every request they
made.

Well I achieve one session per search engine now but it relies on
jsessionid which I'm trying to avoid using when a search engine is
crawling the site. (jsessionid will still work for uses who have cookies
turned off).

>-Original Message-
>From: cosmindumy [mailto:cosmind...@yahoo.com]
>Sent: Wednesday, 11 January 2012 10:35 PM
>To: users@wicket.apache.org
>Subject: RE: Is it possible to set the session?
>
>
>Did you wan to get or set the session? Your subject said 'set' but the
>body asked about 'get'.
>
>It would be awesome  if I could set the session with a given one. But
it is
>an option to get the session by id, as I have some informations on the
>session and I want to access them.
>The problem is that if I block third party cookies the iframe I open
>creates
>a new session.
>
>--
>View this message in context: http://apache-
>wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-
>tp4281720p4285130.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org


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



RE: Is it possible to set the session?

2012-01-11 Thread cosmindumy
This was the first solution. I tried to give the session id as a parameter to
the iframe. I tought it's enough and the framework will do the rest. It
didn't work.
 You said that I have to "return from that page a response with a JSESSIONID
header equal to the value of the session." . 
Can you explain a little bit more detailed? Maybe a sketch of code. Where
should this be done? Do I have to override a method? I didn't understand
how. 
Thanks. 
By the way, are you from Romania? 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285272.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
Hi Cosmin,
What have you tried? 
Sending 1. .../frame_page;jsessionid=123 or 2.
.../frame_page?jsessionid=123.
The first option may work while the second it's normal not to have any
impact on the session but can be used to get the sessionid as a parameter.

The 1. option if it works, is not really fullproof, as from my experience if
the user already has a JSESSIONID cookie, the value in the cookie takes
precedence so the user will come in the frame page with an old sessionid,
but it's simplest.

And since you say that we cannot set cookies for the frame, I'm thinking the
solution is to set the sessionid cookie "manually" by adding it to the
response from the frame. Since this first request will not have a session
created, we need to force the browser to reload the page/redirect to another
page after we set the session cookie, and the new request will have the
required session with it:

So I'm saying in your frame page page you do something like

FramePage extends WebPage {
...

getRequestCycle().scheduleRequestHandlerAfterCurrent(new
RedirectRequestHandler("/page_to_redirect_after_set_session") {
@Override
public void respond(IRequestCycle requestCycle) {

WebResponse response =
(WebResponse)requestCycle.getResponse();
String sessionId =
getRequest().getQueryParameters().getParameterValue("sessionId").toString();
Cookie cookie = new Cookie("JSESSIONID", sessionId);
cookie.setMaxAge(-1);

response.addCookie(cookie);
super.respond(requestCycle);
}
});
}

Take care that if you decide on throwing RestartResponseException instead it
does a restart of the old response so your addCookie command will be lost.

Firebug is a great tool that helps you in this, as you will need to look on
the response for Set-Cookie with JSESSIONID response from the frame page.


PS: Yes, I'm from Romania.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285390.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread cosmindumy
Hi again,
Thanks for your replay and for your time to write the code.
But I didn't understand why to do a redirect from iframe page. Which is
"/page_to_redirect_after_set_session"? I don't want any redirect from my
iframe page. And where should I put that code? In constructor?
And secondary, I use wicket1.4.8 and there is no method
"scheduleRequestHandlerAfterCurrent". What can I use instead?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285622.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
You need two requests because in the first one you don't have yet have any
session attached to the request you make to the server. And the server
response will just be to attach JSESSIONID cookie and tell the browser to
repeat the first request with the JSESSION cookie attached(you can redirect
to the same page or another). So now this new request has the sessionid you
require.

In 1.4 I think you can throw a RedirectToUrlException but take a look at
what/how it does it because I see it extends
AbstractRestartResponseException and if you set the cookie before you throw
it, I'm pretty sure it will reset the addCookie method from the response, so
you may have to override it. 

Again firebug will show you if the cookie was set or not.



-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285767.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-12 Thread cosmindumy
Hi again, 
It worked with ..;jsessionid=43423?param1=value1...;
But now I want to do the same think when I use "setResponsePage(my page)".
So now I should use the programatically method that you said to override
respond method. But now I don't have a link. 
Do you have idea wich class should I use?
Thanks. 
P.S Sorry for being so insistent but I am quite new in wicket.   



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4288412.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-13 Thread cosmindumy
Hi,
I solved the problem. Thanks for your idea. 
Now I have another problem that is a little off topic. The problems occurs
only in Internet Explorer. I send a url with some parameters. But when I
construct the respective wicket page, the parameters are emty. They are lost
somewhere.  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4292045.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Is it possible to set the session?

2012-01-13 Thread cosmindumy
Hi,
I solved the problem. Thanks for your idea.
Now I have another problem that is a little off topic. The problems occurs
only in Internet Explorer. I send a url with some parameters. But when I
construct the respective wicket page, the parameters are emty. They are lost
somewhere.   
Do you have any idea? 
Thanks. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4292048.html
Sent from the Users forum mailing list archive at Nabble.com.

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