Skip to content

The Unified and Autonomous Development Platform

Merge branch 'master' of https://git.pmease.com/p/robin/commons

steve3b33ad2def55
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
index dcd4c377c0,e9781709b2..212016c714
--- a/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
@@@ -15,10 -15,6 +15,8 @@@ import org.apache.wicket.Page
import org.apache.wicket.Session;
import org.apache.wicket.bean.validation.BeanValidationConfiguration;
import org.apache.wicket.core.request.mapper.MountedMapper;
- import org.apache.wicket.devutils.stateless.StatelessChecker;
+import org.apache.wicket.markup.html.IPackageResourceGuard;
+import org.apache.wicket.markup.html.SecurePackageResourceGuard;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
@@@ -107,11 -103,8 +105,11 @@@ public class GitopWebApp extends Abstra
.mountLogoutPage("logout", LogoutPage.class).install(this);
mountPages();
+ configureResources();
- if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {
- getComponentPreOnBeforeRenderListeners().add(new StatelessChecker());
- }
- mountResources();
++// if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {
++// getComponentPreOnBeforeRenderListeners().add(new StatelessChecker());
++// }
}
public byte[] getDefaultUserAvatar() {
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java
index 9ae7e9732f,74508d4159..bf6c2b7060
--- a/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/WebModule.java
@@@ -33,32 -29,8 +29,9 @@@ public class WebModule extends Abstract
contribute(UserNameReservation.class, WebUserNameReservation.class);
install(new RestResourceModule());
-
- contribute(ProjectNameReservation.class, DefaultProjectNameReservation.class);
- contribute(UserNameReservation.class, DefaultUserNameReservation.class);
- }
-
- public static class DefaultProjectNameReservation implements ProjectNameReservation {
-
- @Override
- public Set<String> getReserved() {
- return ImmutableSet.<String>of(
- );
- }
}
-
- public static class DefaultUserNameReservation implements UserNameReservation {
- @Override
- public Set<String> getReserved() {
- return ImmutableSet.<String>of(
- "rest",
- "assets"
- );
- }
- }
-
+
@Provides
@Singleton
public ObjectMapper objectMapper() {
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/page/AbstractLayoutPage.java
index 8d7abea2c7,b34f17f44d..aade500437
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/AbstractLayoutPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/AbstractLayoutPage.java
@@@ -14,10 -14,10 +14,6 @@@ public abstract class AbstractLayoutPag
add(new GlobalHeaderPanel("header"));
}
-- protected boolean isSignedIn() {
-- return SecurityUtils.getSubject().isAuthenticated();
-- }
--
protected Optional<User> currentUser() {
User user = User.getCurrent();
if (user.isAnonymous()) {
@@@ -26,4 -26,4 +22,16 @@@
return Optional.of(user);
}
}
++
++ protected boolean isLoggedIn() {
++ return currentUser().isPresent();
++ }
++
++ protected boolean isRemembered() {
++ return SecurityUtils.getSubject().isRemembered();
++ }
++
++ protected boolean isAuthenticated() {
++ return SecurityUtils.getSubject().isAuthenticated();
++ }
}
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/page/BasePage.java
index 9cbaed55b1,97690bdf49..ce87f17cb9
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/BasePage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/BasePage.java
@@@ -23,10 -23,7 +23,9 @@@ import org.apache.wicket.request.mapper
import com.google.common.base.Strings;
import com.pmease.commons.util.StringUtils;
import com.pmease.gitop.core.Gitop;
-import com.pmease.gitop.web.assets.BaseResourceBehavior;
+import com.pmease.gitop.web.assets.BaseResourcesBehavior;
+import com.pmease.gitop.web.assets.PageResourcesBehavior;
+import com.pmease.gitop.web.common.component.messenger.MessengerResourcesBehavior;
- import com.pmease.gitop.web.common.component.modal.Modal;
import com.pmease.gitop.web.exception.AccessDeniedException;
import com.pmease.gitop.web.page.init.ServerInitPage;
@@@ -34,9 -31,9 +33,11 @@@
public abstract class BasePage extends WebPage {
private WebMarkupContainer body;
+
+ private boolean shouldInitialize = true;
- private Modal modal;
++// private Modal modal;
+
public BasePage() {
commonInit();
}
@@@ -52,26 -49,11 +53,27 @@@
}
private void commonInit() {
- if (!Gitop.getInstance().isReady() && getClass() != ServerInitPage.class) {
+ body = new TransparentWebMarkupContainer("body");
+ add(body);
+ body.add(AttributeAppender.append("class",
+ new AbstractReadOnlyModel<String>() {
+
+ @Override
+ public String getObject() {
+ String css = getPageCssClass();
+ return Strings.isNullOrEmpty(css) ? "" : css;
+ }
+ }));
+
- modal = new Modal("modal");
- add(modal);
++// modal = new Modal("modal");
++// add(modal);
+
+ if (!Gitop.getInstance().isReady()
+ && getClass() != ServerInitPage.class) {
- throw new RestartResponseAtInterceptPageException(
- ServerInitPage.class);
+ redirect(ServerInitPage.class);
}
+
+ shouldInitialize = true;
}
@Override
@@@ -152,11 -158,20 +178,8 @@@
protected boolean isPermitted() {
return true;
}
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
+
+ protected void onPageInitialize() {
- body = new TransparentWebMarkupContainer("body");
- add(body);
- body.add(AttributeAppender.append("class",
- new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- String css = getPageCssClass();
- return Strings.isNullOrEmpty(css) ? "" : css;
- }
- }));
-
if (!isPermitted()) {
throw new AccessDeniedException();
}
@@@ -187,11 -202,16 +210,20 @@@
* cause components with resources using global resources not working
* properly.
*/
- add(new BaseResourcesBehavior());
- add(new WebMarkupContainer("globalResourceBinder"));
- // .add(new BaseResourcesBehavior())
- add(MessengerResourcesBehavior.get());
- add(PageResourcesBehavior.get());
- add(new WebMarkupContainer("globalResourceBinder").add(new BaseResourceBehavior()));
++ add(new WebMarkupContainer("globalResourceBinder")
++ .add(new BaseResourcesBehavior())
++ .add(MessengerResourcesBehavior.get())
++ .add(PageResourcesBehavior.get()));
+ }
+
+ @Override
+ protected final void onInitialize() {
+ super.onInitialize();
+
- if (shouldInitialize) {
++ System.out.println("Still invoke onInitialize " + getClass());
++// if (shouldInitialize) {
+ onPageInitialize();
- }
++// }
}
protected abstract String getPageTitle();
@@@ -199,8 -219,4 +231,8 @@@
protected int getPageRefreshInterval() {
return 0;
}
+
- public Modal getModal() {
- return modal;
- }
++// public Modal getModal() {
++// return modal;
++// }
}
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
index d47397e9ba,efa559fd2c..6de2df8223
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
@@@ -43,16 -27,9 +43,16 @@@ public class AccountProfilePage extend
protected Category getSettingCategory() {
return Category.PROFILE;
}
-
- public AccountProfilePage() {
- add(new ProfileForm("form", new UserModel(getAccount())));
+
+ @Override
- protected void onInitialize() {
- super.onInitialize();
++ protected void onPageInitialize() {
++ super.onPageInitialize();
+
+ IModel<User> userModel = new UserModel(getAccount());
+ add(new ProfileForm("form", userModel));
+
+ add(new AvatarImage("currentavatar", userModel));
+ add(new AvatarForm("avatarForm", userModel));
}
private class ProfileForm extends Form<User> {
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/page/home/HomePage.java
index 593ed4bb6d,d6967247e1..13e50bd413
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/home/HomePage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/home/HomePage.java
@@@ -1,25 -1,17 +1,32 @@@
package com.pmease.gitop.web.page.home;
++import org.apache.wicket.devutils.stateless.StatelessComponent;
++
+import com.pmease.gitop.web.common.component.dropzone.DropZoneBehavior;
+import com.pmease.gitop.web.common.component.vex.VexLinkBehavior.VexIcon;
import com.pmease.gitop.web.page.AbstractLayoutPage;
++@StatelessComponent
public class HomePage extends AbstractLayoutPage {
private static final long serialVersionUID = 1L;
+
+ public HomePage() {
++ this.setStatelessHint(true);
+ }
@Override
protected String getPageTitle() {
return "Gitop - Home";
}
+ @Override
- protected void onInitialize() {
- super.onInitialize();
++ protected void onPageInitialize() {
++ super.onPageInitialize();
+
+ add(new DropZoneBehavior());
+ }
+
+ VexIcon vexIcon = VexIcon.INFO;
+ boolean displayed = true;
}
diff --cc gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
index 70cf000400,4c0cb007e5..8b29ecb954
--- a/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
@@@ -25,14 -23,9 +25,9 @@@ public class LoginPage extends Abstract
private static final Logger logger = LoggerFactory.getLogger(LoginPage.class);
public LoginPage() {
- if (isSignedIn()) {
+ if (SecurityUtils.getSubject().isAuthenticated()) {
throw new RestartResponseException(getApplication().getHomePage());
}
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
add(new LoginForm("login"));
FeedbackPanel feedback = new FeedbackPanel("feedback");
add(feedback);