You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Michael Gustav Simon <mg...@gmail.com> on 2006/02/08 18:04:51 UTC
Back- and forward browser functionality
Hello j2-community,
i have a question about the never ending http stateless problem.
How can I prevent the right state, if an user uses the browser back-
or forward button?
Example:
If I set a portlet in the edit mode, use the back button and after
reload the page the portlet is in the edit mode again!
mgsimon
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Michael Gustav Simon z 2006-02-08 18:45 brzmiala:
> No, not realy,
> But if I use the back button I am on the same page!
Yes, now I see what you mean. Maybe you should try with "Cache-Control"
header? Or something like meta-tags:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
Or some javascript-cookie control?
--
pozdrawiam,
Jacek Wislicki
jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Michael Gustav Simon <mg...@gmail.com>.
No, not realy,
But if I use the back button I am on the same page!
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Michael Gustav Simon z 2006-02-10 07:41 brzmiala:
> It seems to be a workaround,
> I think this depends on the client.
> Maybe one user deactivates javascript,
> the other user comes with the exotic browser lynx or WML ... a.s.o. :-)
Right. Rather unusual, but possible. But you can always try to detect if
JS is enabled. In not, perform some redirect or display appropriate message.
--
pozdrawiam,
Jacek Wislicki
jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Michael Gustav Simon <mg...@gmail.com>.
It seems to be a workaround,
I think this depends on the client.
Maybe one user deactivates javascript,
the other user comes with the exotic browser lynx or WML ... a.s.o. :-)
The easiest solution is to set page caching either by sending HTTP
> headers with a servlet response:
> response.setDateHeader("Expires", -1);
> response.setHeader("Cache-Control", "no-store, no-cache,
> must-revalidate, max-stale=0, max-age=0, post-check=0, pre-check=0");
> response.setHeader("Pragma","no-cache");
> or adding equivalent meta tags in the page's head section:
> <meta http-equiv="Expires" content="0">
> <meta http-equiv="Cache-Control" content="no-store, no-cache,
> must-revalidate, max-stale=0, max-age=0, post-check=0, pre-check=0">
> <meta http-equiv="Pragma" content="no-cache">
>
> To completely block "back" action, you should also add a JavaScript call
> in the head section:
> <script>javascript:window.history.forward(1);</script>
> This should work, I hope.
>
> I'm not sure if meta tags are really equivalent to sending headers (they
> should be as far as I know). I've tested it with some simple servlet and
> they worked different from headers :/ Maybe I made some mistake, I don't
> know...
>
> --
> pozdrawiam,
> Jacek Wislicki
>
> jacek.wislicki@gmail.com
> tel.: +48 502 408 444
> gg: 2540358
> skype: jacek_wislicki
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
Re: Back- and forward browser functionality
Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Jacek Wiślicki z 2006-02-08 19:41 brzmiala:
> I gave it a look. The problem becomes quite dangerous if a user logs-out
> and leaves a browser window opened (tested with IE, Firefox and Opera).
> Using history back retrieves all the previous pages. For example, if one
> with some admin/manager priviledges leaves some fragment in edit mode
> befor logging-out, the edition is still possible... Also access to all
> administrative fragments is possible, provided their pages are in the
> history (their actions rather wouldn't work, but the data is viewable).
>
> I'll try to see if the problem can be resolved on HTTP level, but it's
> hard to say when.
The easiest solution is to set page caching either by sending HTTP
headers with a servlet response:
response.setDateHeader("Expires", -1);
response.setHeader("Cache-Control", "no-store, no-cache,
must-revalidate, max-stale=0, max-age=0, post-check=0, pre-check=0");
response.setHeader("Pragma","no-cache");
or adding equivalent meta tags in the page's head section:
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-store, no-cache,
must-revalidate, max-stale=0, max-age=0, post-check=0, pre-check=0">
<meta http-equiv="Pragma" content="no-cache">
To completely block "back" action, you should also add a JavaScript call
in the head section:
<script>javascript:window.history.forward(1);</script>
This should work, I hope.
I'm not sure if meta tags are really equivalent to sending headers (they
should be as far as I know). I've tested it with some simple servlet and
they worked different from headers :/ Maybe I made some mistake, I don't
know...
--
pozdrawiam,
Jacek Wislicki
jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Aaron Evans z 2006-02-08 19:10 brzmiala:
> This relates to our discussion around render parameters (see thread "How to
> clear RenderParameters set in action ?"). In that discussion, users found it
> strange that if a portlet had certain render parameters set, then if the user
> navigates to a different portal page and then back again, the render parameters
> were still set.
>
> To me it makes perfect sense. Say I have a render parameter called FLASH_MODE
> and the values can be true or false indicating that the portlet will be
> rendered using flash elements. I provide a linke that the user can use
> to turn off flash. Just because they navigate away from the page and then
> come back does not mean I am going to show them the flash view again. However
> this example might instead be considered a user preference, but whatever. Even
> then, I might use the user preference to determine a render parameter.
>
> This behaviour is correct as far as the portlet spec goes. Render parameters
> retain their values until another action URL targetting the same portlet is
> invoked.
>
> However, jetspeed provides a way via configuration to alter this behaviour.
>
> The difference here is that we are talking about a portlet mode rather than
> a render parameter.
>
> So the question becomes, should portlet modes and window states behave like
> render parameters (ie. keep their states until another action URL targetting
> the given portlet is invoked). Intuition tells me yes. The fact that they
> are a "state" and "mode" also tells me yes.
>
> However, I have not found anything in the portlet spec (although I haven't
> looked that thoroughly) to suggest that they must behave in this way. If
> someone else finds a definitive answer one way or the other, please speak up.
>
> I did find this (PLT.12.2.2 Portlet Modes and Window State Changes):
>
> "Portlets cannot assume that subsequent renders will be called in the set
> portlet mode or window state as the portal/portlet-container could override
> these changes."
>
> Sounds pretty ambiguous if you ask me.
>
> Like render parameters you of course wouldn't want the window state or mode to
> change on subsequent render requests while on the same page. Another reason
> why I think they would behave in the same manner.
>
> However, *unlike* render parameters, a window state or portlet mode doesn't
> get "cleared" like render parameters do if a portlet action URL is called. But
> that only tells me that they hold their state to a greater extent than render
> parameters.
>
> Thoughts?
I gave it a look. The problem becomes quite dangerous if a user logs-out
and leaves a browser window opened (tested with IE, Firefox and Opera).
Using history back retrieves all the previous pages. For example, if one
with some admin/manager priviledges leaves some fragment in edit mode
befor logging-out, the edition is still possible... Also access to all
administrative fragments is possible, provided their pages are in the
history (their actions rather wouldn't work, but the data is viewable).
I'll try to see if the problem can be resolved on HTTP level, but it's
hard to say when.
--
pozdrawiam,
Jacek Wislicki
jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Aaron Evans <aa...@yahoo.ca>.
Jacek Wiślicki <jacek.wislicki <at> gmail.com> writes:
>
> Wiadomosc od Michael Gustav Simon z 2006-02-08 18:04 brzmiala:
>
> > Hello j2-community,
> > i have a question about the never ending http stateless problem.
> > How can I prevent the right state, if an user uses the browser back-
> > or forward button?
> >
> > Example:
> > If I set a portlet in the edit mode, use the back button and after
> > reload the page the portlet is in the edit mode again!
> The portlet rememners its state/mode when you move between different
> portal pages. Is it wrong?
>
This relates to our discussion around render parameters (see thread "How to
clear RenderParameters set in action ?"). In that discussion, users found it
strange that if a portlet had certain render parameters set, then if the user
navigates to a different portal page and then back again, the render parameters
were still set.
To me it makes perfect sense. Say I have a render parameter called FLASH_MODE
and the values can be true or false indicating that the portlet will be
rendered using flash elements. I provide a linke that the user can use
to turn off flash. Just because they navigate away from the page and then
come back does not mean I am going to show them the flash view again. However
this example might instead be considered a user preference, but whatever. Even
then, I might use the user preference to determine a render parameter.
This behaviour is correct as far as the portlet spec goes. Render parameters
retain their values until another action URL targetting the same portlet is
invoked.
However, jetspeed provides a way via configuration to alter this behaviour.
The difference here is that we are talking about a portlet mode rather than
a render parameter.
So the question becomes, should portlet modes and window states behave like
render parameters (ie. keep their states until another action URL targetting
the given portlet is invoked). Intuition tells me yes. The fact that they
are a "state" and "mode" also tells me yes.
However, I have not found anything in the portlet spec (although I haven't
looked that thoroughly) to suggest that they must behave in this way. If
someone else finds a definitive answer one way or the other, please speak up.
I did find this (PLT.12.2.2 Portlet Modes and Window State Changes):
"Portlets cannot assume that subsequent renders will be called in the set
portlet mode or window state as the portal/portlet-container could override
these changes."
Sounds pretty ambiguous if you ask me.
Like render parameters you of course wouldn't want the window state or mode to
change on subsequent render requests while on the same page. Another reason
why I think they would behave in the same manner.
However, *unlike* render parameters, a window state or portlet mode doesn't
get "cleared" like render parameters do if a portlet action URL is called. But
that only tells me that they hold their state to a greater extent than render
parameters.
Thoughts?
aaron
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Back- and forward browser functionality
Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Michael Gustav Simon z 2006-02-08 18:04 brzmiala:
> Hello j2-community,
> i have a question about the never ending http stateless problem.
> How can I prevent the right state, if an user uses the browser back-
> or forward button?
>
> Example:
> If I set a portlet in the edit mode, use the back button and after
> reload the page the portlet is in the edit mode again!
The portlet rememners its state/mode when you move between different
portal pages. Is it wrong?
--
pozdrawiam,
Jacek Wislicki
jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org