I don't see anything weird in BookmarkablePageIncrementLink code, any help I
do appreciate

package com.misPartidos.web.widgets.seo.navigation;

import org.apache.wicket.Page;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.navigation.paging.IPageable;

public class BookmarkablePageIncrementLink extends BookmarkablePageLink {
private static final long serialVersionUID = 5584517284841095213L;

/** The PageableListView the page links are referring to. */
protected final IPageable pageable;
 @SuppressWarnings("unchecked")
public BookmarkablePageIncrementLink(String id, IPageable pageable, Class
clazz, PageParameters p) {
super(id, clazz, p);
setAutoEnable(true);
this.pageable = pageable;
}
/**
 * Determines the next page number for the pageable component.
 *
 * @return the new page number
 */
public final int getPageNumber()
{
// Determine the page number based on the current
// PageableListView page and the increment
int idx = pageable.getCurrentPage() +
getPageParameters().getInt("increment");

// make sure the index lies between 0 and the last page
return Math.max(0, Math.min(pageable.getPageCount() - 1, idx));
}

/**
 * @return True if it is referring to the first page of the underlying
PageableListView.
 */
public boolean isFirst()
{
return pageable.getCurrentPage() <= 0;
}

/**
 * @return True if it is referring to the last page of the underlying
PageableListView.
 */
public boolean isLast()
{
return pageable.getCurrentPage() >= (pageable.getPageCount() - 1);
}

/**
 * Returns true if the page link links to the given page.
 *
 * @param page
 *            ignored
 * @return True if this link links to the given page
 * @see
org.apache.wicket.markup.html.link.PageLink#linksTo(org.apache.wicket.Page)
 */
public boolean linksTo(final Page page)
{
int increment=getPageParameters().getInt("increment");
pageable.getCurrentPage();
return ((increment < 0) && isFirst()) || ((increment > 0) && isLast());
}
}


On Mon, May 10, 2010 at 5:33 PM, Igor Vaynberg <igor.vaynb...@gmail.com>wrote:

> indeed, looking at the code everything is encrypted, so the problem
> must be in your BookmarkablePageIncrementLink. only urls that are
> generated via the coding strategy are encrypted, if you concatenate
> strings yourself they will not be encrypted obviously.
>
> -igor
>
> On Mon, May 10, 2010 at 12:06 PM, Fernando Wermus
> <fernando.wer...@gmail.com> wrote:
> > Igor,
> >    Wicket in Action explains
> > "... Using this code, Wicket will encrypt all your URLs—including
> > bookmarkable URLs. ...".
> >
> > I need fixed entry point for my stateless page,  but not readable for
> > humans, because some hacker would like to extract all the information
> from
> > the site.
> >
> > How can I achieve this?
> >
> >
> > On Mon, May 10, 2010 at 4:01 PM, Igor Vaynberg <igor.vaynb...@gmail.com
> >wrote:
> >
> >> afair crypted strategy only encodes non-bookmarkable urls. it does not
> >> encode bookmarkable urls because those are meant as entrypoints into
> >> your application.
> >>
> >> -igor
> >>
> >> On Mon, May 10, 2010 at 11:38 AM, Fernando Wermus
> >> <fernando.wer...@gmail.com> wrote:
> >> > Hi all,
> >> >    I create a PagingNavigator stateless. Instead of using a model to
> have
> >> > the number page shown, my StatelessPagingNavigator shows the number
> >> through
> >> > parameters. I hope that the page number wouldnt have been showed using
> >> > CryptedUrlWebRequestCodingStrategy, but It does. This is rather weird;
> I
> >> > hope any could point me out some solution. Is my class written wrongly
> in
> >> > some way?
> >> >
> >> >
> >> > public class StatelessPagingNavigator extends PagingNavigator {
> >> > private static final long serialVersionUID = 3576836044400027436L;
> >> >
> >> > public StatelessPagingNavigator(String id, DataView dataView) {
> >> > super(id, dataView);
> >> > }
> >> >
> >> >  @Override
> >> > protected Link newPagingNavigationIncrementLink(final String id,
> >> IPageable
> >> > pageable, int increment) {
> >> > * **PageParameters p=new PageParameters();*
> >> > *
> >> > *
> >> > * **p.add("increment", String.valueOf(increment));*
> >> > * **p.add("pageNumber", String.valueOf(pageable.getCurrentPage()));*
> >> > Link link= new BookmarkablePageIncrementLink(id, pageable,
> >> > getPage().getClass(), p){
> >> > private static final long serialVersionUID = 1L;
> >> >
> >> > public boolean isEnabled()
> >> > {
> >> > return super.isEnabled() && StatelessPagingNavigator.this.isEnabled()
> &&
> >> > StatelessPagingNavigator.this.isEnableAllowed();
> >> > }
> >> > };
> >> >  return link;
> >> > }
> >> >
> >> > @Override
> >> > protected Link newPagingNavigationLink(final String id, final
> IPageable
> >> > pageable, int pageNumber) {
> >> > * **PageParameters p=new PageParameters();*
> >> > * **p.add("pageNumber", String.valueOf(pageNumber));*
> >> >  return new BookmarkablePagingNavigationLink(id, pageable,
> >> > getPage().getClass(),  p){
> >> > private static final long serialVersionUID = -3076648671049640420L;
> >> >
> >> > public boolean isEnabled()
> >> > {
> >> > //return false;
> >> > return super.isEnabled() && StatelessPagingNavigator.this.isEnabled()
> &&
> >> > StatelessPagingNavigator.this.isEnableAllowed();
> >> > }
> >> >  };
> >> > }
> >> >
> >> > @Override
> >> > protected PagingNavigation newNavigation(final IPageable pageable,
> final
> >> > IPagingLabelProvider labelProvider) {
> >> > return new PagingNavigation("navigation", pageable, labelProvider) {
> >> > private static final long serialVersionUID = 1102823179571300337L;
> >> >
> >> > @Override
> >> > protected Link newPagingNavigationLink(final String id, final
> IPageable
> >> > pageable, int pageIndex) {
> >> > * **PageParameters p=new PageParameters();*
> >> > * **p.add("pageIndex", String.valueOf(pageIndex));*
> >> >  return new BookmarkablePagingNavigation(id, pageable,
> >> getPage().getClass(),
> >> >  p){
> >> > private static final long serialVersionUID = -3076648671049640420L;
> >> >
> >> > public boolean isEnabled()
> >> > {
> >> > return super.isEnabled() && StatelessPagingNavigator.this.isEnabled()
> &&
> >> > StatelessPagingNavigator.this.isEnableAllowed();
> >> > }
> >> >  };
> >> > }
> >> > };
> >> > }
> >> > }
> >> >
> >> > thanks in advance
> >> >
> >> > --
> >> > Fernando Wermus.
> >> >
> >> > www.linkedin.com/in/fernandowermus
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Reply via email to