Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Thomas Singer
No one knows what's wrong?

Tom


Thomas Singer wrote:
 OK, I've tried to create an unversioned page to keep the URL stable using 
 following page code:
 
 public class DownloadFile extends TemplatePage {

  // Constants 
 ==

  private static final String FILE_PARAMETER = file;

  // Static 
 =

  public static BookmarkablePageLink createLinkToPage(String id, String 
 file) {
  final BookmarkablePageLink pageLink = new 
 BookmarkablePageLink(id, DownloadFile.class);
  pageLink.setParameter(FILE_PARAMETER, file);
  return pageLink;
  }

  // Setup 
 ==

  public DownloadFile(PageParameters parameters) {
  final String file = parameters.getString(FILE_PARAMETER);
  if (file == null) {
  throw new 
 RestartResponseAtInterceptPageException(Download.class);
  }

  if (!getOurSession().isLicenseAgreed()) {
  addContent(createLicenseFragment(contentPanel, 
 parameters));
  throw new RestartResponseAtInterceptPageException(this);
  }

  addContent(createDownloadFragment(contentPanel, file));
  }

  // Utils 
 ==

  private Fragment createDownloadFragment(String id, String file) {
  final Fragment fragment = new Fragment(id, downloadFragment);
  fragment.add(new Label(file, file));
  return fragment;
  }

  private Fragment createLicenseFragment(String id, final PageParameters 
 parameters) {
  final Fragment fragment = new Fragment(id, licenseFragment);
  fragment.add(new PageLink(accept, new IPageLink() {
  public Page getPage() {
  getOurSession().setLicenseAgreed(true);
  return new DownloadFile(parameters);
  }

  public Class getPageIdentity() {
  return DownloadFile.class;
  }
  }));
  return fragment;
  }

  public boolean isVersioned() {
  return false;
  }
 }
 
 Every page is mounted with QueryStringUrlCodingStrategy. On the Download 
 page a link to this DownloadFile page is created using the above 
 createLinkToPage() static method call which creates a link to 
 http://localhost:8080/smartcvs/download-file.html?file=win32jre;
 Curiously, when I click on it, the browser displays 
 http://localhost:8080/?wicket:interface=:2::; as URL. The accept-link 
 occurs pointing to 
 http://localhost:8080/?wicket:interface=:2:border:contentPanel:accept::ILinkListener;.
  
 When I click it, the browser displays 
 http://localhost:8080/?wicket:interface=:3::; as URL. Clicking the 
 back-button shows the http://localhost:8080/?wicket:interface=:2::; page 
 with the accept-link, no matter whether I try it with Opera or FireFox.
 
 Tom
 
 
 Eelco Hillenius wrote:
 Regarding the back-button: it would be the best if the intermediate license
 agreement page would not occur when pressing the back-button, but instead
 the previous page (if any). Is something like that possible?
 What you need to achieve is that the URL stays stable. One way to
 achieve this is to use panel replacement. E.g. when you click the
 download page, you replace the main panel on your page with a panel
 that displays the license agreement. If you turn off versioning for
 that page, the URL will stay stable and thus if you push the back
 button later, your browser will return to the first version of the
 page. I think this should work for most browsers (maybe only not with
 Opera). There are alternative ways to do this, including throwing
 RestartResponseExceptions, using custom page factories and custom url
 coding strategies. Or you can trick the browser using JavaScript, of
 which I don't know too many details.

 Eelco
 
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user 

Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Johan Compagner

nothing is wrong if you click on a wicket link (or submit a form) then we do
a redirect
to the page that is then rendered

What is strange (if that happens at your place) is that if you click on a
bookmarkable link
then that link should stay there (until you press a none bookmarkable link
or submit a form on that page)
If you just click on a bookmarkable link and then the url does change in the
browser then somewhere
a setRedirect(true) is done.

johan


On 5/31/07, Thomas Singer [EMAIL PROTECTED] wrote:


No one knows what's wrong?

Tom


Thomas Singer wrote:
 OK, I've tried to create an unversioned page to keep the URL stable
using
 following page code:

 public class DownloadFile extends TemplatePage {

  // Constants
==

  private static final String FILE_PARAMETER = file;

  // Static
=

  public static BookmarkablePageLink createLinkToPage(String id,
String file) {
  final BookmarkablePageLink pageLink = new
BookmarkablePageLink(id, DownloadFile.class);
  pageLink.setParameter(FILE_PARAMETER, file);
  return pageLink;
  }

  // Setup
==

  public DownloadFile(PageParameters parameters) {
  final String file = parameters.getString(FILE_PARAMETER);
  if (file == null) {
  throw new RestartResponseAtInterceptPageException(
Download.class);
  }

  if (!getOurSession().isLicenseAgreed()) {
  addContent(createLicenseFragment(contentPanel,
parameters));
  throw new
RestartResponseAtInterceptPageException(this);
  }

  addContent(createDownloadFragment(contentPanel, file));
  }

  // Utils
==

  private Fragment createDownloadFragment(String id, String file) {
  final Fragment fragment = new Fragment(id,
downloadFragment);
  fragment.add(new Label(file, file));
  return fragment;
  }

  private Fragment createLicenseFragment(String id, final
PageParameters parameters) {
  final Fragment fragment = new Fragment(id,
licenseFragment);
  fragment.add(new PageLink(accept, new IPageLink() {
  public Page getPage() {
  getOurSession().setLicenseAgreed(true);
  return new DownloadFile(parameters);
  }

  public Class getPageIdentity() {
  return DownloadFile.class;
  }
  }));
  return fragment;
  }

  public boolean isVersioned() {
  return false;
  }
 }

 Every page is mounted with QueryStringUrlCodingStrategy. On the Download
 page a link to this DownloadFile page is created using the above
 createLinkToPage() static method call which creates a link to
 http://localhost:8080/smartcvs/download-file.html?file=win32jre;
 Curiously, when I click on it, the browser displays
 http://localhost:8080/?wicket:interface=:2::; as URL. The accept-link
 occurs pointing to
 
http://localhost:8080/?wicket:interface=:2:border:contentPanel:accept::ILinkListener
.
 When I click it, the browser displays
 http://localhost:8080/?wicket:interface=:3::; as URL. Clicking the
 back-button shows the http://localhost:8080/?wicket:interface=:2::;
page
 with the accept-link, no matter whether I try it with Opera or
FireFox.

 Tom


 Eelco Hillenius wrote:
 Regarding the back-button: it would be the best if the intermediate
license
 agreement page would not occur when pressing the back-button, but
instead
 the previous page (if any). Is something like that possible?
 What you need to achieve is that the URL stays stable. One way to
 achieve this is to use panel replacement. E.g. when you click the
 download page, you replace the main panel on your page with a panel
 that displays the license agreement. If you turn off versioning for
 that page, the URL will stay stable and thus if you push the back
 button later, your browser will return to the first version of the
 page. I think this should work for most browsers (maybe only not with
 Opera). There are alternative ways to do this, including throwing
 RestartResponseExceptions, using custom page factories and custom url
 coding strategies. Or you can trick the browser using JavaScript, of
 which I don't know too many details.

 Eelco



-
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 

Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Thomas Singer
 If you just click on a bookmarkable link and then the url does change in the 
 browser then somewhere
 a setRedirect(true) is done. 

So the URL http://localhost:8080/?wicket:interface=:2::; comes from the 
throw new RestartResponseAtInterceptPageException(this)? At least the second 
time, when getOurSession().isLicenseAgreed() returns true and hence no 
redirect happens, the URL remains the same.

Unfortunately, this does not allow me to eliminate the intermediate redirect 
to the license agreement from the back-button history, although 
isVersioned() returns false all the time.

Tom


Johan Compagner wrote:
 nothing is wrong if you click on a wicket link (or submit a form) then 
 we do a redirect
 to the page that is then rendered
 
 What is strange (if that happens at your place) is that if you click on 
 a bookmarkable link
 then that link should stay there (until you press a none bookmarkable 
 link or submit a form on that page)
 If you just click on a bookmarkable link and then the url does change in 
 the browser then somewhere
 a setRedirect(true) is done.
 
 johan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Johan Compagner

that url that you get doesn't have anything to do with a page being
versioned or not.
that url you just get when you redirect to a page instance.
if you want to keep that bookmarkable then use this constructor

public RestartResponseAtInterceptPageException(final Class
interceptPageClass)



On 5/31/07, Thomas Singer [EMAIL PROTECTED] wrote:


 If you just click on a bookmarkable link and then the url does change in
the browser then somewhere
 a setRedirect(true) is done.

So the URL http://localhost:8080/?wicket:interface=:2::; comes from the
throw new RestartResponseAtInterceptPageException(this)? At least the
second
time, when getOurSession().isLicenseAgreed() returns true and hence no
redirect happens, the URL remains the same.

Unfortunately, this does not allow me to eliminate the intermediate
redirect
to the license agreement from the back-button history, although
isVersioned() returns false all the time.

Tom


Johan Compagner wrote:
 nothing is wrong if you click on a wicket link (or submit a form) then
 we do a redirect
 to the page that is then rendered

 What is strange (if that happens at your place) is that if you click on
 a bookmarkable link
 then that link should stay there (until you press a none bookmarkable
 link or submit a form on that page)
 If you just click on a bookmarkable link and then the url does change in
 the browser then somewhere
 a setRedirect(true) is done.

 johan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Thomas Singer
Thanks. One further question regarding links and bookmarkable pages: When I 
add following PageLink, will the resulting href always be not bookmarkable?

public class DownloadFile extends OurWebPage {

   public DownloadFile(final PageParameters parameters) {
 page.add(new PageLink(linkId, new IPageLink() {
   private static final long serialVersionUID = 1L;

   public Page getPage() {
 ...
 return getPageFactory().newPage(getPageIdentity(), parameters);
   }

   public Class getPageIdentity() {
 return DownloadFile.class;
   }
 }));
   }
}

Tom


Johan Compagner wrote:
 that url that you get doesn't have anything to do with a page being 
 versioned or not.
 that url you just get when you redirect to a page instance.
 if you want to keep that bookmarkable then use this constructor
 
 public RestartResponseAtInterceptPageException(final Class 
 interceptPageClass)


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Eelco Hillenius
 Thanks. One further question regarding links and bookmarkable pages: When I
 add following PageLink, will the resulting href always be not bookmarkable?

Indeed. That is because you're using an inner class, and Wicket
wouldn't know how to interpret and can't do anything else than execute
it (for which it needs to be stored for a next request). When you just
provide a class argument otoh, Wicket knows enough to write this out
as a bookmarkable page link.

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-31 Thread Thomas Singer
In other words: when something more should be done than just linking to 
another (bookmarkable) page, then always the resulting link is non-bookmarkable?

--
Tom


Eelco Hillenius wrote:
 Thanks. One further question regarding links and bookmarkable pages: When I
 add following PageLink, will the resulting href always be not bookmarkable?
 
 Indeed. That is because you're using an inner class, and Wicket
 wouldn't know how to interpret and can't do anything else than execute
 it (for which it needs to be stored for a next request). When you just
 provide a class argument otoh, Wicket knows enough to write this out
 as a bookmarkable page link.
 
 Eelco


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Stable URLs (Was: Bookmarkable pages and transparent login)

2007-05-30 Thread Thomas Singer
OK, I've tried to create an unversioned page to keep the URL stable using 
following page code:

 public class DownloadFile extends TemplatePage {
 
   // Constants 
 ==
 
   private static final String FILE_PARAMETER = file;
 
   // Static 
 =
 
   public static BookmarkablePageLink createLinkToPage(String id, String 
 file) {
   final BookmarkablePageLink pageLink = new 
 BookmarkablePageLink(id, DownloadFile.class);
   pageLink.setParameter(FILE_PARAMETER, file);
   return pageLink;
   }
 
   // Setup 
 ==
 
   public DownloadFile(PageParameters parameters) {
   final String file = parameters.getString(FILE_PARAMETER);
   if (file == null) {
   throw new 
 RestartResponseAtInterceptPageException(Download.class);
   }
 
   if (!getOurSession().isLicenseAgreed()) {
   addContent(createLicenseFragment(contentPanel, 
 parameters));
   throw new RestartResponseAtInterceptPageException(this);
   }
 
   addContent(createDownloadFragment(contentPanel, file));
   }
 
   // Utils 
 ==
 
   private Fragment createDownloadFragment(String id, String file) {
   final Fragment fragment = new Fragment(id, downloadFragment);
   fragment.add(new Label(file, file));
   return fragment;
   }
 
   private Fragment createLicenseFragment(String id, final PageParameters 
 parameters) {
   final Fragment fragment = new Fragment(id, licenseFragment);
   fragment.add(new PageLink(accept, new IPageLink() {
   public Page getPage() {
   getOurSession().setLicenseAgreed(true);
   return new DownloadFile(parameters);
   }
 
   public Class getPageIdentity() {
   return DownloadFile.class;
   }
   }));
   return fragment;
   }
 
   public boolean isVersioned() {
   return false;
   }
 }

Every page is mounted with QueryStringUrlCodingStrategy. On the Download 
page a link to this DownloadFile page is created using the above 
createLinkToPage() static method call which creates a link to 
http://localhost:8080/smartcvs/download-file.html?file=win32jre;
Curiously, when I click on it, the browser displays 
http://localhost:8080/?wicket:interface=:2::; as URL. The accept-link 
occurs pointing to 
http://localhost:8080/?wicket:interface=:2:border:contentPanel:accept::ILinkListener;.
 
When I click it, the browser displays 
http://localhost:8080/?wicket:interface=:3::; as URL. Clicking the 
back-button shows the http://localhost:8080/?wicket:interface=:2::; page 
with the accept-link, no matter whether I try it with Opera or FireFox.

Tom


Eelco Hillenius wrote:
 Regarding the back-button: it would be the best if the intermediate license
 agreement page would not occur when pressing the back-button, but instead
 the previous page (if any). Is something like that possible?
 
 What you need to achieve is that the URL stays stable. One way to
 achieve this is to use panel replacement. E.g. when you click the
 download page, you replace the main panel on your page with a panel
 that displays the license agreement. If you turn off versioning for
 that page, the URL will stay stable and thus if you push the back
 button later, your browser will return to the first version of the
 page. I think this should work for most browsers (maybe only not with
 Opera). There are alternative ways to do this, including throwing
 RestartResponseExceptions, using custom page factories and custom url
 coding strategies. Or you can trick the browser using JavaScript, of
 which I don't know too many details.
 
 Eelco


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user