本文整理汇总了Java中com.gitblit.wicket.pages.BasePage类的典型用法代码示例。如果您正苦于以下问题:Java BasePage类的具体用法?Java BasePage怎么用?Java BasePage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BasePage类属于com.gitblit.wicket.pages包,在下文中一共展示了BasePage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUnauthorizedInstantiation
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(Component component) {
if (component instanceof BasePage) {
throw new RestartResponseException(GitBlitWebApp.HOME_PAGE_CLASS);
}
}
示例2: onUnauthorizedInstantiation
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(Component component) {
if (component instanceof BasePage) {
throw new RestartResponseException(RepositoriesPage.class);
}
}
示例3: getAbsoluteUrl
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
protected String getAbsoluteUrl(Class<? extends BasePage> pageClass, PageParameters pageParameters) {
String relativeUrl = urlFor(pageClass, pageParameters).toString();
String absoluteUrl = RequestUtils.toAbsolutePath(relativeUrl);
return absoluteUrl;
}
示例4: PagerPanel
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
public PagerPanel(String wicketId, final int currentPage, final int totalPages,
final Class<? extends BasePage> pageClass, final PageParameters baseParams) {
super(wicketId);
List<PageObject> pages = new ArrayList<PageObject>();
int[] deltas;
if (currentPage == 1) {
// [1], 2, 3, 4, 5
deltas = new int[] { 0, 1, 2, 3, 4 };
} else if (currentPage == 2) {
// 1, [2], 3, 4, 5
deltas = new int[] { -1, 0, 1, 2, 3 };
} else {
// 1, 2, [3], 4, 5
deltas = new int[] { -2, -1, 0, 1, 2 };
}
if (totalPages > 0) {
pages.add(new PageObject("\u2190", currentPage - 1));
}
for (int delta : deltas) {
int page = currentPage + delta;
if (page > 0 && page <= totalPages) {
pages.add(new PageObject("" + page, page));
}
}
if (totalPages > 0) {
pages.add(new PageObject("\u2192", currentPage + 1));
}
ListDataProvider<PageObject> pagesProvider = new ListDataProvider<PageObject>(pages);
final DataView<PageObject> pagesView = new DataView<PageObject>("page", pagesProvider) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<PageObject> item) {
PageObject pageItem = item.getModelObject();
PageParameters pageParams = new PageParameters(baseParams);
pageParams.put("pg", pageItem.page);
LinkPanel link = new LinkPanel("pageLink", null, pageItem.text, pageClass, pageParams);
link.setRenderBodyOnly(true);
item.add(link);
if (pageItem.page == currentPage || pageItem.page < 1 || pageItem.page > totalPages) {
WicketUtils.setCssClass(item, "disabled");
}
}
};
add(pagesView);
}
示例5: isPageAuthorized
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
if (GitBlitWebApp.HOME_PAGE_CLASS.equals(pageClass)) {
// allow all requests to get to the HomePage with its inline
// authentication form
return true;
}
if (BasePage.class.isAssignableFrom(pageClass)) {
boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
GitBlitWebSession session = GitBlitWebSession.get();
if (authenticateView && !session.isLoggedIn()) {
// authentication required
session.cacheRequest(pageClass);
return false;
}
UserModel user = session.getUser();
if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
// admin page
if (allowAdmin) {
if (authenticateAdmin) {
// authenticate admin
if (user != null) {
return user.canAdmin();
}
return false;
} else {
// no admin authentication required
return true;
}
} else {
// admin prohibited
return false;
}
}
}
return true;
}
示例6: isPageAuthorized
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
if (RepositoriesPage.class.equals(pageClass)) {
// allow all requests to get to the RepositoriesPage with its inline
// authentication form
return true;
}
if (BasePage.class.isAssignableFrom(pageClass)) {
boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
GitBlitWebSession session = GitBlitWebSession.get();
if (authenticateView && !session.isLoggedIn()) {
// authentication required
session.cacheRequest(pageClass);
return false;
}
UserModel user = session.getUser();
if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
// admin page
if (allowAdmin) {
if (authenticateAdmin) {
// authenticate admin
if (user != null) {
return user.canAdmin();
}
return false;
} else {
// no admin authentication required
return true;
}
} else {
// admin prohibited
return false;
}
}
}
return true;
}
示例7: SessionlessForm
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
/**
* Sessionless forms must have a bookmarkable page class. A bookmarkable
* page is defined as a page that has only a default and/or a PageParameter
* constructor.
*
* @param id
* @param bookmarkablePageClass
* @param pageParameters
*/
public SessionlessForm(String id, Class<? extends BasePage> bookmarkablePageClass,
PageParameters pageParameters) {
super(id);
this.pageClass = bookmarkablePageClass;
this.pageParameters = pageParameters;
}
示例8: SessionlessForm
import com.gitblit.wicket.pages.BasePage; //导入依赖的package包/类
/**
* Sessionless forms must have a bookmarkable page class. A bookmarkable
* page is defined as a page that has only a default and/or a PageParameter
* constructor.
*
* @param id
* @param bookmarkablePageClass
* @param pageParameters
*/
public SessionlessForm(String id, Class<? extends BasePage> bookmarkablePageClass,
PageParameters pageParameters) {
super(id);
this.pageClass = bookmarkablePageClass;
this.pageParameters = pageParameters;
}