[CVE-2020-11976] Apache Wicket information disclosure vulnerability

2020-08-10 Thread svenmeier

Severity: Important

Vendor:
The Apache Software Foundation

Versions Affected:
Apache Wicket 7.16.0, 8.8.0 and 9.0.0-M5

Description:

By crafting a special URL it is possible to make Wicket deliver 
unprocessed HTML templates.
This would allow an attacker to see possibly sensitive information 
inside a HTML template that is usually removed during rendering.
For example if there are credentials in the markup which are never 
supposed to be visible to the client:


  
 some secret
  

The application developers are recommended to upgrade to:
- Apache Wicket 7.17.0

- Apache Wicket 8.9.0

- Apache Wicket 9.0.0


Credit:
The vulnerability has been found and reported by Mariusz Popławski from 
Afine.


Apache Wicket Team


[GitHub] wicket pull request #283: Wicket-6563 page store implementation

2018-12-11 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/283#discussion_r240615707
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/pageStore/DelegatingPageStore.java 
---
@@ -1,100 +1,76 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.page;
-
-import org.apache.wicket.util.lang.Args;
-
-/**
- * Decorator for {@link IPageManager}
- * 
- * @author igor
- */
-public class PageManagerDecorator implements IPageManager
-{
-   private final IPageManager delegate;
-
-   /**
-* Constructor
-* 
-* @param delegate
-*/
-   public PageManagerDecorator(IPageManager delegate)
-   {
-   Args.notNull(delegate, "delegate");
-   this.delegate = delegate;
-   }
-
-   @Override
-   public IPageManagerContext getContext()
-   {
-   return delegate.getContext();
-   }
-
-   @Override
-   public IManageablePage getPage(int id)
-   {
-   return delegate.getPage(id);
-   }
-
-   @Override
-   public void removePage(final IManageablePage page) {
-   delegate.removePage(page);
-   }
-
-   @Override
-   public void touchPage(IManageablePage page)
-   {
-   delegate.touchPage(page);
-   }
-
-   @Override
-   public void untouchPage(IManageablePage page)
-   {
-   delegate.untouchPage(page);
-   }
-
-   @Override
-   public boolean supportsVersioning()
-   {
-   return delegate.supportsVersioning();
-   }
-
-   @Override
-   public void commitRequest()
-   {
-   delegate.commitRequest();
-   }
-
-   @Override
-   public void newSessionCreated()
-   {
-   delegate.newSessionCreated();
-   }
-
-   @Override
-   public void clear()
-   {
-   delegate.clear();
-   }
-
-   @Override
-   public void destroy()
-   {
-   delegate.destroy();
-   }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.pageStore;
+
+import org.apache.wicket.page.IManageablePage;
+import org.apache.wicket.util.lang.Args;
+
+/**
+ * An {@link IPageStore} that delegates to another storage.
+ */
+public abstract class DelegatingPageStore implements IPageStore
+{
+   private final IPageStore delegate;
+   
+   protected DelegatingPageStore(IPageStore delegate) {
+   this.delegate = Args.notNull(delegate, "delegate");
+   }
+
+   public IPageStore getDelegate()
+   {
+   return delegate;
+   }
+   
+   /**
+* Versioning is supported depending on the delegate.
+*/
+   @Override
+   public boolean supportsVersioning()
+   {
+   return delegate.supportsVersioning();
+   }
+   
+   @Override
+   public void addPage(IPageContext context, IManageablePage page) {
--- End diff --

You're right, I'll do a reformat once we're ready to move this 
implemenation to master.


---


[GitHub] wicket pull request #283: Wicket-6563 page store implementation

2018-12-11 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/283#discussion_r240615436
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/pageStore/disk/NestedFolders.java 
---
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.pageStore.disk;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.wicket.util.file.Files;
+import org.apache.wicket.util.lang.Args;
+
+/**
+ * Helps creating nested folders.
+ * 
+ * @author svenmeier
+ */
+public class NestedFolders
+{
+   private final File base;
+   
+   /**
+* Create folders in the given base folder.
+* 
+* @param base base has to be a folder
+*/
+   public NestedFolders(File base) {
+   this.base = Args.notNull(base, "base");
+   }
+   
+   public File getBase()
+   {
+   return base;
+   }
+   
+   /**
+* Get a nested folder for the given name.
+* 
+* @param name name 
+* @param create
+* @return
+*/
+   public File get(String name, final boolean create) {
+   name = name.replace('*', '_');
+   name = name.replace('/', '_');
--- End diff --

I've moved that code from the old DiskDataStore implementation into this 
utility class. I think you're right, backslash should probably be escaped too.


---


[GitHub] wicket pull request #283: Wicket-6563 page store implementation

2018-12-11 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/283#discussion_r240608325
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java ---
@@ -167,6 +168,10 @@ protected IPageStore newPersistentStore()
Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
File fileStoreFolder = storeSettings.getFileStoreFolder();
 
-   return new DiskPageStore(application.getName(), 
fileStoreFolder, maxSizePerSession, getSerializer());
+   if (storeSettings.isEncrypted()) {
--- End diff --

This is a question of CoR vs a collection, like 
https://stackoverflow.com/questions/1055383/what-are-the-advantages-of-chain-of-responsibility-vs-lists-of-classes

I prefer the former, since it gives more power to each store, e.g. 
GroupingPageStore has to control delegation to the next store.
I don't think configurability is a huge issue, since page stores are pretty 
static once set up.


---


[GitHub] wicket issue #345: Change ClientSideImageMap to use shape 'poly' instead of ...

2018-12-10 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/345
  
Thanks!


---


[GitHub] wicket issue #343: [WICKET-6617] headers are added to header-items if specif...

2018-12-07 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/343
  
We should leave 7.x for people with support for  older browsers. Let them 
migrate to 8.x if they need newer features.


---


[GitHub] wicket issue #297: Improve AjaxLazyLoadPanel's functionality.

2018-12-07 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/297
  
As explained above we won't apply this pull request.
Please close it and open separate requests for specific issues you see with 
the current implementation and don't force an API break.


---


[GitHub] wicket issue #342: Wicket 6616 always render new pages

2018-12-03 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/342
  
This needs a thorough discussion of a solution for 9.x.


---


[GitHub] wicket issue #342: Wicket 6616 always render new pages

2018-12-03 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/342
  
Ok, you're right, that would be an improvement.
IMHO this change is to big to introduce in a 8.x release though.

I'd say we revert WICKET-6608 (which as is allows even more components to 
be accessed unprepared now) and try to find a better solution for 9.x.


---


[GitHub] wicket pull request #343: [WICKET-6617] headers are added to header-items if...

2018-12-03 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/343#discussion_r238201851
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
---
@@ -2116,10 +2116,15 @@
 
// Adds the element to page head
addElement: function (element) {
-   var head = 
document.getElementsByTagName("head");
+   var headItems = document.querySelector('head 
meta[name="wicket.header.items"]');
--- End diff --

Seems we haven't used querySelector() before - are we increasing the 
minimum supported browser version with this?


---


[GitHub] wicket pull request #343: [WICKET-6617] headers are added to header-items if...

2018-12-03 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/343#discussion_r238198570
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HtmlHeaderContainer.java
 ---
@@ -161,19 +161,19 @@ public final void onComponentTagBody(MarkupStream 
markupStream, ComponentTag ope
final StringResponse response = new StringResponse();
getRequestCycle().setResponse(response);
 
-   IHeaderResponse headerResponse = getHeaderResponse();
-   if (!response.equals(headerResponse.getResponse()))
-   {
-   
getRequestCycle().setResponse(headerResponse.getResponse());
-   }
+   try (IHeaderResponse headerResponse = 
getHeaderResponse()) {
+   if 
(!response.equals(headerResponse.getResponse()))
+   {
+   
getRequestCycle().setResponse(headerResponse.getResponse());
+   }
 
-   // Render the header sections of all components on the 
page
-   AbstractHeaderRenderStrategy.get().renderHeader(this,
-   new HeaderStreamState(markupStream, openTag), 
getPage());
+   // Render the header sections of all components 
on the page
+   
AbstractHeaderRenderStrategy.get().renderHeader(this,
+   new HeaderStreamState(markupStream, 
openTag), getPage());
 
-   // Close the header response before rendering the 
header container itself
-   // See https://issues.apache.org/jira/browse/WICKET-3728
-   headerResponse.close();
--- End diff --

Thanks understood :)


---


[GitHub] wicket issue #342: Wicket 6616 always render new pages

2018-12-02 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/342
  
>Components like FeddbackPanel can not work properly anymore.
That's not the case - feedbackPanels are explicitly not prepared for render.

I'm not sure using a new page instance is right either: the developer might 
want to keep some state during a single request. Your commit results int all 
feedback messages getting lost, doesn't it?


---


[GitHub] wicket pull request #343: [WICKET-6617] headers are added to header-items if...

2018-12-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/343#discussion_r238106752
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HtmlHeaderContainer.java
 ---
@@ -161,19 +161,19 @@ public final void onComponentTagBody(MarkupStream 
markupStream, ComponentTag ope
final StringResponse response = new StringResponse();
getRequestCycle().setResponse(response);
 
-   IHeaderResponse headerResponse = getHeaderResponse();
-   if (!response.equals(headerResponse.getResponse()))
-   {
-   
getRequestCycle().setResponse(headerResponse.getResponse());
-   }
+   try (IHeaderResponse headerResponse = 
getHeaderResponse()) {
+   if 
(!response.equals(headerResponse.getResponse()))
+   {
+   
getRequestCycle().setResponse(headerResponse.getResponse());
+   }
 
-   // Render the header sections of all components on the 
page
-   AbstractHeaderRenderStrategy.get().renderHeader(this,
-   new HeaderStreamState(markupStream, openTag), 
getPage());
+   // Render the header sections of all components 
on the page
+   
AbstractHeaderRenderStrategy.get().renderHeader(this,
+   new HeaderStreamState(markupStream, 
openTag), getPage());
 
-   // Close the header response before rendering the 
header container itself
-   // See https://issues.apache.org/jira/browse/WICKET-3728
-   headerResponse.close();
--- End diff --

Why no close() any longer?


---


[GitHub] wicket pull request #342: Wicket 6616 always render new pages

2018-12-01 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/342

Wicket 6616 always render new pages

Question: Should Wicket always render new pages before any component in it 
is accessed?

  * until 8.1.0
* components can be accessed **un-rendered** when already inside the 
page hierarchy
* then the page is prepared for render
* any component added in onInitialize() or onBeforeRender() can be 
accessed **rendered**
  * since 8.2.0 (WICKET-6608)
* components can be accessed **un-rendered** when already inside the 
page hierarchy
* then the page is initialized
* any component added in onInitialize()  (e.g. through queueing) can be 
accessed **rendered**
* then the page is prepared for render
* any component added in onBeforeRender() can be accessed **rendered**

IMHO all these cases should allow access to **rendered** component only.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6616-render-new-pages

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/342.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #342


commit 7b2bb1162dd80e6faab9fb9f0fc30c0d153a4bd2
Author: Sven Meier 
Date:   2018-11-30T15:10:18Z

Revert "WICKET-6608 Stateless page, mix of queue and add can cause 
unforseen"

This reverts commit 61c8709389cea30975814530f53dd0ae1f1ea592.

commit a446138852fe1748ff879d85bced1b19f8af444e
Author: Sven Meier 
Date:   2018-11-30T15:10:21Z

Revert "WICKET-6608 added test case"

This reverts commit 86f92fc8cfaf4ec15409908455d049f9466c542e.

commit 557115433e3485fc6ab50607ae930ff46c14c80a
Author: Sven Meier 
Date:   2018-12-01T20:14:40Z

WICKET-6616 always render new pages




---


[GitHub] wicket issue #297: Improve AjaxLazyLoadPanel's functionality.

2018-11-07 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/297
  
IMHO most people will want to show different contents depending on the 
result of lazy loading - I doubt that anyone would want to give up polling but 
keep the loading anymation - so they will need to transfer the result from 
isContentReady() to getLazyLoadComponent() anyways. I don't like to use an enum 
for that, as this will lead to even more enum values. It's just simpler to keep 
this information as a member variable.
We could have joined isContentReady() and getLazyLoadComponent() into a 
single method, but I tried to keep the API somewhat similar to 7.x.

Regarding the initial update interval: yes, I agree that this could be 
improved. Note however that you are calling getUpdateInterval() too early in 
bind() - at that moment not all AjaxLazyLoadPanel might exist yet.
Furthermore I made sure that at least one request is fired, to keep the 
class backwards-compatible to 7.x with isContentReady() returning true by 
default.



---


[GitHub] wicket issue #283: Wicket-6563 page store implementation

2018-10-30 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/283
  
I've rebased, sqashed and forced-pushed for easier review.


---


[GitHub] wicket issue #300: [WICKET-6603] Asypc page/data store destroyed without han...

2018-10-25 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/300
  
I like to minimize the count of member variables:

```
@Override
public void destroy()
{
final Thread pageSavingThread = this.pageSavingThread;
this.pageSavingThread = null;
if (pageSavingThread.isAlive())
{
try
{
pageSavingThread.join();

@Override
public void storePage(String sessionId, IManageablePage page)
{
if (pageSavingThread == null)
{
return;
}
```

Your boolean works fine too.


---


[GitHub] wicket issue #297: Improve AjaxLazyLoadPanel's functionality.

2018-10-25 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/297
  
I don't see a need for State#TERMINATED: If a component wants to end 
polling, it can just return contentReady=true and return something appropriate 
... e.g. a timed-out label or even an identical loading component that was 
shown before.


---


[GitHub] wicket issue #294: WICKET-5552 fix modal mousedown and make modal more exten...

2018-10-15 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/294
  
I've fixed WICKET-5552, please open a new pull request if you think 
ModalWindow is in need of further extensibility.


---


[GitHub] wicket issue #295: WICKET-6586 Broken JavaScript due to fix charsetName in J...

2018-10-15 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/295
  
+1


---


[GitHub] wicket issue #294: WICKET-5552 fix modal mousedown and make modal more exten...

2018-10-13 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/294
  
It is used by ModalWindow and the Ajax debug console only - if we can agree 
to remove the latter (has been discussed a few years already), we can just move 
the code to modal.js
But that's a separate discussion.


---


[GitHub] wicket issue #294: WICKET-5552 fix modal mousedown and make modal more exten...

2018-10-12 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/294
  
I'm still not happy about the change :/.

Note that for Wicket 9 I want to move all Drag-handling from wicket-ajax to 
modal.js - we don't need it really in the former and for modal we'll have it 
easier to adjust it.

For now we could allow the start handler to veto the drag:

```
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 18ab6bd..e71b4e8 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2476,14 +2476,16 @@
 
var element = this;
 
+   if (element.wicketOnDragBegin(element, e) === 
false) {
+   return;
+   }
+
Wicket.Event.stop(e);
 
if (e.preventDefault) {
e.preventDefault();
}
 
-   element.wicketOnDragBegin(element);
-
element.lastMouseX = e.clientX;
element.lastMouseY = e.clientY;
 
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index b00ceec..6d63807 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -901,7 +901,12 @@
/**
 * Called when dragging has started.
 */
-   onBegin: function(object) {
+   onBegin: function(element, event) {
+   // ignore anything inside the content
+   if (jQuery(event.target).closest('.w_content_2').size() 
) {
+   return false;
+   }
+   
if (this.isIframe() && (Wicket.Browser.isGecko() || 
Wicket.Browser.isIELessThan11() || Wicket.Browser.isSafari())) {
this.revertList = [];
Wicket.Iframe.documentFix(document, 
this.revertList);
@@ -1183,7 +1188,7 @@
""+
""+
""+
-   ""+
+   ""+
""+

""+

""+

```


---


[GitHub] wicket issue #294: WICKET-5552 fix modal mousedown and make modal more exten...

2018-10-11 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/294
  
Ha, that's really some crufty code :)

Just noticed that you filed the issue for Wicket 6.x - note that we will 
only apply security fixes for that version.


---


[GitHub] wicket issue #294: WICKET-5552 fix modal mousedown and make modal more exten...

2018-10-10 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/294
  
Why so complicated - I've fixed the issue by removing the mouse blocker 
from modal.js and restricting any dragging on the element itself:

```
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 64852de..8d94b36 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2485,6 +2485,10 @@
 
mouseDownHandler: function (e) {
e = Wicket.Event.fix(e);
+   
+   if (e.target !== this) {
+   return;
+   }
 
var element = this;
 
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index f683119..5a0f122 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -1189,7 +1189,7 @@
""+
""+
""+
-   ""+
+   ""+
""+

""+

""+
```
Can you try that instead?


---


[GitHub] wicket issue #292: WICKET-6587 make CheckBoxSelector extensible

2018-09-21 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/292
  
Ah, I didn't notice your cleanup behavior. That's an improvement to the old 
solution already +1.

I just think that a dynamic lookup with an overriden #getCheckBoxes() would 
be more flexible. Why not do both: Add the cleanup all checkboxes passed in the 
constructor *and* let users override the lookup method if they want/need to.


---


[GitHub] wicket issue #292: WICKET-6587 make CheckBoxSelector extensible

2018-09-18 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/292
  
Why not add a lookup to CheckBoxSelector instead:

```
public CheckBoxSelector(String id, CheckBox... boxes)
{
super(id);

connectedCheckBoxes = boxes;
}

/**
 * Override if you need want the boxes to be collected dynamically.
 */
protected List getCheckBoxes() {
return Arrays.asList(connectedCheckBoxes);
}

@Override
protected CharSequence getFindCheckboxesFunction()
{
return 
String.format("Wicket.CheckboxSelector.getCheckboxesFunction(%s)",
buildMarkupIdJSArrayLiteral(getCheckBoxes()));
}
```
No need to hold references to all checkboxes, with the possibility of 
leakage when one is removed.


---


[GitHub] wicket issue #287: Considering upgrading to Junit5

2018-08-07 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/287
  
+1 from me too


---


[GitHub] wicket pull request #283: Wicket-6563 page store implementation

2018-07-09 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/283

Wicket-6563 page store implementation

Basically I propose to
*unify IPageStore with IDateStore
*allow all IPageStore implementations to use Request/Session data (see 
DiskPageStore, GroupingPageStore and CryptingPageStore) as needed
*cut down PageStoreManager to a very simple manager with a chain of stores, 
each offering different solutions.

I appreciate your feedback.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6563

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/283.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #283


commit bcf76f517310ac5d27a2092595c3a925c3973067
Author: Sven Meier 
Date:   2018-06-25T15:19:41Z

WICKET-6563 new IPageStore implementation

commit a3604f7c359f9bbd2df03d57831c3f0d838ef521
Author: Sven Meier 
Date:   2018-07-03T18:18:10Z

WICKET-6563 allow passing of SerializedPage

between page stores

commit ad1f9b88ce8412e2b8eec5de72073b9688deb3bb
Author: Sven Meier 
Date:   2018-07-03T21:52:10Z

WICKET-6563 javadoc and test

for SerializingPageStore; keep page type in serializedpage

commit 2f70db06d3aa7f1ee07c96e1287507fe0021f18e
Author: Sven Meier 
Date:   2018-07-05T18:09:49Z

WICKET-6563 crypt page store

commit 7e9c7e5166fda6692163c9551dc56d3177acfe6d
Author: Sven Meier 
Date:   2018-07-07T18:37:54Z

WICKET-6563 IPageContext set synchronization

prevent multiple threads from settings data into IPageContext
concurrently

commit fd7b26bac6f72d5ebc647f490263c41f169faec1
Author: Sven Meier 
Date:   2018-07-09T08:54:57Z

WICKET-6563 improved test




---


[GitHub] wicket pull request #280: WICKET-6555 reuse code

2018-05-29 Thread svenmeier
Github user svenmeier closed the pull request at:

https://github.com/apache/wicket/pull/280


---


[GitHub] wicket pull request #280: WICKET-6555 reuse code

2018-05-28 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/280

WICKET-6555 reuse code

- reuse label position
- reuse iterating choices
- reuse value rendering and escaping
- override getDefaultChoice() return empty string

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6555-choices

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #280


commit 263fcdc65967330310df95896ca9e935bdd837f9
Author: Sven Meier <svenmeier@...>
Date:   2018-05-28T16:34:26Z

WICKET-6555 reuse code

override getDefaultChoice() return empty string




---


[GitHub] wicket issue #278: Changed order of elements in the DataTable's HTML

2018-05-04 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/278
  
IIRC the current ordering () was chosen deliberately 
to conform to the HTML standard, but it seems this has changed with HTML5:


https://stackoverflow.com/questions/18901950/thead-tfoot-and-tbody-order-in-html5?rq=1

So we might choose to change the default markup, please open an issue 
and/or a discussion/vote for this. For now you can just use your custom markup 
in a custom subclass.


---


[GitHub] wicket pull request #275: [WICKET-6544] mobile browser detection is improved...

2018-04-26 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/275#discussion_r184288167
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
 ---
@@ -133,24 +140,99 @@ public final String getUserAgent()
}
 
/**
-* returns the user agent string (lower case).
+* Initializes the {@link WebClientInfo} user agent detection. This can 
be overridden to choose
+* a different detection as YAUAA 
(https://github.com/nielsbasjes/yauaa) - if you do so, you
+* might exclude the maven dependency from your project in favor of a 
different framework.
+*/
--- End diff --

No, you can't exclude the dependency - with UserAgentAnalyzer in the 
signature of #detectBrowserProperties(UserAgentAnalyzer) you will get a 
NoClassDefFoundError if the dependency is not present.


---


[GitHub] wicket issue #275: [WICKET-6544] mobile browser detection is improved (with ...

2018-04-26 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/275
  
My concerns still hold :(

Most importantly: with that single UserAgentAnalyzer instance you've 
introduced a bottleneck for all concurrent request that need to 
gatherExtendedInfo().


---


[GitHub] wicket pull request #275: [WICKET-6544] mobile browser detection is improved...

2018-04-13 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/275#discussion_r181308489
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
 ---
@@ -46,14 +46,20 @@
 
/**
 * The user agent string from the User-Agent header, app. 
Theoretically, this might differ from
-* {@link 
org.apache.wicket.protocol.http.ClientProperties#isNavigatorJavaEnabled()} 
property, which is
-* not set until an actual reply from a browser (e.g. using {@link 
BrowserInfoPage} is set.
+* {@link 
org.apache.wicket.protocol.http.ClientProperties#isNavigatorJavaEnabled()} 
property,
+* which is not set until an actual reply from a browser (e.g. using 
{@link BrowserInfoPage} is
+* set.
 */
private final String userAgent;
 
/** Client properties object. */
private final ClientProperties properties;
 
+   private final static UserAgentAnalyzer UAA = 
UserAgentAnalyzer.newBuilder()
--- End diff --

UserAgentAnalyzer#parse(UserAgent) is synchronized, please check its code. 
This is even mentioned on the project home page.


---


[GitHub] wicket pull request #275: [WICKET-6544] mobile browser detection is improved...

2018-04-12 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/275#discussion_r181224559
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
 ---
@@ -46,14 +46,20 @@
 
/**
 * The user agent string from the User-Agent header, app. 
Theoretically, this might differ from
-* {@link 
org.apache.wicket.protocol.http.ClientProperties#isNavigatorJavaEnabled()} 
property, which is
-* not set until an actual reply from a browser (e.g. using {@link 
BrowserInfoPage} is set.
+* {@link 
org.apache.wicket.protocol.http.ClientProperties#isNavigatorJavaEnabled()} 
property,
+* which is not set until an actual reply from a browser (e.g. using 
{@link BrowserInfoPage} is
+* set.
 */
private final String userAgent;
 
/** Client properties object. */
private final ClientProperties properties;
 
+   private final static UserAgentAnalyzer UAA = 
UserAgentAnalyzer.newBuilder()
--- End diff --

UserAgentAnalyzer isn't reentrant. Since it is expensive to create one, 
instances have to be pooled.


---


[GitHub] wicket issue #273: WICKET-6321 Support Integrity and Crossorigin attributes

2018-04-07 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/273
  
@kbachl all jQuery 3.x should work fine. If you think Wicket should switch 
to v3 as default, you an open anothe issue. For me v2 is fine though.


---


[GitHub] wicket issue #273: WICKET-6321 Support Integrity and Crossorigin attributes

2018-04-06 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/273
  
@tremel thanks for your usage example.

It seems to me we're mixing at least three topics in this pull request:
- JavaScriptReferenceHeaderItem needs integrity and and crossOrigin ... fine
- JavaScriptUtils#writeJavaScriptUrl() is getting to many parameters, maybe 
an attribute map can help here?
- references cannot alter the attributes of their headerItem (besides the 
url of course): defer, async, charset and now integrity and crossOrigin

IMHO we should solve the last issue separately and uniformly, i.e. not 
IntegrityAttributed but maybe a broader interface for all attributes or just a 
callback that allows the reference to alter the headerItem.
For now you could use an IHeaderResponseDecorator to set the attributes.


---


[GitHub] wicket issue #269: [WICKET-6544] mobile browser detection is improved

2018-04-05 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/269
  
Guys I get it, there are many good solutions to choose from, but why should 
we make Wicket dependent on anyone of them?

https://github.com/nielsbasjes/yauaa looks good, but do users really need 
assistance for this?

`UserAgent  userAgent = analyzer.parse(new 
WebClientInfo(requestCycle).getUserAgent());`


---


[GitHub] wicket pull request #273: WICKET-6321 Support Integrity and Crossorigin attr...

2018-04-03 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/273#discussion_r178753738
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
 ---
@@ -201,7 +202,13 @@ public static JavaScriptReferenceHeaderItem 
forReference(ResourceReference refer
public static JavaScriptReferenceHeaderItem 
forReference(ResourceReference reference,
PageParameters pageParameters, String id, boolean defer, String 
charset)
{
-   return new JavaScriptReferenceHeaderItem(reference, 
pageParameters, id, defer, charset, null);
+final JavaScriptReferenceHeaderItem 
javaScriptReferenceHeaderItem = new JavaScriptReferenceHeaderItem(reference, 
pageParameters, id, defer, charset, null);
+if(reference instanceof IntegrityAttributed) {
--- End diff --

Does a reference really need to be able to decide about integrity 
attributes? It can't change charset or defer either, why are integrity 
attributes treated differently?


---


[GitHub] wicket pull request #273: WICKET-6321 Support Integrity and Crossorigin attr...

2018-04-03 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/273#discussion_r178752934
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java
 ---
@@ -151,6 +152,30 @@ public static void writeJavaScriptUrl(final Response 
response, final CharSequenc
 */
public static void writeJavaScriptUrl(final Response response, final 
CharSequence url,
final String id, boolean defer, String charset, boolean async)
+   {
+writeJavaScriptUrl(response, url, id, defer, charset, 
async, null);
+   }
+   /**
+* Write a reference to a javascript file to the response object
+* 
+* @param response
+*The HTTP response
+* @param url
+*The javascript file URL
+* @param id
+*Unique identifier of element
+* @param defer
+*specifies that the execution of a script should be 
deferred (delayed) until after
+*the page has been loaded.
+* @param charset
+*a non null value specifies the charset attribute of the 
script tag
+* @param async
+*specifies that the script can be loaded asynchronously by 
the browser
+ * @param integrity
+ *integrity attributes
+*/
+   public static void writeJavaScriptUrl(final Response response, final 
CharSequence url,
+   final String id, boolean defer, String charset, boolean async, 
final IntegrityAttributed integrity)
--- End diff --

Perhaps it's better to switch to an attribute map instead? The method had 
too much parameters already.


---


[GitHub] wicket issue #273: WICKET-6321 Support Integrity and Crossorigin attributes

2018-04-03 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/273
  
@klopfdreh indeed, now is the time to reconsider the former decision  :+1: 


---


[GitHub] wicket issue #271: EnclosureContainer - added missing super.onConfigure() ca...

2018-03-29 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/271
  
Thanks :+1: 


---


[GitHub] wicket pull request #258: Wicket 6498 deferred javascript made simple

2018-02-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/258#discussion_r165725617
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
 ---
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.head.filter;
+
+import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.markup.head.AbstractJavaScriptReferenceHeaderItem;
+import org.apache.wicket.markup.head.HeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.IWrappedHeaderItem;
+import org.apache.wicket.markup.head.JavaScriptContentHeaderItem;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.DecoratingHeaderResponse;
+import org.apache.wicket.page.PartialPageUpdate;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.util.string.Strings;
+
+/**
+ * A header response that defers all {@link 
AbstractJavaScriptReferenceHeaderItem}s.
+ * 
+ * To prevent any error because of possible dependencies to referenced 
JavaScript files
+ * *all* {@link JavaScriptHeaderItem}s are replaced with suitable 
implementations that
+ * delay any execution until {@link 
AbstractJavaScriptReferenceHeaderItem}s have been loaded.
+ * 
+ * @author svenmeier
++ */
+public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse
+{
+   /**
+* Decorate the given response.
+* 
+* @param response
+*/
+   public JavaScriptDeferHeaderResponse(IHeaderResponse response)
+   {
+   super(response);
+   }
+   
+   @Override
+   public void render(HeaderItem item)
+   {
+   if (item instanceof IWrappedHeaderItem) {
--- End diff --

I've changed it to 'while', this unwraps recursively nested header items.


---


[GitHub] wicket pull request #258: Wicket 6498 deferred javascript made simple

2018-02-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/258#discussion_r165725214
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
 ---
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.head.filter;
+
+import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.markup.head.AbstractJavaScriptReferenceHeaderItem;
+import org.apache.wicket.markup.head.HeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.IWrappedHeaderItem;
+import org.apache.wicket.markup.head.JavaScriptContentHeaderItem;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.DecoratingHeaderResponse;
+import org.apache.wicket.page.PartialPageUpdate;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.util.string.Strings;
+
+/**
+ * A header response that defers all {@link 
AbstractJavaScriptReferenceHeaderItem}s.
+ * 
+ * To prevent any error because of possible dependencies to referenced 
JavaScript files
+ * *all* {@link JavaScriptHeaderItem}s are replaced with suitable 
implementations that
+ * delay any execution until {@link 
AbstractJavaScriptReferenceHeaderItem}s have been loaded.
+ * 
+ * @author svenmeier
++ */
+public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse
+{
+   /**
+* Decorate the given response.
+* 
+* @param response
+*/
+   public JavaScriptDeferHeaderResponse(IHeaderResponse response)
+   {
+   super(response);
+   }
+   
+   @Override
+   public void render(HeaderItem item)
+   {
+   if (item instanceof IWrappedHeaderItem) {
+   item = ((IWrappedHeaderItem)item).getWrapped();
+   }
+
+   if (item instanceof AbstractJavaScriptReferenceHeaderItem) {
+   
((AbstractJavaScriptReferenceHeaderItem)item).setDefer(true);
+   } else if (item instanceof JavaScriptContentHeaderItem) {
+   item = new 
NativeOnDomContentLoadedHeaderItem(((JavaScriptContentHeaderItem)item).getJavaScript());
+   } else if (item instanceof OnDomReadyHeaderItem) {
+   item = new 
NativeOnDomContentLoadedHeaderItem(((OnDomReadyHeaderItem)item).getJavaScript());
+   } else if (item instanceof OnLoadHeaderItem) {
+   item = new 
NativeOnLoadHeaderItem(((OnLoadHeaderItem)item).getJavaScript());
+   }
+   
+   super.render(item);
+   }
+
+   /**
+* A specialization that uses native "DOMContentLoaded" events without 
dependency to external JavaScript.
+* 
+* For Ajax requests we utilize the fact, that {@link 
PartialPageUpdate} renders {@link #getJavaScript()} only,
+* executing the JavaScript directly without any event registration.
+*/
+   private class NativeOnDomContentLoadedHeaderItem extends 
OnDomReadyHeaderItem
--- End diff --

Sure.


---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-31 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
Merged into master


---


[GitHub] wicket pull request #258: Wicket 6498 deferred javascript made simple

2018-01-31 Thread svenmeier
Github user svenmeier closed the pull request at:

https://github.com/apache/wicket/pull/258


---


[GitHub] wicket issue #223: WICKET-6427 Fire an event once all ajax timers are regist...

2018-01-29 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/223
  
>should we just always include them

Good question. IMHO it would make sense to always fire these 'new' events.


---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-28 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
Ah, that one is easy: Your header item is defining a function "wbAction". 
With deferred items this function is now defined inside the 'DOMContentLoaded' 
callback only.

This is one of the corner cases that can be solved in client only:

```
private static StringBuilder getNamedFunctionStr(String name, 
AbstractDefaultAjaxBehavior b, CallbackParameter... extraParameters) {
StringBuilder sb = new StringBuilder();
sb.append("window.").append(name).append(" = function(");
boolean first = true;
for (CallbackParameter curExtraParameter : extraParameters) {
if (curExtraParameter.getFunctionParameterName() != 
null) {
if (first) {
first = false;
} else {
sb.append(',');
}

sb.append(curExtraParameter.getFunctionParameterName());
}
}
sb.append(") {\n");
sb.append(b.getCallbackFunctionBody(extraParameters));
sb.append("}\n;");
return sb;
}
```


---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-27 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
This was an issue with WICKET_6503, which is now fixed on master. Thanks 
Maxim!

So back to deferred JavaScript :)  


---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-27 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
Anything related to setAuto() must be magic.


---


[GitHub] wicket pull request #261: Wicket 6523 ajax timers

2018-01-26 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/261

Wicket 6523 ajax timers

Another Ajax timers improvement.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6523-ajax-timers

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/261.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #261


commit 810185e66b574b66a5f2039f17f6e32ffdf47cea
Author: Sven Meier <svenmeier@...>
Date:   2017-12-14T06:55:53Z

WICKET-6503 beforeRender clean-up

- prepare all components before writing them to Ajax response
- simplified delayed preparation of feedbacks
- clean-up internal component API an flags

this closes #250

commit e3ab0c3bebd1b8f859e8a9ebebe38653bc964eea
Author: Martijn Dashorst <martijn.dashorst@...>
Date:   2018-01-14T13:32:13Z

Release wicket-eclipse-settings 4

commit 0b720dfa707ee2601a085f81df7ac4cb7dfe2846
Author: Martijn Dashorst <martijn.dashorst@...>
Date:   2018-01-18T09:54:56Z

Upgrade eclipse settings for Java 8

commit 9d260688dc893dedbe13330f555be078eb53afbd
Author: Sven Meier <svenmeier@...>
Date:   2018-01-19T15:54:19Z

WICKET-6503 update component lifecycle

commit 883db38419977da450eaac81fbe3356542e0c845
Author: Sven Meier <svenmeier@...>
Date:   2018-01-24T18:42:40Z

WICKET-6523 remove timer handle as soon as possible

commit cf315b0fd1b3b442aee32fd6b572276cda92d686
Author: Sven Meier <svenmeier@...>
Date:   2018-01-24T18:46:27Z

WICKET-6523 restarting should re-set the timeout

commit d06c28b3f62db6bb8a66581d21e3ac452325c27a
Author: Sven Meier <svenmeier@...>
Date:   2018-01-24T21:15:09Z

WICKET-6523 use behaviorId for timerId

commit 6eb29bb4af22fd851a94b3b3bcc203ec10070b53
Author: Sven Meier <svenmeier@...>
Date:   2018-01-24T21:30:31Z

WICKET-6523 timerId can no longer be used

to search for markup owning a timer, but timers will be removed by 
onRemove() callback anyway

commit cdfffcb6fa4465ef5032b6354792e2cf46d0eba9
Author: Sven Meier <svenmeier@...>
Date:   2018-01-25T16:09:16Z

WICKET-6523 browser auto start; fixed version parameter

when choosing from modules or filtering




---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-26 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
Hm, that would be an error on my other building site :P

I have no clue what might causing this atm.



---


[GitHub] wicket issue #258: Wicket 6498 deferred javascript made simple

2018-01-26 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/258
  
Seems to work in wicket-examples. What's the difference?


---


[GitHub] wicket issue #253: WICKET-6498 deferred javascript

2018-01-23 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/253
  
There aren't many test to check - the new pull request does not change the 
current Ajax implementation at all :p. IMHO that's a huge advantage.


---


[GitHub] wicket issue #253: WICKET-6498 deferred javascript

2018-01-23 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/253
  
@solomax I'm sorry for all the hard work you put into fixing the tests, but 
#258 is much better than this initial solution. Closing.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-23 Thread svenmeier
Github user svenmeier closed the pull request at:

https://github.com/apache/wicket/pull/253


---


[GitHub] wicket issue #253: WICKET-6498 deferred javascript

2018-01-22 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/253
  
Many thanks Maxim for your work on this!

But with #258 we have a much simpler solution now, that should please those 
that are sceptical about the changes presented here.

If no one objects, I'll close this pull request.


---


[GitHub] wicket pull request #258: Wicket 6498 deferred javascript made simple

2018-01-22 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/258

Wicket 6498 deferred javascript made simple

This is a much simpler solution than #253: Applications can just use a 
JavaScriptDeferHeaderResponse and that's it.

Application has to be changed slightly in its handling of 
IHeaderResponseDecorators: there's always a decorator that applies a 
ResourceAggregator - this enables us to chain a header response *behind* the 
ResourceAggregator.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket 
WICKET-6498_deferred_javascript_2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/258.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #258


commit c89546bf04cea718ee47cf80ae41e447f90975af
Author: Sven Meier <svenmeier@...>
Date:   2018-01-22T10:33:46Z

WICKET-6498 JavaScriptDeferHeaderResponse

- translates OnDomReady and Load header items to their native non-jquery 
equivalents
- application uses a default IHeaderResponseDecorator now, that decorates 
with the ResourceAggregator; this allows to chain header response before and 
*after* the aggregator

commit a8588aa1a371599f09e2d8b7b5752aac57308c9a
Author: Sven Meier <svenmeier@...>
Date:   2018-01-22T10:45:36Z

WICKET-6498 always add event listener regardless of readyState

for Ajax requests PartialPageUpdate will pack all OnDomReady and OnLoad 
items into an  block anyways




---


[GitHub] wicket issue #253: WICKET-6498 deferred javascript

2018-01-21 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/253
  
Nope, not yet please. I have a new idea I want to try out.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-19 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r162726991
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java
 ---
@@ -263,14 +262,12 @@ public void markRendered(Object object)
}
};
 
-   ResourceAggregator resourceAggregator = new 
ResourceAggregator(headerRenderer);
-
for (HeaderItem curItem : resp)
{
-   resourceAggregator.render(curItem);
+   headerRenderer.render(curItem);
--- End diff --

Thanks Maxim, I'll take a look.


---


[GitHub] wicket pull request #256: WICKET-6517 ajax multipart

2018-01-17 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/256#discussion_r161984002
  
--- Diff: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxFileUploadBehavior.java
 ---
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.extensions.ajax.markup.html;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxEventBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.html.form.upload.FileUpload;
+import org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest;
+import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.lang.Bytes;
+
+/**
+ * Uploads files from a drop event.
+ * 
+ * @author svenmeier
+ */
+public class AjaxFileUploadBehavior extends AjaxEventBehavior
--- End diff --

I've changed it to AjaxFileDropBehavior.
I don't think we can and should provide behaviors for all corner cases - 
people will probably have to build their own implementation as needed. This 
simple class is just a great way to show the importance of the changes to 
wicket-ajax-jquery.js


---


[GitHub] wicket issue #257: [WICKET-6518] Log4j is replaced with slf4j-simple

2018-01-15 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/257
  
+1


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-12 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r161314468
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java 
---
@@ -337,24 +338,27 @@ private void renderCombinedEventScripts()
if (combinedScript.length() > 0)
{

combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);");
-   getRealResponse().render(
-   
OnDomReadyHeaderItem.forScript(combinedScript.append('\n').toString()));
+   
getRealResponse().render(OnDomReadyHeaderItem.forScript(combinedScript.append('\n')));
}
 
combinedScript.setLength(0);
+   String lastId = null;
--- End diff --

That doesn't seem to be reliable: what if multiple items are given an id?

IMHO we shouldn't changed code just to please test code. Couldn't 
BaseWicketTester just parse the url from the whole JavaScript via a regular 
expression?

> `.*Wicket\.Ajax\.baseUrl="(.*)";.*`


---


[GitHub] wicket pull request #256: WICKET-6517 ajax multipart

2018-01-12 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/256#discussion_r161308690
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
---
@@ -658,23 +653,36 @@
var scName = attrs.sc;
data = data.concat({name: scName, 
value: 1});
}
-
} else if (attrs.c && !jQuery.isWindow(attrs.c)) {
// serialize just the form component with id == 
attrs.c
var el = Wicket.$(attrs.c);
data = 
data.concat(Wicket.Form.serializeElement(el, attrs.sr));
}
 
-   // convert to URL encoded string
-   data = jQuery.param(data);
+   var wwwFormUrlEncoded = undefined; // default
+   if (attrs.mp) {
+   try {
+   var formData = new FormData();
+   for (var i = 0; i < data.length; i++) {
+   formData.append(data[i].name, 
data[i].value);
+   }
+   
+   data = formData;
+   wwwFormUrlEncoded = false;
+   } catch (exception) {
+   Wicket.Log.error("Ajax multipat not 
supported:" + exception);
+   }
+   }
 
// execute the request
var jqXHR = jQuery.ajax({
url: attrs.u,
type: attrs.m,
context: self,
+   processData: wwwFormUrlEncoded,
+   contentType: wwwFormUrlEncoded,
--- End diff --

With undefined jQuery will just use the default, i.e. a 
www-form-url-encoded request.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-12 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r161204652
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
 ---
@@ -106,8 +107,7 @@ public void renderHead(final Component component, final 
IHeaderResponse response
RequestCycle requestCycle = component.getRequestCycle();
Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
CharSequence ajaxBaseUrl = 
Strings.escapeMarkup(baseUrl.toString());
-   
response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + 
ajaxBaseUrl
-   + "\";", "wicket-ajax-base-url"));
--- End diff --

Setting the baseUrl has to be deferred until onLoad, otherwise the deferred 
wicket-ajax-jquery.js hasn't been loaded yet and Wicket.Ajax is not defined.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-12 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r161203809
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java
 ---
@@ -86,8 +86,8 @@ public void render(Response response)
CharSequence js = getJavaScript();
if (Strings.isEmpty(js) == false)
{
-   JavaScriptUtils.writeJavaScript(response, 
"Wicket.Event.add(window, \"domready\", " +
-   "function(event) { " + js + ";});");
+   JavaScriptUtils.writeJavaScript(response,
+   "var f = function() {" + js + ";};\nif 
('loading' !== document.readyState) f(); else 
document.addEventListener('DOMContentLoaded', f);");
--- End diff --

That does no harm +1


---


[GitHub] wicket pull request #256: WICKET-6517 ajax multipart

2018-01-12 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/256

WICKET-6517 ajax multipart

With this change multipart Ajax requests *are* send via Ajax.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6517-multipart-ajax

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/256.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #256


commit dfccba1f9598ba9c2ad5dbb9954d867a195c16d2
Author: Sven Meier <svenmeier@...>
Date:   2018-01-12T11:45:55Z

WICKET-6517 use FormData, removed submitMultipartForm




---


[GitHub] wicket issue #255: Allow multipart submission of non modified FormData with ...

2018-01-11 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/255
  
Yes, this is what I came up with yesterday too.
We have to support file inputs in forms too, for that I changed 
serializeInput() to handle "file" types.

I'd like to drop support for the old iframe solution in 
submitMultipartForm(). I'll create an issue, let's see what other devs are 
thinking of this.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-11 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r161148721
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
 ---
@@ -106,8 +107,7 @@ public void renderHead(final Component component, final 
IHeaderResponse response
RequestCycle requestCycle = component.getRequestCycle();
Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
CharSequence ajaxBaseUrl = 
Strings.escapeMarkup(baseUrl.toString());
-   
response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + 
ajaxBaseUrl
-   + "\";", "wicket-ajax-base-url"));
--- End diff --

It's not missing, it's just on a different location (see below), where 
getWicketAjaxBaseUrlEncodedInLastResponse() doesn't find it - we have to change 
that method accordingly.


---


[GitHub] wicket issue #255: Allow multipart submission of non modified FormData with ...

2018-01-11 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/255
  
Many thanks!

It seems you had to jump through a lot of hoops to make this work with 
Wicket's Ajax code - 
maybe we can change it to make this easier.
Why not drop the (old) iframe workaround and always use FormData for 
multipart requests?

I'll give it a try this afternoon.


---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/253#discussion_r159297861
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java 
---
@@ -86,8 +86,8 @@ public void render(Response response)
CharSequence js = getJavaScript();
if (Strings.isEmpty(js) == false)
{
-   JavaScriptUtils.writeJavaScript(response, 
"Wicket.Event.add(window, \"load\", " +
-   "function(event) { " + js + ";});");
+   JavaScriptUtils.writeJavaScript(response,
+   "var f = function() {" + js + ";};\nif 
('loaded' === document.readyState) f(); else window.addEventListener('load', 
f);");
--- End diff --

You're right, "complete" it should be.



---


[GitHub] wicket pull request #253: WICKET-6498 deferred javascript

2018-01-02 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/253

WICKET-6498 deferred javascript

If addEventListener is used instead of jQuery  "domready" and "load" 
events, and OnLoadHeaderItem instead of JavaScriptHeaderItem, all JavaScript 
resources can be deferred.

Open questions:
- does this solution work reliably on all browsers?
- who decides which JavaScript resources to defer and which not?
- how to handle cases where user code is still using a JavaScriptHeaderItem?

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6498_deferred_javascript

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/253.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #253


commit d77ba274f38953b6d5ab1088c7a9555111acd4fc
Author: Sven Meier <svenmeier@...>
Date:   2018-01-02T10:20:03Z

WICKET-6498 deferred javascript

use OnLoadHeaderItem instead of JavaScriptHeaderItem, addEventListener 
instead of jQuery;
defer all JavaScript resources for now




---


[GitHub] wicket pull request #250: WICKET-6503 render cleanup and ajax

2017-12-15 Thread svenmeier
GitHub user svenmeier reopened a pull request:

https://github.com/apache/wicket/pull/250

WICKET-6503 render cleanup and ajax

This is a combined effort to:
- align Ajax requests with the way components are prepared in normal 
request, i.e. beforeRender is called on *all* components, before any of them is 
rendered
- unify rendering of components separately as part of a page only vs. a 
whole page
- simplify handling of feedbacks  ... this was a real mess :(
- improve performance by prevent unnecessary traversal of the component 
hierarchy
- cleanup component's internal methods and flags

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket 
WICKET-6503_ajax_feedback_prepare

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/250.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #250


commit e2b6205fff61a8d8c0dc28d7749ec467278f7c80
Author: Sven Meier <svenme...@apache.org>
Date:   2017-12-14T06:55:53Z

WICKET-6503 beforeRender clean-up




---


[GitHub] wicket pull request #250: WICKET-6503 render cleanup and ajax

2017-12-14 Thread svenmeier
Github user svenmeier closed the pull request at:

https://github.com/apache/wicket/pull/250


---


[GitHub] wicket issue #250: WICKET-6503 render cleanup and ajax

2017-12-14 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/250
  
This does *not* solve (yet) one aspect of WICKET-6503: should components be 
allowed to be added to an AjaxRequestTarget *after* components have already 
been rendered ("ART is already frozen").



---


[GitHub] wicket pull request #250: WICKET-6503 render cleanup and ajax

2017-12-14 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/250

WICKET-6503 render cleanup and ajax

This is a combined effort to:
- align Ajax requests with the way components are prepared in normal 
request, i.e. beforeRender is called on *all* components, before any of them is 
rendered
- unify rendering of components separately as part of a page only vs. a 
whole page
- improve performance by prevent unnecessary traversal of the component 
hierarchy
- cleanup component's internal methods and flags

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket 
WICKET-6503_ajax_feedback_prepare

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/250.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #250






---


[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/249#discussion_r155472740
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 ---
@@ -16,35 +16,321 @@
  */
 package org.apache.wicket.core.util.string;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Supplier;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
 import org.apache.wicket.ThreadContext;
 import org.apache.wicket.core.request.handler.PageProvider;
 import org.apache.wicket.markup.IMarkupCacheKeyProvider;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupNotFoundException;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be 
rendered on a thread already
+ * processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing 
(e.g. generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to 
call {@link #destroy()} when
+ * they are no longer needed.
  */
 public class ComponentRenderer
 {
private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);
 
+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   @Override
+   protected void init()
+   {
+   super.init();
+
+   setSessionStoreProvider(() -> new 
NeverSessionStore());
+   getFrameworkSettings().setSerializer(new 
NeverSerializer());
+   }
+   });
+   }
+
+   /**
+* A renderer using the given application.
+* 
+* If the application was not yet initialized - e.g. it is not reused 
from an already running
+* web container - it will be initialized.
+*/
+   public ComponentRenderer(WebApplication application)
+   {
+   this.application = application;
+
+   if (application.getName() == null)
+   {
+   // not yet initialized
+
+   inThreadContext(() -> {
+   application.setServletContext(new 
MockServletContext(application, null));
+   application.setName(
+   "ComponentRenderer[" + 
System.identityHashCode(ComponentRenderer.this) + "]");
+   application.initApplication();
+   });
+   }
+   }
+
+   /**
+ 

[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/249

independent component renderer

ComponentRenderer makes it easy to render components, but it still needs 
the thread to be attached to a WebApplication's ThreadContext: I've seen 
projects use WicketTester for that or rolling their own solution.

IMHO we could improve ComponentRender to officially support independent 
rendering of components.

WDYT?

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket sandbox/component-renderer

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/249.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #249


commit 6e6c273fd32325a447cc32c751d5ce0c083e7ed1
Author: Sven Meier <svenme...@apache.org>
Date:   2017-12-07T08:24:12Z

render independently from web or tester

commit 0baab8c3027bbaafb1a218f3cf87edf0040d856f
Author: Sven Meier <svenme...@apache.org>
Date:   2017-12-07T08:44:47Z

use lambdas, fixed imports




---


[GitHub] wicket issue #246: WICKET-6499 Support Bean Validation 2.0

2017-11-22 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/246
  
That's a very good approach, thank you.


---


[GitHub] wicket issue #246: WICKET-6499 Support Bean Validation 2.0

2017-11-21 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/246
  
Actually I'm wondering whether we should just add another method to 
ITagModifier (possibly with better names):

```
public interface ITagModifier
{
  void modify(FormComponent component, T annotation);

  void modify(FormComponent component, ComponentTag tag, T annotation);
}
```

This way we can use the identical lookup 
BeanValidationConfiguration#getTagModifier() to alter the component itself from 
#onConfigure() and the component tag from #onComponentTag().

All that's required for the new annotations is then:

```
register(Size.class, new SizeTagModifier());
register(NotNull.class, new RequiredTagModifier());
register(NotEmpty.class, new RequiredTagModifier());
register(NotBlank.class, new RequiredTagModifier());
```


---


[GitHub] wicket pull request #240: WICKET-6055 non-blocking lazy loading

2017-11-14 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/240#discussion_r150953339
  
--- Diff: 
wicket-extensions/src/test/java/org/apache/wicket/extensions/markup/html/AjaxLazyLoadPanelTesterTest.java
 ---
@@ -38,12 +38,12 @@
@Test
public void test()
{
-   AjaxLazyLoadPanel panel = new AjaxLazyLoadPanel("panel")
+   AjaxLazyLoadPanel panel = new 
AjaxLazyLoadPanel("panel")
{
private static final long serialVersionUID = 1L;
 
@Override
-   public Component getLazyLoadComponent(final String 
markupId)
+   protected Component getLazyLoadComponent(String 
markupId)
--- End diff --

Thanks, it should still be public too.


---


[GitHub] wicket issue #240: WICKET-6055 non-blocking lazy loading

2017-11-13 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/240
  
I've improved compatibility with the previous implementation. Any 
objections against merging this into Wicket 8?


---


[GitHub] wicket issue #245: [WICKET-6492] minified js/css files are bundled

2017-11-13 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/245
  
+1


---


[GitHub] wicket pull request #244: [WICKET-6491] ajax download seems to work under bo...

2017-11-09 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/244#discussion_r150014533
  
--- Diff: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java
 ---
@@ -323,10 +323,30 @@ private String getName()
}
 
/**
+* Controls if anti cache parameter should be added to the URL or not
+*
+* @return {@code true} to add the anti cache request parameter, {@code 
false} - otherwise
+*/
+   protected boolean shouldAddAntiCacheParameter() {
--- End diff --

What is this good for? The resource can control caching - I don't see the 
necessity for an antiCache parameter (as ResourceLink doesn't need have it 
either).


---


[GitHub] wicket issue #243: Added Czech localization for Wizard

2017-11-08 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/243
  
Could you provide an *.utf8.properties instead? Czech needs a lot of 
unicode escapes for ISO-8859-1 :P


---


[GitHub] wicket issue #151: WICKET-6055 Made AjaxLazyLoadPanel non-blocking

2017-10-20 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/151
  
I've wrapped my ideas about this topic in #240


---


[GitHub] wicket pull request #240: WICKET-6055 non-blocking lazy loading

2017-10-20 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/240

WICKET-6055 non-blocking lazy loading

Building on #151 I've built this alternative implementation with the 
following advantages:

- lazy loading can now *start* on an Ajax request too
- much simpler without using the event bus
- the timer adjusts to the minimum of the preferred timeout of all 
LazyLoadPanels
- reworded methods and improved JavaDoc

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6055-non-blocking-lazy

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/240.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #240


commit cfb75dd64d54972a9b604101ff840c7c5cf80d35
Author: Sven Meier <svenme...@apache.org>
Date:   2017-10-20T12:25:15Z

WICKET-6055 non-blocking lazy loading




---


[GitHub] wicket issue #239: WICKET-6055 non-blocking lazy loading volume II

2017-10-20 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/239
  
Hm, github screw up on me, this is the wrong pull-request :/.


---


[GitHub] wicket pull request #239: WICKET-6055 non-blocking lazy loading volume II

2017-10-20 Thread svenmeier
Github user svenmeier closed the pull request at:

https://github.com/apache/wicket/pull/239


---


[GitHub] wicket pull request #239: WICKET-6485 reintroduce PageExpiredException in IP...

2017-10-20 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/239

WICKET-6485 reintroduce PageExpiredException in IPageStore for

Building on #151 I've built this alternative implementation with the 
following advantages:

- lazy loading can now *start* on an Ajax request too
- much simpler without using the event bus
- the timer adjusts to the minimum of the preferred timeout of all 
LazyLoadPanels
- reworded methods and improved JavaDoc

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/239.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #239


commit 3183aeb24f09d57e91bfc01813005f01cfd671df
Author: Andrea Del Bene <adelb...@apache.org>
Date:   2017-10-20T09:53:21Z

WICKET-6485 reintroduce PageExpiredException in IPageStore for
methods getPageClass, getPageInstance and getPageParameters




---


[GitHub] wicket issue #235: Wicket 6105 java.time

2017-10-15 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/235
  
I've pushed my changes with many changes:
- datetime is now partially reusing the new java.time converters in core
- unnecessary converter in TimeField removed
- core's ZonedDateTImeConverter includes the timezone for formatting too
- renamed fields with text input to LocalDateTextField and new 
LocalTimeTextFIeld
- LocalTimeField, LocalDateTimeField and ZonedDateTimeFIeld are better 
FormComponents now
- ZonedToLocalDateTimeModel allows converting ZonedDateTime to 
LocalDateTime in the client's timezone
- the example shows more features now

Sorry, I've referenced the wrong issue in the commit, I'll clean this up 
once we merge this branch into master.


---


[GitHub] wicket issue #238: WICKET-6479 keep window name

2017-10-11 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/238
  
With this change AjaxNewWindowNotifyingBehavior keeps the window's name if 
it is already present.

All successively rendered pages will be bound to an identical name and 
window.name will stay the same.
Thus going back to a previous page instance will not report a new window.


---


[GitHub] wicket issue #238: WICKET-6479 keep window name

2017-10-11 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/238
  
With this change AjaxNewWindowNotifyingBehavior keeps the window's name if 
it is already present.

All successively rendered pages will be bound to an identical name and 
window.name will stay the same.
Thus going back to a previous page instance will not report a new window.


---


[GitHub] wicket pull request #238: WICKET-6479 keep window name

2017-10-10 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/238

WICKET-6479 keep window name

If the page was not yet rendered into any window, just keep the window name 
as is, instead of changing it for each new page.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket WICKET-6479-new-window

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/238.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #238


commit 00e84ea1926d38496607780c8b8985cab488b758
Author: Sven Meier <svenme...@apache.org>
Date:   2017-10-10T22:05:35Z

WICKET-6479 keep window name
if the page was not yet rendered into any window, just keep the window name 
as is, instead of changing it




---


[GitHub] wicket issue #235: Wicket 6105 java.time

2017-10-10 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/235
  
Sorry, I'm busy currently.

But I identified major flaws in the current implementation, just as an 
example: TimeField holds a converter now, but never uses it :(.
Usages of FormComponentPanel haven't been ideal in wicket-datetime either, 
so we should improve that.
There are many more things I've been working on, so expect a huge change 
(hopefully soon).


---


[GitHub] wicket issue #235: Wicket 6105 java.time

2017-10-06 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/235
  
Still some things to improve on ... I'll work on it tomorrow.


---


[GitHub] wicket issue #235: Wicket 6105 java.time

2017-10-05 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/235
  
I'm just using StartExamples in wicket-examples. I've had problems with 
Weld before, but luckily it works for me atm.


---


[GitHub] wicket issue #235: Wicket 6105 java.time

2017-10-02 Thread svenmeier
Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/235
  
We should show the usage of these 'new' components in wicket-examples, 
under "component reference".


---


[GitHub] wicket pull request #235: Wicket 6105 java.time

2017-10-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/235#discussion_r142083823
  
--- Diff: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/DateLabel.java
 ---
@@ -227,14 +216,10 @@ public DateLabel(String id, DateConverter converter)
 * @param converter
 *The converter to use
 */
-   public DateLabel(String id, IModel model, DateConverter converter)
+   public DateLabel(String id, IModel model, 
ZonedDateTimeConverter converter)
--- End diff --

This looks wrong: DateLabel works on a LocalDate now, but uses a 
ZonedDateTimeConverter which converts to/from ZonedDateTime. IMHO we should 
change this to LocalDate, or we could just delete this class, since it is just 
a collection of factory methods plus this weird "before" and "after" rendering.


---


[GitHub] wicket pull request #235: Wicket 6105 java.time

2017-10-02 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/235#discussion_r142085534
  
--- Diff: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/DateTimeField.java
 ---
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.extensions.markup.html.form.datetime;
+
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoField;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.wicket.Session;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.core.request.ClientInfo;
+import org.apache.wicket.markup.html.form.FormComponentPanel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.protocol.http.request.WebClientInfo;
+
+/**
+ * Works on a {@link java.time.ZonedDateTime} object. Displays a date 
field and a DatePicker, a field
+ * for hours and a field for minutes, and an AM/PM field. The format 
(12h/24h) of the hours field
+ * depends on the time format of this {@link DateTimeField}'s {@link 
Locale}, as does the visibility
+ * of the AM/PM field (see {@link DateTimeField#use12HourFormat}).
+ * 
+ * Ajaxifying the DateTimeField: If you want to update a 
DateTimeField with an
+ * {@link AjaxFormComponentUpdatingBehavior}, you have to attach it to the 
contained
+ * {@link DateField} by overriding {@link #newDateTextField(String, 
IModel)} and calling
+ * {@link #processInput()}:
+ * 
+ * {@code
+ *  DateTimeField dateTimeField = new DateTimeField(...) {
+ *protected DateTextField newDateTextField(String id, 
PropertyModel dateFieldModel)
+ *{
+ *  DateTextField dateField = super.newDateTextField(id, 
dateFieldModel); 
+ *  dateField.add(new AjaxFormComponentUpdatingBehavior("change") {
+ *protected void onUpdate(AjaxRequestTarget target) {
+ *  processInput(); // let DateTimeField process input too
+ *
+ *  ...
+ *}
+ *  });
+ *  return recorder;
+ *}
+ *  }
+ * }
+ * 
+ * @author eelcohillenius
+ * @see DateField for a variant with just the date field and date picker
+ */
+public class DateTimeField extends FormComponentPanel
--- End diff --

For consistency I'd prefer DateTimeField working on a LocalDateTime - for 
me this is the default pick instead of ZonedDateTime.

Maybe we need two components, one for each type?


---


  1   2   >