mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
use ApplicationPropertiesService
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
package com.commafeed.frontend;
|
package com.commafeed.frontend;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
import javax.enterprise.inject.spi.BeanManager;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
@@ -38,6 +36,7 @@ import org.apache.wicket.util.cookies.CookieUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.commafeed.backend.services.ApplicationPropertiesService;
|
||||||
import com.commafeed.frontend.pages.DemoLoginPage;
|
import com.commafeed.frontend.pages.DemoLoginPage;
|
||||||
import com.commafeed.frontend.pages.HomePage;
|
import com.commafeed.frontend.pages.HomePage;
|
||||||
import com.commafeed.frontend.pages.LogoutPage;
|
import com.commafeed.frontend.pages.LogoutPage;
|
||||||
@@ -53,8 +52,8 @@ public class CommaFeedApplication extends AuthenticatedWebApplication {
|
|||||||
|
|
||||||
public CommaFeedApplication() {
|
public CommaFeedApplication() {
|
||||||
super();
|
super();
|
||||||
String prod = ResourceBundle.getBundle("application").getString("production");
|
boolean prod = ApplicationPropertiesService.get().isProduction();
|
||||||
setConfigurationType(Boolean.valueOf(prod) ? RuntimeConfigurationType.DEPLOYMENT : RuntimeConfigurationType.DEVELOPMENT);
|
setConfigurationType(prod ? RuntimeConfigurationType.DEPLOYMENT : RuntimeConfigurationType.DEVELOPMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,8 +70,7 @@ public class CommaFeedApplication extends AuthenticatedWebApplication {
|
|||||||
mountPage("error", DisplayExceptionPage.class);
|
mountPage("error", DisplayExceptionPage.class);
|
||||||
|
|
||||||
// mountPage("google/import/redirect", GoogleImportRedirectPage.class);
|
// mountPage("google/import/redirect", GoogleImportRedirectPage.class);
|
||||||
// mountPage(GoogleImportCallbackPage.PAGE_PATH,
|
// mountPage(GoogleImportCallbackPage.PAGE_PATH, GoogleImportCallbackPage.class);
|
||||||
// GoogleImportCallbackPage.class);
|
|
||||||
|
|
||||||
mountPage("next", NextUnreadRedirectPage.class);
|
mountPage("next", NextUnreadRedirectPage.class);
|
||||||
|
|
||||||
@@ -94,8 +92,7 @@ public class CommaFeedApplication extends AuthenticatedWebApplication {
|
|||||||
@Override
|
@Override
|
||||||
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
|
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
|
||||||
AjaxRequestTarget target = cycle.find(AjaxRequestTarget.class);
|
AjaxRequestTarget target = cycle.find(AjaxRequestTarget.class);
|
||||||
// redirect to the error page if ajax request, render error on
|
// redirect to the error page if ajax request, render error on current page otherwise
|
||||||
// current page otherwise
|
|
||||||
RedirectPolicy policy = target == null ? RedirectPolicy.NEVER_REDIRECT : RedirectPolicy.AUTO_REDIRECT;
|
RedirectPolicy policy = target == null ? RedirectPolicy.NEVER_REDIRECT : RedirectPolicy.AUTO_REDIRECT;
|
||||||
return new RenderPageRequestHandler(new PageProvider(new DisplayExceptionPage(ex)), policy);
|
return new RenderPageRequestHandler(new PageProvider(new DisplayExceptionPage(ex)), policy);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user