Skip to content

Commit

Permalink
Task #78 - wicket BasePage updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ak committed Jan 18, 2024
1 parent 9154273 commit 6458153
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.apache.wicket.core.util.crypt.KeyInSessionSunJceCryptFactory;
import org.apache.wicket.csp.CSPDirective;
import org.apache.wicket.csp.CSPDirectiveSrcValue;
import org.apache.wicket.markup.head.ResourceAggregator;
import org.apache.wicket.markup.head.filter.JavaScriptFilteredIntoFooterHeaderResponse;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Url;
Expand All @@ -33,11 +35,6 @@ protected void init() {
super.init();
//TODO think what to do with wicket csp
getCspSettings().blocking().disabled();
/*getCspSettings().blocking().clear()
.add(CSPDirective.DEFAULT_SRC, CSPDirectiveSrcValue.NONE)
.add(CSPDirective.SCRIPT_SRC, CSPDirectiveSrcValue.SELF)
.add(CSPDirective.IMG_SRC, CSPDirectiveSrcValue.SELF)
.add(CSPDirective.FONT_SRC, CSPDirectiveSrcValue.SELF);*/

getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory());
IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
Expand Down Expand Up @@ -69,6 +66,12 @@ protected void init() {
mountPage("terminal", TerminalPage.class);

mountPage("login", LoginPage.class);

getHeaderResponseDecorators().add(
response -> new ResourceAggregator(
new JavaScriptFilteredIntoFooterHeaderResponse(response, "footer-container")
)
);
}

// @Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<wicket:head>
<title>Srvlog log collector</title>
<link href="css/main.css" rel="stylesheet">
</wicket:head>
<body>
<div class="container-fluid">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import com.payneteasy.srvlog.wicket.page.detailed.FirewallAlertDataPage;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Page;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.CssReferenceHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.CssResourceReference;
import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.springframework.security.access.annotation.Secured;

Expand All @@ -35,6 +41,9 @@ public BasePage() {
public BasePage(PageParameters pageParameters, Class<? extends Page> pageClass) {
this.pageClass = pageClass;




//BAR MENU
addBarLink("dashboard", DashboardPage.class);
addBarLink("logs", LogMonitorPage.class);
Expand Down Expand Up @@ -83,6 +92,11 @@ protected void onRender() {
super.onRender();
}

@Override
public void renderHead(IHeaderResponse response) {
response.render(CssHeaderItem.forReference(new CssResourceReference(getClass(), "main.css")));
}

private void addBarLink(String linkId, Class<? extends Page> pageClass){
WebMarkupContainer webMarkupContainer = new WebMarkupContainer(linkId+"-container");
BookmarkablePageLink<Page> bookmarkablePageLink = new BookmarkablePageLink<Page>(linkId, pageClass);
Expand Down
File renamed without changes.

0 comments on commit 6458153

Please sign in to comment.