From 317c6b79051ff20d71287f2f4d60e7dd63a903df Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Thu, 28 Jul 2016 18:54:30 +0200 Subject: [PATCH] Replaced SimpleAttributeModifier by AttributeModifier --- .../gitblit/utils/GitBlitRequestUtils.java | 17 +++++++++++++ .../com/gitblit/wicket/pages/BasePage.java | 17 ++++++------- .../com/gitblit/wicket/pages/BlamePage.java | 8 +++---- .../com/gitblit/wicket/pages/BlobPage.java | 4 ++-- .../wicket/pages/ChangePasswordPage.java | 9 +++---- .../com/gitblit/wicket/pages/CommitPage.java | 2 +- .../com/gitblit/wicket/pages/DocsPage.java | 10 ++++---- .../wicket/pages/EditRepositoryPage.java | 9 ++++--- .../gitblit/wicket/pages/EditTeamPage.java | 3 +-- .../gitblit/wicket/pages/EditUserPage.java | 4 ++-- .../wicket/pages/EmptyRepositoryPage.java | 4 ++-- .../wicket/pages/ExportTicketPage.java | 10 ++++---- .../gitblit/wicket/pages/FilestorePage.java | 9 +++---- .../wicket/pages/ImageDiffHandler.java | 2 +- .../com/gitblit/wicket/pages/LogoutPage.java | 15 ++++++------ .../wicket/pages/NewRepositoryPage.java | 4 ++-- .../gitblit/wicket/pages/RepositoryPage.java | 10 ++++---- .../com/gitblit/wicket/pages/SessionPage.java | 5 ++-- .../com/gitblit/wicket/pages/TicketPage.java | 9 ++++--- .../com/gitblit/wicket/pages/TicketsPage.java | 12 +++++----- .../com/gitblit/wicket/pages/TreePage.java | 2 +- .../gitblit/wicket/panels/BranchesPanel.java | 2 +- .../gitblit/wicket/panels/CommentPanel.java | 2 +- .../gitblit/wicket/panels/IconAjaxLink.java | 6 ++--- .../com/gitblit/wicket/panels/LinkPanel.java | 24 +++++++------------ .../com/gitblit/wicket/panels/LogPanel.java | 4 ++-- .../wicket/panels/MarkdownTextArea.java | 4 ++-- .../wicket/panels/ObjectContainer.java | 8 +++---- .../com/gitblit/wicket/panels/PagerPanel.java | 2 +- .../panels/RegistrantPermissionsPanel.java | 6 ++--- .../wicket/panels/RepositoryUrlPanel.java | 6 ++--- .../gitblit/wicket/panels/SimpleAjaxLink.java | 6 ++--- .../gitblit/wicket/panels/SshKeysPanel.java | 4 ++-- .../com/gitblit/wicket/panels/TagsPanel.java | 2 +- .../wicket/panels/TicketListPanel.java | 4 ++-- .../wicket/panels/TicketSearchForm.java | 2 +- 36 files changed, 128 insertions(+), 119 deletions(-) create mode 100644 src/main/java/com/gitblit/utils/GitBlitRequestUtils.java diff --git a/src/main/java/com/gitblit/utils/GitBlitRequestUtils.java b/src/main/java/com/gitblit/utils/GitBlitRequestUtils.java new file mode 100644 index 00000000..9a359310 --- /dev/null +++ b/src/main/java/com/gitblit/utils/GitBlitRequestUtils.java @@ -0,0 +1,17 @@ +package com.gitblit.utils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.wicket.request.cycle.RequestCycle; + +public class GitBlitRequestUtils { + public static HttpServletRequest getServletRequest(){ + return (HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest(); + } + + public static HttpServletResponse getServletResponse(){ + return (HttpServletResponse)RequestCycle.get().getResponse().getContainerResponse(); + } + +} diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java index 801736ea..4ade581e 100644 --- a/src/main/java/com/gitblit/wicket/pages/BasePage.java +++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java @@ -36,7 +36,10 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; import org.apache.wicket.Application; import org.apache.wicket.Page; +import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.request.resource.CssPackageResource; +import org.apache.wicket.request.resource.JavaScriptResourceReference; import org.apache.wicket.RedirectToUrlException; import org.apache.wicket.markup.html.CSSPackageResource; import org.apache.wicket.markup.html.basic.Label; @@ -45,7 +48,6 @@ import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.markup.html.resources.JavascriptResourceReference; import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.protocol.http.RequestUtils; -import org.apache.wicket.protocol.http.WebResponse; import org.apache.wicket.protocol.http.servlet.ServletWebRequest; import org.apache.wicket.request.target.basic.RedirectRequestTarget; import org.apache.wicket.util.time.Duration; @@ -62,6 +64,7 @@ import com.gitblit.Keys; import com.gitblit.models.ProjectModel; import com.gitblit.models.TeamModel; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.utils.StringUtils; import com.gitblit.utils.TimeUtils; import com.gitblit.wicket.CacheControl; @@ -94,10 +97,10 @@ public abstract class BasePage extends SessionPage { private void customizeHeader() { if (app().settings().getBoolean(Keys.web.useResponsiveLayout, true)) { - add(CSSPackageResource.getHeaderContribution("bootstrap/css/bootstrap-responsive.css")); + add(CssPackageResource.getHeaderContribution("bootstrap/css/bootstrap-responsive.css")); } if (app().settings().getBoolean(Keys.web.hideHeader, false)) { - add(CSSPackageResource.getHeaderContribution("hideheader.css")); + add(CssPackageResource.getHeaderContribution("hideheader.css")); } } @@ -352,9 +355,7 @@ public abstract class BasePage extends SessionPage { } protected String getServerName() { - ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest(); - HttpServletRequest req = servletWebRequest.getHttpServletRequest(); - return req.getServerName(); + return GitBlitRequestUtils.getServletRequest().getServerName(); } protected List getProjectModels() { @@ -371,7 +372,7 @@ public abstract class BasePage extends SessionPage { boolean hasParameter = false; String regex = WicketUtils.getRegEx(params); String team = WicketUtils.getTeam(params); - int daysBack = params.getInt("db", 0); + int daysBack = params.get("db").toInt(0); int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30); List availableModels = getProjectModels(); @@ -527,7 +528,7 @@ public abstract class BasePage extends SessionPage { protected void addBottomScript(String scriptPath) { RepeatingView bottomScripts = getBottomScriptContainer(); Label script = new Label(bottomScripts.newChildId(), "\n"); + + urlFor(new JavaScriptResourceReference(this.getClass(), scriptPath)) + "'>\n"); bottomScripts.add(script.setEscapeModelStrings(false).setRenderBodyOnly(true)); } diff --git a/src/main/java/com/gitblit/wicket/pages/BlamePage.java b/src/main/java/com/gitblit/wicket/pages/BlamePage.java index b9c1bc82..e9c2aca1 100644 --- a/src/main/java/com/gitblit/wicket/pages/BlamePage.java +++ b/src/main/java/com/gitblit/wicket/pages/BlamePage.java @@ -27,9 +27,9 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.ExternalLink; @@ -90,7 +90,7 @@ public class BlamePage extends RepositoryPage { final String blobPath = WicketUtils.getPath(params); - final String blameTypeParam = params.getString("blametype", BlameType.COMMIT.toString()); + final String blameTypeParam = params.get("blametype").toString(BlameType.COMMIT.toString()); final BlameType activeBlameType = BlameType.get(blameTypeParam); RevCommit commit = getCommit(); @@ -145,7 +145,7 @@ public class BlamePage extends RepositoryPage { new BookmarkablePageLink(blameByLinkText, BlamePage.class, blameTypePageParam); if (activeBlameType == type) { - blameByPageLink.add(new SimpleAttributeModifier("style", "font-weight:bold;")); + blameByPageLink.add(new AttributeModifier("style", "font-weight:bold;")); } add(blameByPageLink); @@ -226,7 +226,7 @@ public class BlamePage extends RepositoryPage { break; } Component data = new Label("data", StringUtils.escapeForHtml(entry.data, true, tabLength)).setEscapeModelStrings(false); - data.add(new SimpleAttributeModifier("style", "background-color: " + color + ";")); + data.add(new AttributeModifier("style", "background-color: " + color + ";")); item.add(data); } }; diff --git a/src/main/java/com/gitblit/wicket/pages/BlobPage.java b/src/main/java/com/gitblit/wicket/pages/BlobPage.java index f8834642..a25068db 100644 --- a/src/main/java/com/gitblit/wicket/pages/BlobPage.java +++ b/src/main/java/com/gitblit/wicket/pages/BlobPage.java @@ -20,8 +20,8 @@ import java.util.HashMap; import java.util.Map; import org.apache.wicket.Component; +import org.apache.wicket.RestartResponseException; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.RedirectException; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.image.Image; import org.apache.wicket.markup.html.link.BookmarkablePageLink; @@ -54,7 +54,7 @@ public class BlobPage extends RepositoryPage { String [] encodings = getEncodings(); if (StringUtils.isEmpty(objectId) && StringUtils.isEmpty(blobPath)) { - throw new RedirectException(TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)); + throw new RestartResponseException(TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)); } if (StringUtils.isEmpty(blobPath)) { diff --git a/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java b/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java index 259a4bf4..8c91ac30 100644 --- a/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java +++ b/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java @@ -22,12 +22,11 @@ import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.StatelessForm; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.protocol.http.WebRequest; -import org.apache.wicket.protocol.http.WebResponse; import com.gitblit.GitBlitException; import com.gitblit.Keys; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.utils.StringUtils; import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.NonTrimmedPasswordTextField; @@ -100,10 +99,8 @@ public class ChangePasswordPage extends RootSubPage { try { app().gitblit().reviseUser(user.username, user); if (app().settings().getBoolean(Keys.web.allowCookieAuthentication, false)) { - WebRequest request = (WebRequest) getRequestCycle().getRequest(); - WebResponse response = (WebResponse) getRequestCycle().getResponse(); - app().authentication().setCookie(request.getHttpServletRequest(), - response.getHttpServletResponse(), user); + app().authentication().setCookie(GitBlitRequestUtils.getServletRequest(), + GitBlitRequestUtils.getServletResponse(), user); } } catch (GitBlitException e) { error(e.getMessage()); diff --git a/src/main/java/com/gitblit/wicket/pages/CommitPage.java b/src/main/java/com/gitblit/wicket/pages/CommitPage.java index c9d16803..6795af29 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitPage.java +++ b/src/main/java/com/gitblit/wicket/pages/CommitPage.java @@ -29,7 +29,7 @@ import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.model.StringResourceModel; -import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; +//import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; import org.apache.wicket.util.resource.AbstractResourceStreamWriter; import org.apache.wicket.util.resource.IResourceStream; import org.eclipse.jgit.diff.DiffEntry.ChangeType; diff --git a/src/main/java/com/gitblit/wicket/pages/DocsPage.java b/src/main/java/com/gitblit/wicket/pages/DocsPage.java index 68d47a9a..00144454 100644 --- a/src/main/java/com/gitblit/wicket/pages/DocsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/DocsPage.java @@ -17,9 +17,9 @@ package com.gitblit.wicket.pages; import java.util.List; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.ExternalLink; @@ -95,7 +95,7 @@ public class DocsPage extends RepositoryPage { item.add(link); if (counter == 0) { counter++; - item.add(new SimpleAttributeModifier("class", "active")); + item.add(new AttributeModifier("class", "active")); } } }; @@ -128,13 +128,13 @@ public class DocsPage extends RepositoryPage { Component content = new Label("content", doc.html) .setEscapeModelStrings(false); if (!MarkupSyntax.PLAIN.equals(doc.syntax)) { - content.add(new SimpleAttributeModifier("class", "markdown")); + content.add(new AttributeModifier("class", "markdown")); } item.add(content); - item.add(new SimpleAttributeModifier("id", file)); + item.add(new AttributeModifier("id", file)); if (counter == 0) { counter++; - item.add(new SimpleAttributeModifier("class", "tab-pane active")); + item.add(new AttributeModifier("class", "tab-pane active")); } } }; diff --git a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java index 4ca4820a..ae12d02f 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java @@ -29,7 +29,6 @@ import java.util.Set; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.extensions.markup.html.form.palette.Palette; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; @@ -408,7 +407,7 @@ public class EditRepositoryPage extends RootSubPage { } // do not let the browser pre-populate these fields - form.add(new SimpleAttributeModifier("autocomplete", "off")); + form.add(new AttributeModifier("autocomplete", "off")); // @@ -638,9 +637,9 @@ public class EditRepositoryPage extends RootSubPage { repositoryModel.authorizationControl = AuthorizationControl.NAMED; } - target.addComponent(verifyCommitter); - target.addComponent(usersPalette); - target.addComponent(teamsPalette); + target.add(verifyCommitter); + target.add(usersPalette); + target.add(teamsPalette); } }; diff --git a/src/main/java/com/gitblit/wicket/pages/EditTeamPage.java b/src/main/java/com/gitblit/wicket/pages/EditTeamPage.java index f94747ac..9f9e6b1c 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditTeamPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditTeamPage.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Set; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.extensions.markup.html.form.palette.Palette; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.CheckBox; @@ -220,7 +219,7 @@ public class EditTeamPage extends RootSubPage { }; // do not let the browser pre-populate these fields - form.add(new SimpleAttributeModifier("autocomplete", "off")); + form.add(new AttributeModifier("autocomplete", "off")); // not all user providers support manipulating team memberships boolean editMemberships = app().authentication().supportsTeamMembershipChanges(teamModel); diff --git a/src/main/java/com/gitblit/wicket/pages/EditUserPage.java b/src/main/java/com/gitblit/wicket/pages/EditUserPage.java index 720d311e..af37af7f 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditUserPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditUserPage.java @@ -22,7 +22,7 @@ import java.util.Iterator; import java.util.List; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.extensions.markup.html.form.palette.Palette; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.CheckBox; @@ -217,7 +217,7 @@ public class EditUserPage extends RootSubPage { }; // do not let the browser pre-populate these fields - form.add(new SimpleAttributeModifier("autocomplete", "off")); + form.add(new AttributeModifier("autocomplete", "off")); // not all user providers support manipulating username and password boolean editCredentials = app().authentication().supportsCredentialChanges(userModel); diff --git a/src/main/java/com/gitblit/wicket/pages/EmptyRepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/EmptyRepositoryPage.java index a65a1feb..7c9a46b3 100644 --- a/src/main/java/com/gitblit/wicket/pages/EmptyRepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EmptyRepositoryPage.java @@ -21,11 +21,11 @@ import javax.servlet.http.HttpServletRequest; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.protocol.http.WebRequest; import com.gitblit.models.RepositoryModel; import com.gitblit.models.RepositoryUrl; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.GitblitRedirectException; import com.gitblit.wicket.WicketUtils; @@ -54,7 +54,7 @@ public class EmptyRepositoryPage extends RepositoryPage { user = UserModel.ANONYMOUS; } - HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest(); + HttpServletRequest req = GitBlitRequestUtils.getServletRequest(); List repositoryUrls = app().services().getRepositoryUrls(req, user, repository); RepositoryUrl primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0); String url = primaryUrl != null ? primaryUrl.url : ""; diff --git a/src/main/java/com/gitblit/wicket/pages/ExportTicketPage.java b/src/main/java/com/gitblit/wicket/pages/ExportTicketPage.java index 54abe965..3d63550b 100644 --- a/src/main/java/com/gitblit/wicket/pages/ExportTicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/ExportTicketPage.java @@ -15,10 +15,12 @@ */ package com.gitblit.wicket.pages; -import org.apache.wicket.IRequestTarget; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.request.http.WebResponse; +//import org.apache.wicket.IRequestTarget; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.RequestCycle; -import org.apache.wicket.protocol.http.WebResponse; +//import org.apache.wicket.RequestCycle; +//import org.apache.wicket.protocol.http.WebResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +39,7 @@ public class ExportTicketPage extends SessionPage { public ExportTicketPage(final PageParameters params) { super(params); - if (!params.containsKey("r")) { + if (params.get("r").isEmpty()) { error(getString("gb.repositoryNotSpecified")); redirectToInterceptPage(new RepositoriesPage()); } diff --git a/src/main/java/com/gitblit/wicket/pages/FilestorePage.java b/src/main/java/com/gitblit/wicket/pages/FilestorePage.java index 497b3140..6fc7b6d7 100644 --- a/src/main/java/com/gitblit/wicket/pages/FilestorePage.java +++ b/src/main/java/com/gitblit/wicket/pages/FilestorePage.java @@ -243,7 +243,7 @@ public class FilestorePage extends RootPage { ok, pending, inprogress, error, deleted; } - private static class SortableFilestoreProvider extends SortableDataProvider { + private static class SortableFilestoreProvider extends SortableDataProvider { private static final long serialVersionUID = 1L; @@ -254,7 +254,7 @@ public class FilestorePage extends RootPage { } @Override - public int size() { + public long size() { if (list == null) { return 0; } @@ -267,15 +267,16 @@ public class FilestorePage extends RootPage { } @Override - public Iterator iterator(int first, int count) { + public Iterator iterator(long first, long count) { Collections.sort(list, new Comparator() { @Override public int compare(FilestoreModel o1, FilestoreModel o2) { return o2.getChangedOn().compareTo(o1.getChangedOn()); } }); - return list.subList(first, first + count).iterator(); + return list.subList(Math.toIntExact(first), Math.toIntExact(first + count)).iterator(); } + } } \ No newline at end of file diff --git a/src/main/java/com/gitblit/wicket/pages/ImageDiffHandler.java b/src/main/java/com/gitblit/wicket/pages/ImageDiffHandler.java index dc0c5ae8..cc06f44b 100644 --- a/src/main/java/com/gitblit/wicket/pages/ImageDiffHandler.java +++ b/src/main/java/com/gitblit/wicket/pages/ImageDiffHandler.java @@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.protocol.http.WicketURLEncoder; +//import org.apache.wicket.protocol.http.WicketURLEncoder; import org.eclipse.jgit.diff.DiffEntry; import org.eclipse.jgit.diff.DiffEntry.Side; import org.jsoup.nodes.Element; diff --git a/src/main/java/com/gitblit/wicket/pages/LogoutPage.java b/src/main/java/com/gitblit/wicket/pages/LogoutPage.java index a8ae7d0f..92d3d623 100644 --- a/src/main/java/com/gitblit/wicket/pages/LogoutPage.java +++ b/src/main/java/com/gitblit/wicket/pages/LogoutPage.java @@ -15,10 +15,11 @@ */ package com.gitblit.wicket.pages; -import org.apache.wicket.protocol.http.WebRequest; -import org.apache.wicket.protocol.http.WebResponse; + +import org.apache.wicket.RestartResponseException; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.wicket.GitBlitWebSession; public class LogoutPage extends BasePage { @@ -27,8 +28,7 @@ public class LogoutPage extends BasePage { super(); GitBlitWebSession session = GitBlitWebSession.get(); UserModel user = session.getUser(); - app().authentication().logout(((WebRequest) getRequest()).getHttpServletRequest(), - ((WebResponse) getResponse()).getHttpServletResponse(), user); + app().authentication().logout(GitBlitRequestUtils.getServletRequest(), GitBlitRequestUtils.getServletResponse(), user); session.invalidate(); /* @@ -36,14 +36,15 @@ public class LogoutPage extends BasePage { * If so, it is likely to be cached by the browser, and cannot be undone. Effectively, this means * that you cannot log out... */ - if ( ((WebRequest)getRequest()).getHttpServletRequest().getHeader("Authorization") != null ) { + if (GitBlitRequestUtils.getServletRequest().getHeader("Authorization") != null ) { // authentication will be done via this route anyway, show a page to close the browser: // this will be done by Wicket. setupPage(null, getString("gb.logout")); } else { - setRedirect(true); - setResponsePage(getApplication().getHomePage()); +// setRedirect(true); +// setResponsePage(getApplication().getHomePage()); + throw new RestartResponseException(getApplication().getHomePage()); } // not via WWW-Auth } // LogoutPage } \ No newline at end of file diff --git a/src/main/java/com/gitblit/wicket/pages/NewRepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/NewRepositoryPage.java index d2589e6f..b9e9f871 100644 --- a/src/main/java/com/gitblit/wicket/pages/NewRepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/NewRepositoryPage.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.wicket.behavior.SimpleAttributeModifier; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.CompoundPropertyModel; @@ -151,7 +151,7 @@ public class NewRepositoryPage extends RootSubPage { }; // do not let the browser pre-populate these fields - form.add(new SimpleAttributeModifier("autocomplete", "off")); + form.add(new AttributeModifier("autocomplete", "off")); namePanel = new RepositoryNamePanel("namePanel", repositoryModel); form.add(namePanel); diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java index 9e5db9f2..c484e074 100644 --- a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java @@ -26,10 +26,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.RestartResponseException; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.TextField; @@ -134,9 +134,9 @@ public abstract class RepositoryPage extends RootPage { } } - if (params.containsKey(PARAM_STAR)) { + if (!params.get(PARAM_STAR).isEmpty()) { // set starred state - boolean star = params.getBoolean(PARAM_STAR); + boolean star = params.get(PARAM_STAR).toBoolean(); UserModel user = GitBlitWebSession.get().getUser(); if (user != null && user.isAuthenticated) { UserRepositoryPreferences prefs = user.getPreferences().getRepositoryPreferences(getRepositoryModel().name); @@ -354,7 +354,7 @@ public abstract class RepositoryPage extends RootPage { // (un)star link allows a user to star a repository if (user.isAuthenticated && model.hasCommits) { PageParameters starParams = DeepCopier.copy(getPageParameters()); - starParams.put(PARAM_STAR, !user.getPreferences().isStarredRepository(model.name)); + starParams.add(PARAM_STAR, !user.getPreferences().isStarredRepository(model.name)); String toggleStarUrl = getRequestCycle().urlFor(getClass(), starParams).toString(); if (user.getPreferences().isStarredRepository(model.name)) { // show unstar button @@ -419,7 +419,7 @@ public abstract class RepositoryPage extends RootPage { WicketUtils.setCssClass(icon, iconClass); button.add(icon); button.add(new Label("label", label)); - button.add(new SimpleAttributeModifier("href", url)); + button.add(new AttributeModifier("href", url)); add(button); } diff --git a/src/main/java/com/gitblit/wicket/pages/SessionPage.java b/src/main/java/com/gitblit/wicket/pages/SessionPage.java index b4cf0db3..cb3a9bae 100644 --- a/src/main/java/com/gitblit/wicket/pages/SessionPage.java +++ b/src/main/java/com/gitblit/wicket/pages/SessionPage.java @@ -27,6 +27,7 @@ import com.gitblit.Constants; import com.gitblit.Constants.AuthenticationType; import com.gitblit.Keys; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.utils.StringUtils; import com.gitblit.wicket.GitBlitWebApp; import com.gitblit.wicket.GitBlitWebSession; @@ -53,8 +54,8 @@ public abstract class SessionPage extends WebPage { private void login() { GitBlitWebSession session = GitBlitWebSession.get(); - HttpServletRequest request = ((WebRequest) getRequest()).getHttpServletRequest(); - HttpServletResponse response = ((WebResponse) getResponse()).getHttpServletResponse(); + HttpServletRequest request = GitBlitRequestUtils.getServletRequest(); + HttpServletResponse response = GitBlitRequestUtils.getServletResponse(); // If using container/external servlet authentication, use request attribute String authedUser = (String) request.getAttribute(Constants.ATTRIB_AUTHUSER); diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 9de3100d..53671b73 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -38,7 +38,6 @@ import org.apache.wicket.MarkupContainer; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.RestartResponseException; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.image.ContextImage; import org.apache.wicket.markup.html.link.BookmarkablePageLink; @@ -51,7 +50,6 @@ import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.model.Model; import org.apache.wicket.protocol.http.RequestUtils; -import org.apache.wicket.protocol.http.WebRequest; import org.eclipse.jgit.diff.DiffEntry.ChangeType; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; @@ -87,6 +85,7 @@ import com.gitblit.utils.ArrayUtils; import com.gitblit.utils.JGitUtils; import com.gitblit.utils.JGitUtils.MergeStatus; import com.gitblit.utils.CommitCache; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.utils.MarkdownUtils; import com.gitblit.utils.RefLogUtils; import com.gitblit.utils.StringUtils; @@ -635,7 +634,7 @@ public class TicketPage extends RepositoryPage { Label label = new Label("label", value); TicketLabel tLabel = app().tickets().getLabel(repository, value); String background = MessageFormat.format("background-color:{0};", tLabel.color); - label.add(new SimpleAttributeModifier("style", background)); + label.add(new AttributeModifier("style", background)); item.add(label); } }; @@ -1362,7 +1361,7 @@ public class TicketPage extends RepositoryPage { } protected X setNewTarget(X x) { - x.add(new SimpleAttributeModifier("target", "_blank")); + x.add(new AttributeModifier("target", "_blank")); return x; } @@ -1569,7 +1568,7 @@ public class TicketPage extends RepositoryPage { * @return the primary repository url */ protected RepositoryUrl getRepositoryUrl(UserModel user, RepositoryModel repository) { - HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest(); + HttpServletRequest req = GitBlitRequestUtils.getServletRequest(); List urls = app().services().getRepositoryUrls(req, user, repository); if (ArrayUtils.isEmpty(urls)) { return null; diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java index f99464af..ed0ed63e 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java @@ -88,12 +88,12 @@ public class TicketsPage extends RepositoryPage { boolean isAuthenticated = user != null && user.isAuthenticated; final String [] statiiParam = params.getStringArray(Lucene.status.name()); - final String assignedToParam = params.getString(Lucene.responsible.name(), null); - final String milestoneParam = params.getString(Lucene.milestone.name(), null); - final String queryParam = params.getString("q", null); - final String searchParam = params.getString("s", null); - final String sortBy = Lucene.fromString(params.getString("sort", Lucene.created.name())).name(); - final boolean desc = !"asc".equals(params.getString("direction", "desc")); + final String assignedToParam = params.get(Lucene.responsible.name()).toString(null); + final String milestoneParam = params.get(Lucene.milestone.name()).toString(null); + final String queryParam = params.get("q").toString(null); + final String searchParam = params.get("s").toString(null); + final String sortBy = Lucene.fromString(params.get("sort").toString( Lucene.created.name())).name(); + final boolean desc = !"asc".equals(params.get("direction").toString("desc")); // add search form add(new TicketSearchForm("ticketSearchForm", repositoryName, searchParam, getClass(), params)); diff --git a/src/main/java/com/gitblit/wicket/pages/TreePage.java b/src/main/java/com/gitblit/wicket/pages/TreePage.java index ad594fc7..73a03f86 100644 --- a/src/main/java/com/gitblit/wicket/pages/TreePage.java +++ b/src/main/java/com/gitblit/wicket/pages/TreePage.java @@ -27,7 +27,7 @@ import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; -import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; +//import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; import org.apache.wicket.util.resource.AbstractResourceStreamWriter; import org.apache.wicket.util.resource.IResourceStream; import org.eclipse.jgit.lib.FileMode; diff --git a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java index 3b9482f6..93dd1493 100644 --- a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java @@ -32,7 +32,7 @@ import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.model.StringResourceModel; import org.apache.wicket.protocol.http.RequestUtils; -import org.apache.wicket.request.target.basic.RedirectRequestTarget; +//import org.apache.wicket.request.target.basic.RedirectRequestTarget; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; diff --git a/src/main/java/com/gitblit/wicket/panels/CommentPanel.java b/src/main/java/com/gitblit/wicket/panels/CommentPanel.java index e3cf4488..93d2b840 100644 --- a/src/main/java/com/gitblit/wicket/panels/CommentPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/CommentPanel.java @@ -23,7 +23,7 @@ import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.protocol.http.RequestUtils; -import org.apache.wicket.request.target.basic.RedirectRequestTarget; +//import org.apache.wicket.request.target.basic.RedirectRequestTarget; import com.gitblit.models.RepositoryModel; import com.gitblit.models.TicketModel; diff --git a/src/main/java/com/gitblit/wicket/panels/IconAjaxLink.java b/src/main/java/com/gitblit/wicket/panels/IconAjaxLink.java index eb2288ba..a496db3b 100644 --- a/src/main/java/com/gitblit/wicket/panels/IconAjaxLink.java +++ b/src/main/java/com/gitblit/wicket/panels/IconAjaxLink.java @@ -17,9 +17,9 @@ package com.gitblit.wicket.panels; import java.text.MessageFormat; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.model.IModel; @@ -36,12 +36,12 @@ public abstract class IconAjaxLink extends AjaxLink { } @Override - protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { + public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, MessageFormat.format(" {1}", iconClass, getModelObject().toString())); } public void setNoFollow() { Component c = get("link"); - c.add(new SimpleAttributeModifier("rel", "nofollow")); + c.add(new AttributeModifier("rel", "nofollow")); } } diff --git a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java index 06169a3e..609a1e13 100644 --- a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java @@ -15,12 +15,9 @@ */ package com.gitblit.wicket.panels; -import java.io.OutputStream; -import java.util.concurrent.Callable; - +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; @@ -29,13 +26,8 @@ import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; -import org.apache.wicket.util.resource.AbstractResourceStreamWriter; -import org.apache.wicket.util.resource.IResourceStream; -import com.gitblit.models.UserModel; import com.gitblit.utils.StringUtils; -import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.WicketUtils; public class LinkPanel extends Panel { @@ -80,10 +72,10 @@ public class LinkPanel extends Panel { link = new BookmarkablePageLink("link", clazz, parameters); } if (newWindow) { - link.add(new SimpleAttributeModifier("target", "_blank")); + link.add(new AttributeModifier("target", "_blank")); } if (linkCssClass != null) { - link.add(new SimpleAttributeModifier("class", linkCssClass)); + link.add(new AttributeModifier("class", linkCssClass)); } Label icon = new Label("icon"); if (StringUtils.isEmpty(bootstrapIcon)) { @@ -106,10 +98,10 @@ public class LinkPanel extends Panel { this.labelModel = new Model(label); ExternalLink link = new ExternalLink("link", href); if (newWindow) { - link.add(new SimpleAttributeModifier("target", "_blank")); + link.add(new AttributeModifier("target", "_blank")); } if (linkCssClass != null) { - link.add(new SimpleAttributeModifier("class", linkCssClass)); + link.add(new AttributeModifier("class", linkCssClass)); } link.add(new Label("icon").setVisible(false)); link.add(new Label("label", labelModel)); @@ -122,7 +114,7 @@ public class LinkPanel extends Panel { this.labelModel = new Model(label); if (linkCssClass != null) { - link.add(new SimpleAttributeModifier("class", linkCssClass)); + link.add(new AttributeModifier("class", linkCssClass)); } link.add(new Label("icon").setVisible(false)); @@ -132,12 +124,12 @@ public class LinkPanel extends Panel { public void setNoFollow() { Component c = get("link"); - c.add(new SimpleAttributeModifier("rel", "nofollow")); + c.add(new AttributeModifier("rel", "nofollow")); } public void setTooltip(String tooltip) { Component c = get("link"); - c.add(new SimpleAttributeModifier("title", tooltip)); + c.add(new AttributeModifier("title", tooltip)); } } diff --git a/src/main/java/com/gitblit/wicket/panels/LogPanel.java b/src/main/java/com/gitblit/wicket/panels/LogPanel.java index e9d240d0..fe9f4d7c 100644 --- a/src/main/java/com/gitblit/wicket/panels/LogPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/LogPanel.java @@ -19,8 +19,8 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.MarkupContainer; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; @@ -85,7 +85,7 @@ public class LogPanel extends BasePanel { graph.setVisible(false); } else { // set the rowspan on the graph row and +1 for the graph row itself - graph.add(new SimpleAttributeModifier("rowspan", "" + (commits.size() + 1))); + graph.add(new AttributeModifier("rowspan", "" + (commits.size() + 1))); graph.add(new ExternalImage("image", BranchGraphServlet.asLink(baseUrl, repositoryName, commits.get(0).name(), commits.size()))); } diff --git a/src/main/java/com/gitblit/wicket/panels/MarkdownTextArea.java b/src/main/java/com/gitblit/wicket/panels/MarkdownTextArea.java index ade92c09..f922686f 100644 --- a/src/main/java/com/gitblit/wicket/panels/MarkdownTextArea.java +++ b/src/main/java/com/gitblit/wicket/panels/MarkdownTextArea.java @@ -45,7 +45,7 @@ public class MarkdownTextArea extends TextArea { protected void onUpdate(AjaxRequestTarget target) { renderPreview(previewModel); if (target != null) { - target.addComponent(previewLabel); + target.add(previewLabel); } } }); @@ -56,7 +56,7 @@ public class MarkdownTextArea extends TextArea { protected void onUpdate(AjaxRequestTarget target) { renderPreview(previewModel); if (target != null) { - target.addComponent(previewLabel); + target.add(previewLabel); } } }); diff --git a/src/main/java/com/gitblit/wicket/panels/ObjectContainer.java b/src/main/java/com/gitblit/wicket/panels/ObjectContainer.java index 3c09e7c7..e26673e4 100644 --- a/src/main/java/com/gitblit/wicket/panels/ObjectContainer.java +++ b/src/main/java/com/gitblit/wicket/panels/ObjectContainer.java @@ -20,16 +20,16 @@ import java.util.List; import org.apache.wicket.Component; import org.apache.wicket.ResourceReference; -import org.apache.wicket.Response; +import org.apache.wicket.core.request.ClientInfo; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.protocol.http.ClientProperties; -import org.apache.wicket.protocol.http.WebRequestCycle; import org.apache.wicket.protocol.http.WebSession; import org.apache.wicket.protocol.http.request.WebClientInfo; -import org.apache.wicket.request.ClientInfo; +import org.apache.wicket.request.Response; +import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.value.IValueMap; /** @@ -149,7 +149,7 @@ public abstract class ObjectContainer extends WebMarkupContainer { ClientInfo clientInfo = WebSession.get().getClientInfo(); if (clientInfo == null || !(clientInfo instanceof WebClientInfo)) { - clientInfo = new WebClientInfo((WebRequestCycle) getRequestCycle()); + clientInfo = new WebClientInfo(getRequestCycle()); WebSession.get().setClientInfo(clientInfo); } diff --git a/src/main/java/com/gitblit/wicket/panels/PagerPanel.java b/src/main/java/com/gitblit/wicket/panels/PagerPanel.java index fa7de792..c80bb73c 100644 --- a/src/main/java/com/gitblit/wicket/panels/PagerPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/PagerPanel.java @@ -69,7 +69,7 @@ public class PagerPanel extends Panel { public void populateItem(final Item item) { PageObject pageItem = item.getModelObject(); PageParameters pageParams = new PageParameters(baseParams); - pageParams.put("pg", pageItem.page); + pageParams.add("pg", pageItem.page); LinkPanel link = new LinkPanel("pageLink", null, pageItem.text, pageClass, pageParams); link.setRenderBodyOnly(true); item.add(link); diff --git a/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java b/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java index 447e1789..f1d7d640 100644 --- a/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java @@ -214,7 +214,7 @@ public class RegistrantPermissionsPanel extends BasePanel { @Override protected void onUpdate(AjaxRequestTarget target) { - target.addComponent(permissionChoice); + target.add(permissionChoice); } }); } @@ -277,7 +277,7 @@ public class RegistrantPermissionsPanel extends BasePanel { registrants.remove(rp.registrant); // force the panel to refresh - target.addComponent(RegistrantPermissionsPanel.this); + target.add(RegistrantPermissionsPanel.this); } }; addPermissionForm.add(button); @@ -339,7 +339,7 @@ public class RegistrantPermissionsPanel extends BasePanel { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { RegistrantPermissionsPanel.this.activeState = buttonState; - target.addComponent(RegistrantPermissionsPanel.this); + target.add(RegistrantPermissionsPanel.this); } }; } diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java index 207f1250..549c92b5 100644 --- a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java @@ -24,15 +24,14 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.wicket.Component; -import org.apache.wicket.RequestCycle; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.image.ContextImage; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; -import org.apache.wicket.protocol.http.WebRequest; import org.apache.wicket.protocol.http.request.WebClientInfo; +import org.apache.wicket.request.cycle.RequestCycle; import com.gitblit.Constants.AccessPermission; import com.gitblit.Constants.AccessRestrictionType; @@ -41,6 +40,7 @@ import com.gitblit.models.GitClientApplication; import com.gitblit.models.RepositoryModel; import com.gitblit.models.RepositoryUrl; import com.gitblit.models.UserModel; +import com.gitblit.utils.GitBlitRequestUtils; import com.gitblit.utils.StringUtils; import com.gitblit.wicket.ExternalImage; import com.gitblit.wicket.GitBlitWebSession; @@ -78,7 +78,7 @@ public class RepositoryUrlPanel extends BasePanel { protected void onInitialize() { super.onInitialize(); - HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest(); + HttpServletRequest req = GitBlitRequestUtils.getServletRequest(); List repositoryUrls = app().services().getRepositoryUrls(req, user, repository); // grab primary url from the top of the list diff --git a/src/main/java/com/gitblit/wicket/panels/SimpleAjaxLink.java b/src/main/java/com/gitblit/wicket/panels/SimpleAjaxLink.java index d7466522..6a3cca06 100644 --- a/src/main/java/com/gitblit/wicket/panels/SimpleAjaxLink.java +++ b/src/main/java/com/gitblit/wicket/panels/SimpleAjaxLink.java @@ -15,9 +15,9 @@ */ package com.gitblit.wicket.panels; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.model.IModel; @@ -31,12 +31,12 @@ public abstract class SimpleAjaxLink extends AjaxLink { } @Override - protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { + public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObject().toString()); } public void setNoFollow() { Component c = get("link"); - c.add(new SimpleAttributeModifier("rel", "nofollow")); + c.add(new AttributeModifier("rel", "nofollow")); } } diff --git a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java index 15ebd67b..a06f9c4d 100644 --- a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java @@ -86,7 +86,7 @@ public class SshKeysPanel extends BasePanel { keys.addAll(app().keys().getKeys(user.username)); // update the panel - target.addComponent(SshKeysPanel.this); + target.add(SshKeysPanel.this); } } }; @@ -159,7 +159,7 @@ public class SshKeysPanel extends BasePanel { keys.addAll(app().keys().getKeys(user.username)); // update the panel - target.addComponent(SshKeysPanel.this); + target.add(SshKeysPanel.this); } } }); diff --git a/src/main/java/com/gitblit/wicket/panels/TagsPanel.java b/src/main/java/com/gitblit/wicket/panels/TagsPanel.java index f1f82739..36370842 100644 --- a/src/main/java/com/gitblit/wicket/panels/TagsPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/TagsPanel.java @@ -17,7 +17,6 @@ package com.gitblit.wicket.panels; import java.util.List; -import org.apache.wicket.RequestCycle; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; @@ -27,6 +26,7 @@ import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.request.cycle.RequestCycle; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Repository; diff --git a/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java b/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java index c15239fb..b247228b 100644 --- a/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; +import org.apache.wicket.AttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.repeater.Item; @@ -143,7 +143,7 @@ public class TicketListPanel extends BasePanel { } String background = MessageFormat.format("background-color:{0};", tLabel.color); - label.add(new SimpleAttributeModifier("style", background)); + label.add(new AttributeModifier("style", background)); labelItem.add(label); } }; diff --git a/src/main/java/com/gitblit/wicket/panels/TicketSearchForm.java b/src/main/java/com/gitblit/wicket/panels/TicketSearchForm.java index 91ef3924..32f133d1 100644 --- a/src/main/java/com/gitblit/wicket/panels/TicketSearchForm.java +++ b/src/main/java/com/gitblit/wicket/panels/TicketSearchForm.java @@ -22,7 +22,7 @@ import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.request.target.basic.RedirectRequestTarget; +//import org.apache.wicket.request.target.basic.RedirectRequestTarget; import com.gitblit.utils.StringUtils; import com.gitblit.wicket.SessionlessForm; -- 2.39.5