Re: RangeValidator and BigDecimal

2023-12-20 Thread Bas Gooren
Hi all,

Yeah, that was easy to spot: BigDecimal is only accurate when provided with
a string or fixed input (e.g. integer or long).
Doubles and floats are inherently inaccurate (as they are non-exact values).

So if you change your code to ...

testField.setMinimum(new BigDecimal(“0.01"));

… it will work correctly.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 20 december 2023 bij 15:25:23, Sven Meier (s...@meiers.net) schreef:

Hi Eric,

you can read in the javadoc, why your first solution is 'unpredictable':

https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/BigDecimal.html#%3Cinit%3E(double)

Sven

On 20.12.23 15:18, Eric Hamel wrote:
> Hi Bas,
>
> Thanks for the response.
>
> I discovered the NumberTextField had its own RangeValidator 2 seconds
after posting. With that said, I’m getting the same issue when using it.
>
> To be clear, I’m not getting any Exceptions, everything seems to work
fine, but the form validation fails if the user types in 0.01.
>
>
> Form form = new Form<>(“form”, getModel());
> add(form);
>
> NumberTextField testField = new
NumberTextField(“testField”, new
PropertyModel(form.getModel(), “testProp”));
> form.add(testField);
>
>
> I’ve been digging and I found the oddity:
>
> If I set the min value as follows:
>
> testField.setMinimum(new BigDecimal(0.00));
>
> When the user enters 0.01, the following feedback message is showed:
>
> The value of ’testField’ must be between 0.01 and 999,999.99.
>
> However, if I set the min value with:
>
> testField.setMinimum(BigDecimal.valueOf(0.00));
>
> The user can enter 0.01 and NO feedback message is showed.
>
>
>
> -
> Eric H.
>
>
>
>
>
>> On Dec 20, 2023, at 8:48 AM, Bas Gooren  wrote:
>>
>> Hi Eric,
>>
>> First off: according to the source of NumberTextField, it automatically
adds a RangeValidator (see NumberTextField#onConfigure). So you shouldn’t
need to add the RangeValidator yourself.
>>
>> Regarding your problem: what kind of error messages are you getting?
>>
>> The range validator (or more specifically: the AbstractRangeValidator
class) handles the comparison between min, max and actual values using
compareTo. So there should not be any issues with rounding.
>>
>> Please share the code you use to initialize the relevant field, perhaps
we can spot a mistake.
>>
>> Met vriendelijke groet,
>> Kind regards,
>>
>> Bas Gooren
>>
>> Op 20 december 2023 bij 14:38:53, Eric Hamel (eric.ha...@albanyitg.com
<mailto:eric.ha...@albanyitg.com>) schreef:
>>
>>> Good morning,
>>>
>>> We encountered an issue this morning with our use of
RangeValidator.
>>>
>>> The customer requested a validation for amounts between 0.01 and
999,999.00.
>>>
>>> We have a NumberTextField to which we added the
RangeValidator. If the user enters 0.01 the validation fails.
>>>
>>> If I set the min value to 0.009 I can get it to work but the error
messages are off.
>>>
>>> I’m wondering if it’s a rounding or scale issue but I cannot figure out
how to make the RangeValidator work.
>>>
>>> Anyone have any insight on this ?
>>>
>>> Thank you.
>>> Eric H.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
>>> For additional commands, e-mail: users-h...@wicket.apache.org 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: RangeValidator and BigDecimal

2023-12-20 Thread Bas Gooren
Hi Eric,

First off: according to the source of NumberTextField, it automatically
adds a RangeValidator (see NumberTextField#onConfigure). So you shouldn’t
need to add the RangeValidator yourself.

Regarding your problem: what kind of error messages are you getting?

The range validator (or more specifically: the AbstractRangeValidator
class) handles the comparison between min, max and actual values using
compareTo. So there should not be any issues with rounding.

Please share the code you use to initialize the relevant field, perhaps we
can spot a mistake.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 20 december 2023 bij 14:38:53, Eric Hamel (eric.ha...@albanyitg.com)
schreef:

Good morning,

We encountered an issue this morning with our use of
RangeValidator.

The customer requested a validation for amounts between 0.01 and
999,999.00.

We have a NumberTextField to which we added the RangeValidator.
If the user enters 0.01 the validation fails.

If I set the min value to 0.009 I can get it to work but the error messages
are off.

I’m wondering if it’s a rounding or scale issue but I cannot figure out how
to make the RangeValidator work.

Anyone have any insight on this ?

Thank you.
Eric H.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: problem using DropDownChoice

2023-12-14 Thread Bas Gooren
Hi!

Normally this should work just fine:

otReasonDropDown = new DropDownChoice("otReason", new PropertyModel
(commentAndOtReason, "otReasonText"), ldm2);
otReasonDropDown.setNullValid(false);

So my guess is that either commentAndOtReason is null (unlikely, as that
would throw an NPE in the other code you provided)
or commentAndOtReason.otReasonText is null.

The PropertyModel (and any model for that matter) is a simple container to
pull a value out for display/use and push a value back (e.g. on form
submit).

If you put a breakpoint on the line where you construct the DropDownChoice,
you can inspect the variable commentAndOtReason to see what is inside.

Should that not be the issue, and the
variable commentAndOtReason.otReasonText contains text, then it means that
between construction and render of your page, the commentAndOtReason is
updated and/or its contents are updated.

If you still cannot figure it out, please provide a quickstart that
demonstrates your issue. That will help others (like me) to spot the
underlying issue quickly.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14 december 2023 bij 19:27:30, Nelligan, Steven M (snell...@illinois.edu)
schreef:


Help, I am new to Wicket...and have taken over a project with wicket
version 1.4.18.

I need to add another DropDownChoice in my application.
I was able to create the add logic, but the change logic is not working as
expected.
I've been working on this for a couple of weeks, and still could not get it
working.
Following is a snip of code causing the problem:
otReasonDropDown = new DropDownChoice("otReason", new PropertyModel
(commentAndOtReason, "otReasonText"), ldm2);
otReasonDropDown.setNullValid(false);
if (commentAndOtReason.getOtReasonText() != null) {
//
otReasonDropDown.setDefaultModelObject(commentAndOtReason.getOtReasonText()
+ "");
otReasonDropDown.setDefaultModelObject(commentAndOtReason.getOtReasonText()
+ "");
}
String s3 = ((String) otReasonDropDown.getModelObject());
String s31 = ((String)otReasonDropDown.getDefaultModelObjectAsString());
int i3 = 1; //debugging
timeCardForm.add(otReasonDropDown);

The variable commentAndOtReason.otReasonText contains the string I want the
dropdown list to show as a default.

But the dropdown list is not showing any default, but rather an empty
value.
If I select the dropdownlist, it shows the select list, including what I
want as a default value.

How do I setup DropDownChoice to have the value in
commentAndOtReason.otReasonText show as the current value(default value).

Thanks,
Steven M Nelligan
SENIOR SOFTWARE DEVELOPER


Re: Aw: Re: Odd behaviour with StatelessForm and onInitialize()

2023-12-01 Thread Bas Gooren
Hi Daniel,

I did some debugging, and found out why this is not working as expected.

When you add your components to the page in onInitialize(), the following
happens:

Wicket runs a ListenerRequestHandler for the form submit.
That handler tries to find the form component, and does not find it
(PageAndComponentProvider#getComponent) and then initializes the page +
calls beforeRender() on the page.
Through beforeRender, the components in the page are configured
(onConfigure() is called).
This is where your behavior hides the label.
After the form submit is processed, wicket schedules a
RenderPageRequestHandler (in ListenerRequestHandler#internalInvoke).
Normally I’d expect the page to be configured & rendered again at that
point, but because the label was already configured before, it stays hidden.

My first idea was to call Page#configure() in your Form#onSubmit method,
but that didn’t do anything, because configure ensures the logic only runs
once per render (by setting some flags).

My second idea was to detach the page, which did the trick in your example.
Detaching the page forces a re-render after the form submit.

More specifically:

Form form = new StatelessForm<>( "form" )
{
@Override
protected String getMethod()
{
return "GET";
}

@Override
protected void onSubmit()
{
super.onSubmit();

System.out.println( "Form submit" );

getPage().detach();
}
};

Conclusion: try if that works for you in your actual code.
There is differences in how things are handled by wicket depending on where
you add (form) components to your page (in ctor or in onInitialize).

Perhaps one of the core devs can comment on if what I found to happen is
desired behavior (components not configured after form submit in stateless
page, when components are added in onInitialize).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 30 november 2023 bij 16:45:48, ihmehlm...@gmx.de (ihmehlm...@gmx.de)
schreef:

Hello!

I now uploaded the whole quickstart. It's basicly the same as in my initial
post though just with some added debugging code, so not sure it helps more.
https://drive.google.com/file/d/1UWm3eEf4ddzRy0QeI0DdhsPB7bT2gRcm/view?usp=sharing

The page is the same for both cases and it is indeed supposed to be
stateless.
Simply (un)commenting the initComponents() method in either the page's
constructur or the onInitialize() method changes how the page behaves.
The goal in this quickstart is, that the entered text gets displayed, which
right now doesn't seem to work, if I add my components in the
onInitialize() method.

Adding the components in the constructor prints the following when
submitting the form:

--Constructor--
init components
before super.onInitialize
after super.onInitialize
<< get
>> set <- Setter called before the Behavior
calling get from Behavior
<< get
Setting visibility to true
<< get
<< get

Here you can see, that the setter of the Model is call before the Behavior
is evaluated.
With a value being in the model, the Behavior sets the visibility of the
label to true.


Adding the components in the onInitialize() method prints the following
when submitting the form:

--Constructor--
before super.onInitialize
after super.onInitialize
init components
calling get from Behavior
<< get
Setting visibility to false
<< get
>> set <- Setter called after the Behavior
<< get

Here though you can see, that the setter of the Model is called after the
Behavior is evaluated.
So at the time of evaluation there is no value in the the Model and the
Behavior sets the visibility of the label to false.

If there is anything else I can provide I'll happily do so.

Daniel


Gesendet: Mittwoch, 29. November 2023 um 07:03 Uhr
Von: "Bas Gooren" 
An: users@wicket.apache.org, ihmehlm...@gmx.de
Betreff: Re: Odd behaviour with StatelessForm and onInitialize()
Hi!

Can you share some code? (e.g. a quickstart which reproduces your issue)

It sounds to me like in the one case you are dealing with a stateless page,
and the other a stateful page.

In general, with stateless pages, everything is initialized on every render
/ submit, because there is no page instance (since the page is stateless).
If in some conditions you see that your behavior is run before the submit,
it sounds like you’re dealing with a stateless page. If in other conditions
the behavior is only run on initial page render and after the submit, it
sounds like you’re dealing with a stateful page.

But this is just me guessing without looking at your code.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23 november 2023 bij 16:09:53, ihmehlm...@gmx.de (ihmehlm...@gmx.de)
schreef:

Hello,
upon working with StatelessForms for the first time I stumbled up an odd
behavior in regards to wh

Re: Odd behaviour with StatelessForm and onInitialize()

2023-11-28 Thread Bas Gooren
Hi!

Can you share some code? (e.g. a quickstart which reproduces your issue)

It sounds to me like in the one case you are dealing with a stateless page,
and the other a stateful page.

In general, with stateless pages, everything is initialized on every render
/ submit, because there is no page instance (since the page is stateless).
If in some conditions you see that your behavior is run before the submit,
it sounds like you’re dealing with a stateless page. If in other conditions
the behavior is only run on initial page render and after the submit, it
sounds like you’re dealing with a stateful page.

But this is just me guessing without looking at your code.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23 november 2023 bij 16:09:53, ihmehlm...@gmx.de (ihmehlm...@gmx.de)
schreef:

Hello,
upon working with StatelessForms for the first time I stumbled up an odd
behavior in regards to when the corresponding models are updated.

Following setup:

The base for this is a wicket quickstart 9.15.0. I modified the two
HomePage files, which can be found here:
https://gist.github.com/TekkiWuff/824e820427c16e204bde68e95fd566a6

In this I have a Page with a StatelessForm with a single TextField and a
Label. The TextField and Label share a single String-Model. The Label has a
Behavior which sets the visibility of the attached component to false in
the configure-phase if the String-Model is empty.
Here this is needed to hide the whole HTML-tag instead of rendering an
empty li-tag. In my actual application this applies to much bigger and more
complex panels and lists which need to be hidden/shown when certain form
values are set/not set.


Now the to me odd behavior:

If I initialise all components in the constructor of the page, everything
works as expected.
The request of the form submit gets processed, the model updated and then
afterwards the page gets rendered among which also the Behaviour is run to
set the visibility of the label.
So the visibility is decided on the just submitted form value.

Now if I initialise all components in the onInitialize() method, which by
my understanding is supposed to work like the constructor, the order of
execution seems wrong.
First, my Behaviour is run to set the visibility. Then the request of the
form submit gets processed, the model updated and the page rendered.
So here now the visibility is suddenly decided on the old value, which in
my case initially is an empty Model, so my Label is always hidden.

It's not a matter of using GET or POST and only seems to happen with
StatelessForm. Using a normal statefull Form is working just fine.

Is this a bug or an expected behaviour? I couldn't find anything about this
in the description of the StatelessForm about this.
I am exclusivly using the onInitialize() method for constructing all my
pages, so before having to change several hundred pages to using the
constructor, I rather ask first if it's maybe something that can be fixed.

Regards
Daniel

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Question about log warning: "IndicatingAjaxButton should be applied on a 'button' tag"

2023-06-28 Thread Bas Gooren
Hi Shawn,

That’s more of a styling issue.

 uses the “value” attribute to render the button text.

For a  you’ll need to put the value inside the button tag:
value goes here

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 28 juni 2023 bij 15:24:44, Shawn McKinney (smckin...@symas.com) schreef:


> On Jun 28, 2023, at 8:11 AM, Bas Gooren  wrote:
>
> Hi Shawn,
>
> The code basically checks if you apply the behavior to a 
element.
>
> In other words:
>
>  is considered an “invalid” element for this
behavior.
>
>  is considered “valid”.
>

Hello,

As part of my scientific ‘poke and hope’ methodology;-), I had tried that.

Now, the warning has disappeared. But, the button renders on the page as a
tiny dot, that actually works. I doubt my users would be a big fan of it
(tiny buttons), although their eye doctors might?

Anyway, all kidding aside, here’s what the html looks like:

```

Re: Question about log warning: "IndicatingAjaxButton should be applied on a 'button' tag"

2023-06-28 Thread Bas Gooren
Hi Shawn,

The code basically checks if you apply the behavior to a  element.

In other words:

 is considered an “invalid” element for this behavior.

 is considered “valid”.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 28 juni 2023 bij 15:08:52, Shawn McKinney (smckin...@symas.com) schreef:

Howdy,

I’m a little embarrassed to be asking. It seems so basic, should know it
already.

But, I’ve already spent a fair amount of time digging with no answers.

My usage of Ajax buttons generates this warning in the logs:

```
WARN - 28 Jun 2023 07:35:56,704 - IndicatingAjaxButton -
IndicatingAjaxButton should be applied on a 'button’ tag
```

Looking at the wicket source, I see:


```
public abstract class IndicatingAjaxButton extends AjaxButton
...
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (!"button".equalsIgnoreCase(tag.getName()))
{
LOG.warn("IndicatingAjaxButton should be applied on a 'button' tag”);
}
}
```

A head scratcher to me why that warning is in place.

Obviously, there’s something I’m missing.

Here’s my code. It all “seems" to work just fine (other than the warning).
What am I doing wrong?

```java
public Page1Form( String id )
{
…

add( new IndicatingAjaxButton( "wspage1.button1" )
{
@Override protected void onSubmit( AjaxRequestTarget target )
{
logIt( target, “..." );
}
}
...
```

```html



```

I’m using the latest Wicket (v10). This behavior (log warnings) was present
on earlier versions as well.

Thanks

—
Shawn
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Blind XPath Injection Solution

2022-11-08 Thread Bas Gooren
Hi Jonathan,

If this is an actual problem or not depends on your application.

Several of our apps are security scanned regularly, and we always get some
false positives.
E.g. ”Path based vulnerability” because extra path parameters can be added,
and we still show the same page.

>From your message I gather that a form field is being manipulated.
I’m not sure why the scan tool is assuming that the field value is being
used in an xpath query.
But in general I think that, when (a) inputs are never output to html “raw”
(unencoded) and (b) inputs are never used as-is (without escaping) in SQL
or other queries, you are good.

So if this an issue in your case depends on what you do with the value of
your form field at regionFormGroup:regionFormGroup_body:regionTextField

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 8 november 2022 bij 05:03:57, Jonathan P. Babie (
jba...@osc.ny.gov.invalid) schreef:

Hello,

Our Wicket web application went through an app scan. We understand most
problems that came back from the report and have solutions, but one that's
troubling us is:

Blind XPath Injection
Severity: Medium
CVSS Score: 6.4
Entity: regionFormGroup:regionFormGroup_body:regionTextField (Parameter)
Risk: It is possible to access information stored in a sensitive data
resource
Cause: Sanitation of hazardous characters was not performed correctly on
user input
Fix: Review possible solutions for hazardous character injection
Difference:
Parameter regionFormGroup:regionFormGroup_body:regionTextField manipulated
from: b to: b%27+and+l​ast%28%29%3Dlast%28%29+or+%27
Parameter regionFormGroup:regionFormGroup_body:regionTextField manipulated
from: b to: b%27+and+not%28last%28%29%29%3Dlast%28%29+or%27
Parameter regionFormGroup:regionFormGroup_body:regionTextField manipulated
from: b to: b%27+and+position%28%29%3Dposition%28%29+or+%27
Reasoning: The test result seems to indicate a vulnerability because it
shows that values can be appended to parameter values, indicating that they
were embedded in an Xpath query. In this test, four (or sometimes five)
requests are sent. One of the last two should be logically equal to the
original, and the request before that is different, and should yield empty
result or error. Any others are for control purposes. A comparison between
the responses of the equivalent requests, and those that are not equivalent
with the first (the equivalent options are similar to it, and the erroneous
one is different) indicates that the application is vulnerable.

Test Requests and Responses:
POST
/lgmm/1EFGhfMAxecfRmNOJXeaL4DEM0H-EW58EQqlsCvFg2CrIQQFX7A73Gb1jkQR1RVAgGv-Ar-xgDmvL9rYCjIxJyUCSoIcSK57hbnGyvGyXBMLG_P37gUxG-gvskBCrGmZDb7eWl9v5shigfUuZPG54Nckxrw3uEsF01z1jdgTzDjsiYMQe_Wp04lViFNHIjn9LpPw9tg8gq5DRvPE2MTYlx82jMU_2xmlJJMYGoOTwwKnJRA94d_aqyTlatMrDzSr/1EFf1/rGm57
HTTP/1.1
Host: example.domain.com
Connection: keep-alive
sec-ch-ua: "Chromium";v="106", "Google Chrome";v="106",
"Not;A=Brand";v="99"
sec-ch-ua-mobile: ?0
Wicket-FocusedElementId: id87
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/xml, text/xml, */*; q=0.01
Wicket-Ajax-BaseURL:
1EFGhfMAxecfRmNOJXeaL4DEM0H-EW58EQqlsCvFg2CrIQQFX7A73Gb1jkQR1RVAgGv-Ar-xgDmvL9rYCjIxJyUCSoIcSK57hbnGyvGyXBMLG_P37gUxG-gvskBCrGmZmajvnhPJ2o8/1EFf1/-gvdb

X-Requested-With: XMLHttpRequest
Wicket-Ajax: true
sec-ch-ua-platform: "Windows"
Origin: https://example.domain.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer:
https://example.domain.com/lgmm/1EFGhfMAxecfRmNOJXeaL4DEM0H-EW58EQqlsCvFg2CrIQQFX7A73Gb1jkQR1RVAgGv-Ar-xgDmvL9rYCjIxJyUCSoIcSK57hbnGyvGyXBMLG_P37gUxG-gvskBCrGmZmajvnhPJ2o8/1EFf1/-gvdb
Accept-Language: en-US
Content-Length: 58

regionFormGroup%3AregionFormGroup_body%3AregionTextField=b

HTTP/1.1 200 OK
Date: Fri, 28 Oct 2022 01:26:27 GMT
X-Powered-By: Servlet/3.1
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache, no-store
Ajax-Location:
../../1EFGhfMAxecfRmNOJXeaL4DEM0H-EW58EQqlsCvFg2CrIQQFX7A73Gb1jkQR1RVAgGv-Ar-xgDmvL9rYCjIxJyUCSoIcSK57hbnGyvGyXBMLG_P37gUxG-gvskBCrGmZGxUSqIGs5Tb2rcQ5fnAdfw/1EFf1/rYC7b

Keep-Alive: timeout=5, max=94
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml;charset=UTF-8
Content-Language: en-US
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000; preload



Re: BootstrapMultiSelect shows empty list without any options.

2022-06-22 Thread Bas Gooren
Hi!

Sounds like a CSS/display issue.

Did you inspect which css rules apply to the select and its children?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 22 juni 2022 bij 11:34:00, Arunachalam Sibisakkaravarthi (
arunacha...@mcruncher.com) schreef:

Hi guys,
We are working to implement bootstrap-select from the Wicket Bootstrap
Extensions project 5.x into Wicket 9.x + Bootstrap 4.x application.
But, the BootstrapMultiSelect shows an empty list without any options.
I inspected the rendered html page, it seems everything is ok and has all
the options .

Java
new BootstrapMultiSelect("multiSelectItems",
getMultiSelectItems());

HTML
 

Could you help me to identify and fix the problem?

Components used in our project:

1. Wicket 9.x
2. Wicket Bootstrap 5.x (Bootstrap 4.x)
3. JQuery 3.6.0

Note: It works as expected in a simple Wicket quickstart project.

I couldn't find what went wrong in our app.




*Thanks And RegardsSibi.ArunachalammCruncher*


Re: Ajax Error

2022-05-23 Thread Bas Gooren
Hi Vahid,

This message is logged when a javascript error occurs while wicket
processes Ajax response items:

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source#L113

My guess is that you (or some code you use) is adding some javascript code
to a wicket Ajax response, which fails.

You could inspect the Ajax response using e.g. chrome developer tools to
see where a “Main” variable is referenced.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23 mei 2022 bij 13:03:16, vahid ghasemi (vahidghasemi...@gmail.com)
schreef:

Hello,
I have the below error and I don't know this is from where and how I should
fix it.
FunctionsExecuter.processNext: ReferenceError: Main is not defined


Re: No matching SeamConversationContext for store type interface javax.servlet.http.HttpServletRequest, using NOOP instance!

2022-03-23 Thread Bas Gooren
Hi Marco,

Referring to https://bugzilla.redhat.com/show_bug.cgi?id=1087471 it seems
that the seam conversation library should no longer be referenced from
wicket (as indicated in 2014).

Looking at the version history of the wicket-cdi pom.xml I see that the
dependency on seam conversation was removed in 2018 (with the upgrade to
CDI 2):

https://github.com/apache/wicket/commit/0f64e1f9e30bb3642805730e2409e9d3ac4ebcea

The new version without the seam conversation dependency is wicket 9. Have
you tried upgrading to that version?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23 maart 2022 bij 07:59:50, Marco Witteveen (marco.wittev...@gmail.com)
schreef:

When a Wicket app is starting, i see the following warning in the system
log of our application servers:
org.jboss.seam.conversation.spi.SeamConversationContextFactory W No
matching SeamConversationContext for store type interface
javax.servlet.http.HttpServletRequest, using NOOP instance!

This message is also mentioned in posts in 2013/2014 (search for
SeamConversationContext)
but we still get the warning using wicket 8.14.0.
I've seen the warning in the following application servers:

- IBM WebSphere Application Server 9.0.5.x
- WebSphere Liberty 22.0.0.1
- Open Liberty 22.0.0.1

We use the following products:

wicket-core
wicket-auth-roles
wicket-extensions
wicket-cdi

Marco


Re: How to use the JavaScriptDeferHeaderResponse correctly?

2022-02-02 Thread Bas Gooren
Hi Sven,

Thank you for the workaround, I’ll try it out this week.

I have also created a jira issue for this:
https://issues.apache.org/jira/browse/WICKET-6953

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 1 februari 2022 bij 20:22:58, Sven Meier (s...@meiers.net) schreef:

As a workaround you could use this:

getHeaderResponseDecorators().add( (response) -> {
if (RequestCycle.get().find(AjaxRequestTarget.class) == null) {
response = new JavaScriptDeferHeaderResponse(response);
}
return response;
});

Regards
Sven


On 01.02.22 17:16, Sven Meier wrote:
> Hi Bas,
>
> that seems to be broken since
> https://issues.apache.org/jira/browse/WICKET-6703
>
> The JS is correctly collected by PartialPageUpdate, but then sent
> through the response decorators once again, thus being wrapped in a
> 'DOMContentLoaded' listener.
>
> Please open a Jira issue.
>
> Regards
> Sven
>
>
> On 01.02.22 16:28, Sven Meier wrote:
>> Hi Bas,
>>
>> your attachment didn't make it through the mailing list.
>>
>> Can you point me to where I can download it from?
>>
>> Thanks
>> Sven
>>
>>
>> On 31.01.22 14:51, Bas Gooren wrote:
>>> Hi,
>>>
>>> We are experimenting with the JavaScriptDeferHeaderResponse, but out
>>> of the box it doesn’t work correctly for us.
>>> We are on wicket 9.7.0.
>>>
>>> On an Ajax call (e.g. link click), the response includes a
>>> ‘DOMContentLoaded’ event listener (which is not needed there). Since
>>> that never fires, any javascript handlers that are in the Ajax
>>> response are not registered.
>>> Please have a look at the attached Quickstart, which demonstrates
>>> the issue.
>>>
>>> Once the AJAX link is clicked, this evaluate node is added to the
>>> Ajax response (relevant part shown):
>>>
>>> document.addEventListener('DOMContentLoaded', function() {
>>>
(function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();;

>>> });
>>>
>>> The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded
>>> event handler.
>>>
>>> I’m not sure if we should be using the JavaScriptDeferHeaderResponse
>>> differently. We tried registering it using the three different
>>> methods provided by the header response decorators collection (add,
>>> add pre, add post).
>>>
>>> Any help would be appreciated :-)
>>>
>>> Met vriendelijke groet,
>>> Kind regards,
>>>
>>> Bas Gooren
>>>
>>> -
>>> To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail:users-h...@wicket.apache.org

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


How to use the JavaScriptDeferHeaderResponse correctly?

2022-01-31 Thread Bas Gooren
Hi,

We are experimenting with the JavaScriptDeferHeaderResponse, but out of the
box it doesn’t work correctly for us.
We are on wicket 9.7.0.

On an Ajax call (e.g. link click), the response includes a
‘DOMContentLoaded’ event listener (which is not needed there). Since that
never fires, any javascript handlers that are in the Ajax response are not
registered.
Please have a look at the attached Quickstart, which demonstrates the issue.

Once the AJAX link is clicked, this evaluate node is added to the Ajax
response (relevant part shown):

document.addEventListener('DOMContentLoaded', function() {
(function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();;
});

The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded event
handler.

I’m not sure if we should be using the JavaScriptDeferHeaderResponse
differently. We tried registering it using the three different methods
provided by the header response decorators collection (add, add pre, add
post).

Any help would be appreciated :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Re: Custom error handler (IRequestCycleListener) with Bookmarkable page

2021-11-11 Thread Bas Gooren
Hi Jeroen,

I just gave your quickstart a spin.

After some debugging I see that this is what happens: because you set the
redirect mode to ALWAYS_REDIRECT, wicket needs to generate a target url to
redirect to.
It determines if the page is stateless (in your case: yes), can be created
from a bookmarkable url (in your case: yes) and then generates a stateless
url (“/error”).

This makes sense: you basically tell wicket that this is a stateless page
that can be recreated easily.

So here are two possible ways for you to remedy this:

A) remove the stateless/bookmarkable constructor (the zero-args one)
B) explicitly mark the page as stateful (call "setStatelessHint( false );”
after “init(e);” in your stateful constructor

Since the error page requires an exception to be able to be of use - what
is the point of having the zero-args constructor?
So that would be the logical fix for me: remove the zero-arg constructor.

Hope this helps!

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 11 november 2021 bij 13:59:27, Jeroen Steenbeeke (
j.steenbeeke...@gmail.com) schreef:

Our application uses an implementation of IRequestCycleListener to redirect
users to a custom error page with contextual information (which includes a
reference to an external bug tracking system).

When the target page is also mounted in the application, we are seeing
rather unexpected behavior: the custom error page is created as expected,
but Wicket then tries to recreate the page by calling a default constructor
(which exists), rendering the error page without the contextual
information.

Is this expected behavior, or is this a bug?

I've created the following quickstart to illustrate the problem:

https://github.com/jsteenbeeke/wicket-custom-mounted-errorpage-loses-context

Sincerely,

Jeroen Steenbeeke


Re: Cookiebot support

2021-08-06 Thread Bas Gooren
Hi Stepan,

I would say a combination of two things:

a) subclass JavascriptContentHeaderItem, override its render method to
render additional attributes
b) wrap your new header item in a PriorityHeaderItem

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 6 augustus 2021 bij 14:53:01, Stepan Samarin (s...@discovergy.com) schreef:

Hello,

I'm trying to integrate Cookiebot and am facing the following problem:

Re: Possible bug / edge case found where page is not detached

2021-07-25 Thread Bas Gooren
Hi Sven,

Done - https://issues.apache.org/jira/browse/WICKET-6908

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 24 juli 2021 bij 10:29:38, Sven Meier (s...@meiers.net) schreef:

Hi Bas,

that sounds like a bug.

Your quickstart didn't make it through the mailing list, would you please
attach it to a new Jira issue?

Thanks
Sven

Am 23. Juli 2021 19:30:46 MESZ schrieb Bas Gooren :
>Hi all,
>
>Today I spent the better part of my day investigating a bug report
>regarding a hibernate LazyInitializationException.
>Since we use detaching models everywhere and (in general) never see
>such
>issues anymore, this one was interesting :-)
>
>After much debugging I found out what is happening.
>
>We have a page which has a database model + links for prev/next item
>(in
>the database).
>When the users double-clicks on one of the links, the first click is
>OK,
>and the second click throws a StalePageException during request cycle
>processing.
>
>So far, normal.
>
>However, stepping through the wicket code, this is what happens:
>
>1) Resolve to ListenerRequestHandler, execute it, throws
>StalePageException
>2) exception mapper handles this and we execute a
>RenderPageRequestHandler,
>which re-renders the page
>3) the request cycle detaches, which delegates in part
>to RequestHandlerExecutor.detach()
>4) The handlers to detach are both handlers from step 1 and 2; During
>the
>detach of ListenerRequestHandler, it initializes ListenerLogData, which
>(in
>the PageLogData ctor) throws the StalePageException again!
>5) The second handler (RenderPageRequestHandler) is not detached, thus
>all
>models in the page are not detached
>6) The user clicks on a link and boom, the models are all still
>attached
>and there we get the LazyInitializationException
>
>I think that (a) RequestHandlerExecutor.detach() should ensure all
>handlers
>are detached, and (b) that failing to collect LogData should not stop
>the
>detaching of a request handler.
>
>What do you think?
>
>I tried to make the simplest possible Quickstart to demonstrate this.
>
>Weird stuff: on the homepage of the quick start, the page is properly
>detached when a stale link is clicked;
>On another (test) page, the page is not properly detached.
>
>Steps to reproduce:
>
>Run Quickstart
>Click on “Test” link on homepage
>Observe that the following is logged:
>
>Model still attached? false
>Page detaching
>
>Now click on "Click me (stale link)!”
>Now refresh the page (re-render)
>
>Observe that the following is logged:
>
>Model still attached? true
>Page detaching
>
>—> So the page was not detached
>
>These steps don’t have the same result on the homepage. So my guess is
>there is some relation to the fact that we are interacting with a
>stateful,
>non-mounted page.
>
>Met vriendelijke groet,
>Kind regards,
>
>Bas Gooren


Possible bug / edge case found where page is not detached

2021-07-23 Thread Bas Gooren
Hi all,

Today I spent the better part of my day investigating a bug report
regarding a hibernate LazyInitializationException.
Since we use detaching models everywhere and (in general) never see such
issues anymore, this one was interesting :-)

After much debugging I found out what is happening.

We have a page which has a database model + links for prev/next item (in
the database).
When the users double-clicks on one of the links, the first click is OK,
and the second click throws a StalePageException during request cycle
processing.

So far, normal.

However, stepping through the wicket code, this is what happens:

1) Resolve to ListenerRequestHandler, execute it, throws StalePageException
2) exception mapper handles this and we execute a RenderPageRequestHandler,
which re-renders the page
3) the request cycle detaches, which delegates in part
to RequestHandlerExecutor.detach()
4) The handlers to detach are both handlers from step 1 and 2; During the
detach of ListenerRequestHandler, it initializes ListenerLogData, which (in
the PageLogData ctor) throws the StalePageException again!
5) The second handler (RenderPageRequestHandler) is not detached, thus all
models in the page are not detached
6) The user clicks on a link and boom, the models are all still attached
and there we get the LazyInitializationException

I think that (a) RequestHandlerExecutor.detach() should ensure all handlers
are detached, and (b) that failing to collect LogData should not stop the
detaching of a request handler.

What do you think?

I tried to make the simplest possible Quickstart to demonstrate this.

Weird stuff: on the homepage of the quick start, the page is properly
detached when a stale link is clicked;
On another (test) page, the page is not properly detached.

Steps to reproduce:

Run Quickstart
Click on “Test” link on homepage
Observe that the following is logged:

Model still attached? false
Page detaching

Now click on "Click me (stale link)!”
Now refresh the page (re-render)

Observe that the following is logged:

Model still attached? true
Page detaching

—> So the page was not detached

These steps don’t have the same result on the homepage. So my guess is
there is some relation to the fact that we are interacting with a stateful,
non-mounted page.

Met vriendelijke groet,
Kind regards,

Bas Gooren

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Re: Password in url after page recreation

2021-07-20 Thread Bas Gooren
Hi Claudia,

I have never seen this in our applications - we always use a form POST to
submit user login details.
The only reason I can think of that would lead to your case is when you set
the form to submit using a GET request. That would put the fields in the
URL and thus in wicket’s page parameters, which are reused
when recreateBookmarkablePagesAfterExpiry is true and the page expired.

Did you by any chance specify a method=“GET” attribute on your form?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 20 juli 2021 bij 21:46:07, Claudia Hirt (claudiabec...@gmx.de) schreef:


> Hi all,
>
> we currenlty facing some issues with the
recreateBookmarkablePagesAfterExpiry option.
> We set this option to true, the user visits the login page and enters
username and password (""). Now the user
waits for the login till the session expires. Wicket forces a page recreate
and append the password into the url (e.G.
http://localhost:8080/app?user:unit:textfield=user:password="password;).

> This seems to be an security issue on our side. Unfortunately we can't
disable the recreateBookmarkablePagesAfterExpiry option due some resource
loading issues.
>
> We already thougth about what we can do to solve this issue, and it seems
to be possible to remove this parameter form the page parameters (which are
called for the rewrite url after an page expires).
> But before we implement this workaround we want to ask you guys if you
already have seen this issue and if yes, if you have any better solutions?
>
> Thanks for your help...


Re: reset form

2021-06-29 Thread Bas Gooren
Hi,

To remove any user input in form fields, you also need to call
Form#clearInput() (or FormComponent#clearInput() to clear specific
components).

Without this call, the fields will retain the user input instead of showing
the empty string you set (assuming that the fields you set to an empty
string value are used as model values for the form components).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 29 juni 2021 bij 10:22:01, vahid ghasemi (vahidghasemi...@gmail.com)
schreef:

First, thanks for the speed of your support.

1 AjaxButton reset = new AjaxButton("reset") {

2 @Override

3 public void onSubmit(AjaxRequestTarget target) {

4 name = nationalCode = email = phone = password =
confirmPassword = "";

5 target.add(form);

6 }

7 };
8 reset.setDefaultFormProcessing(false);

#setDefaultFormProcessing is working and breakpoint goes in line 4. but
after running code my inputs are still filled with values that have been
inside.

‫‪Sven Meier‬‏ <‪s...@meiers.net‬‏> در تاریخ سه‌شنبه ۲۹ ژوئن ۲۰۲۱ ساعت
۱۲:۲۶ نوشت:‬

> Hi,
>
> you have to call #setDefaultFormProcessing(false).
>
> Have fun
> Sven
>
>
> On 29.06.21 09:46, vahid ghasemi wrote:
> > Hello guys.
> > I have a form that has two buttons (Submit, Reset) and my form is
> > CompoundPropertiesModel.
> > The type of these buttons are AjaxButtons.
> > but Reset only works when the form is valid, otherwise it goes into the
> > onError method.
> > The type of reset button tag is "reset" and also the submit button is
> > "submit".
> > Before submitting the form (and without the wicket ajax button for
reset
> > button) the reset button is working. But after submitting when I click
on
> > the reset button (still without the wicket ajax button) my inputs don't
> go
> > empty.
> > So i think my problem was for CompoundPropertiesModel and i should set
> > empty fields of class and i need to add a wicket button to reset button
> > that reset inputs.
> > But the reset buttons it's not working because he thinks it is a submit
> > button.
> > So my questions are:
> > 1- How can i add some button link reset button for working when form is
> not
> > valid.
> > 2- What is the best way to reset the form with a button?
> > 3- why the reset button (just with type="reset") is not working after
> > submitting form?
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Parent page container required in child page?

2021-06-26 Thread Bas Gooren
Hi,

Have a look at TransparentWebMarkupContainer, it was specifically made
for this. This does involve some (internal) magic in wicket but allows
you to simply say this.add() in child pages instead of
rootContainer.add().

// Bas

Verstuurd vanaf mijn iPhone

> Op 26 jun. 2021 om 18:09 heeft Prag Progger  het 
> volgende geschreven:
>
> Hi,
>
> I have a ParentPage and many sub class child pages that extend it. I
> decided to add a root container element to the parent page, but this
> breaks all ChildPage.add() method calls in the child pages. A solution
> is to pass the root container to every child, but that is a lot of
> work. Is there a cleaner way to solve this problem without breaking
> all the child pages?
>
> // ParentPage.java
> public class ParentPage extends WebPage {
>// Shared with sub classes
>protected MarkupContainer rootContainer;
>
>public ParentPage() {
>rootContainer = new WebMarkupContainer("rootContainer");
>add(rootContainer);
>
>rootContainer.add(new Label("parentLabel", "Parent component"));
>}
> }
>
> // ParentPage.html
> 
>ParentPage
>
>
>
>
>
>
>
>
> 
>
>
> // ChildPage.java
> public class ChildPage extends ParentPage {
>public ChildPage() {
>// This should preferably be add() instead of rootContainer.add()
>// So that I don't have such dependency on the parentPage.
>rootContainer.add(new Label("childComponent", "Child component"));
>}
> }
>
> // ChildPage.html
> 
>
>Child page
>
>
>
> 
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Reg: Wicket CSRF Token

2021-06-16 Thread Bas Gooren
Hi Sundar,

Have you had a look at
https://julienprog.wordpress.com/2017/10/28/csrf-prevention-for-wicket/ ?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 16 juni 2021 bij 09:15:48, sundar saba (sundarsabapa...@gmail.com)
schreef:

Hi all,

I am using wicket and spring security in my application. By
default spring security enables CSRF protection. It expects a csrf token in
my wicket pages. How to define csrf token in all my wicket pages.Can you
all please help me define CSRF token in my wicket pages


Re: Kotlin 1.5.0 : NotSerializableException: Non-serializable lambda

2021-05-03 Thread Bas Gooren
Hi!

Probably related to this:

https://youtrack.jetbrains.com/issue/KT-46373

"Since 1.5, SAM-converted lambdas are generated using invokedynamic with
bootstrap method from java.lang.invoke.LambdaMetafactory.
Resulting proxy classes are not Serializable by default.”

So your lambda’s in WizardPage are no longer serializable by default due to
your upgrade to kotlin 1.5.0.

So I’d recommend downgrading your Kotlin for now.

(I’m not an active user of kotlin, so I found this information with 10
minutes of Googling)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 30 april 2021 bij 07:06:45, smallufo (small...@gmail.com) schreef:

more detail log :

2021-04-30 12:43:44.076 [http-nio-8080-exec-2] WARN
o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children/[write:1]/data
2021-04-30 12:43:44.078 [http-nio-8080-exec-2] WARN
o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children/[write:2]
2021-04-30 12:43:44.079 [http-nio-8080-exec-2] WARN
o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children
2021-04-30 12:43:44.099 [http-nio-8080-exec-2] ERROR
o.a.w.s.j.JavaSerializer.serialize - Error serializing object class
destiny.WizardPage [object=[Page class = destiny.WizardPage, id = 1, render
count = 1]]
org.apache.wicket.WicketRuntimeException: A problem occurred while trying
to collect debug information about not serializable object
at
org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:390)

at
java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)

at
org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:82)

at
org.apache.wicket.pageStore.AbstractPageStore.serializePage(AbstractPageStore.java:133)

at
org.apache.wicket.pageStore.DefaultPageStore.createSerializedPage(DefaultPageStore.java:281)

at
org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:61)

at
org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:482)

at
org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:214)


smallufo  於 2021年4月30日 週五 下午12:52寫道:

> I was using Kotlin 1.4.32 with wicket 8.11
> but after upgrading to Kotlin 1.5.0 , it throws :
>
> Caused by: java.io.NotSerializableException: Non-serializable lambda
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
>
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)

> at
>
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> at
>
java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1196)

> at
>
java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1523)

> at
>
java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1444)

> at
>
java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)

> at
>
java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1579)

>
>
> what may go wrong here ?
>
> The wicket mode is DEPLOYMENT
>
> 
> wicket
> org.apache.wicket.protocol.http.WicketFilter
> 
> applicationClassName
> foo.bar.MyApplication
> 
> 
> configuration
> DEPLOYMENT
> 
> 
> 
> wicket
> /app/*
> 
>
>
> @MacMiniM1  ~  java -version
> openjdk version "15.0.2" 2021-01-19
> OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
> OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode)
>
>
>
> Thanks
>
>


Re: Checking preconditions/changes in models

2021-01-29 Thread Bas Gooren
Hi Sven,

Thank you for explaining in detail, it helps a lot :-)

Part of your steps I have already implemented, but I never thought about
marking optional components or relying on Behavior#onException.

Since some components can be replaced in AJAX request, I guess you add an
exception-catching behavior to those components, and a page-level behavior
as “catch-all” for normal render requests?
(Since the catch-all behavior on the page will not catch exceptions that
occur when only a subtree of the page is rendered)
The thread local is probably to store the component + exception, so the
listener can access it?

Are you able to share some (stripped down) code of the request cycle
listener?

I all the non-trivial apps that I’ve built in wicket, exception handling
always becomes an issue at some point.
There’s not much documentation on this besides catching all exceptions and
displaying an error page.

So I’d like to take a stab at rolling a wicketstuff project for this, so
others can use it (or learn from it) :-)

Met vriendelijke groet,
Kind regards,

Bas

Op 20 januari 2021 bij 11:06:13, Sven Meier (s...@meiers.net) schreef:

Hi Bas,

>E.g. do you handle exceptions within the model itself, or with a
RequestCycleListener?

a requestCycleListener is my preferred solution:

- I've used Spring interceptors to wrap all exceptions from the service
layer for easier identification of the origin of the problem
- check the current handler to differentiate between actions or rendering
- in case of actions check targeted component (e.g. use annotations to
mark optional components)
- in case of rendering you can identify the failing component with
Behavior#onException() (utilizing a ThreadLocal)
- inspect the stacktrace as last resort
- re-render the page and show a feedback message

Regards
Sven


On 20.01.21 09:18, Bas Gooren wrote:
> Hi Sven,
>
> Thank you for your reply.
>
> On catching failure “when it happens”: can you explain what that looks
like
> for you?
>
> E.g. do you handle exceptions within the model itself, or with a
> RequestCycleListener?
>
> I think the tricky part is handling exceptions thrown by models, unless I
> guard every call to “getModelObject()” inside my components with a
> try-catch (so in methods like onConfigure, onClick etc).
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 14 januari 2021 bij 19:18:57, Sven Meier (s...@meiers.net) schreef:
>
> Hi Bas,
>
> in my experience is is very hard to check every possible failure upfront
> in preconditions (whether from page or models). There's always a
> corner-case waiting to hunt you.
>
> Therefore I prefer using option 1: catch the failure when it happens.
> Worked fine for me (most of the time), but maybe not a suitable approach
> for all kind of applications.
>
> Regards
> Sven
>
>
>
> On 12.01.21 14:37, Bas Gooren wrote:
>> Hi all,
>>
>> First off: best wishes to everyone for 2021, and that we may all have
fun
>> this year building stuff in Wicket!
>>
>> I’m wondering how others implement the following requirement…
>>
>> Suppose a page has a model backed by something stored in the session or
>> database (e.g. an e-commerce basket page or checkout).
>> When the user opens multiple tabs (with different instances of the
page),
>> either page can become “outdated” with regards to the actual data.
>>
>> E.g. in Tab A the customer removes a product.
>>
>> When the users then tries to update the quantity of that product in Tab
> B,
>> it can lead to a variety of runtime exceptions:
>> For example: Basket items are rendered with a repeater; If the # items
in
>> the basket changes, rows may reference non-existant items (either by
>> database ID or by list index in the basket rows).
>>
>> This sort of problem appears in various shapes and forms when a page
>> references data that may change independent from the page itself.
>>
>> Over the years I have attempted to fix this in three ways:
>>
>> 1. Catch RTEs/Exceptions and re-render page (works OK); But suppose a
>> ListView is used, this also needs to handle things like
>> IndexOutOfBoundsException (thrown from inside ListItemModel) /
>> EntityNotFoundException / NullPointerException. Feels cluttered and
>> “cleaning up after the fact” instead of preventing the RTE in the first
>> place.
>> 2. Check preconditions in page’s onConfigure(). Mixed results,
>> preconditions not always checked before action is executed (e.g. ajax
> link
>> click, form submit). So leads to finding more spots to check for
>> preconditions, e.g. Form#process
>> 3. Wrap models with decorating models at the page level that check
>> preconditions; E.g. BasketNotEmptyModel

Re: Checking preconditions/changes in models

2021-01-20 Thread Bas Gooren
Hi Sven,

Thank you for your reply.

On catching failure “when it happens”: can you explain what that looks like
for you?

E.g. do you handle exceptions within the model itself, or with a
RequestCycleListener?

I think the tricky part is handling exceptions thrown by models, unless I
guard every call to “getModelObject()” inside my components with a
try-catch (so in methods like onConfigure, onClick etc).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14 januari 2021 bij 19:18:57, Sven Meier (s...@meiers.net) schreef:

Hi Bas,

in my experience is is very hard to check every possible failure upfront
in preconditions (whether from page or models). There's always a
corner-case waiting to hunt you.

Therefore I prefer using option 1: catch the failure when it happens.
Worked fine for me (most of the time), but maybe not a suitable approach
for all kind of applications.

Regards
Sven



On 12.01.21 14:37, Bas Gooren wrote:
> Hi all,
>
> First off: best wishes to everyone for 2021, and that we may all have fun
> this year building stuff in Wicket!
>
> I’m wondering how others implement the following requirement…
>
> Suppose a page has a model backed by something stored in the session or
> database (e.g. an e-commerce basket page or checkout).
> When the user opens multiple tabs (with different instances of the page),
> either page can become “outdated” with regards to the actual data.
>
> E.g. in Tab A the customer removes a product.
>
> When the users then tries to update the quantity of that product in Tab
B,
> it can lead to a variety of runtime exceptions:
> For example: Basket items are rendered with a repeater; If the # items in
> the basket changes, rows may reference non-existant items (either by
> database ID or by list index in the basket rows).
>
> This sort of problem appears in various shapes and forms when a page
> references data that may change independent from the page itself.
>
> Over the years I have attempted to fix this in three ways:
>
> 1. Catch RTEs/Exceptions and re-render page (works OK); But suppose a
> ListView is used, this also needs to handle things like
> IndexOutOfBoundsException (thrown from inside ListItemModel) /
> EntityNotFoundException / NullPointerException. Feels cluttered and
> “cleaning up after the fact” instead of preventing the RTE in the first
> place.
> 2. Check preconditions in page’s onConfigure(). Mixed results,
> preconditions not always checked before action is executed (e.g. ajax
link
> click, form submit). So leads to finding more spots to check for
> preconditions, e.g. Form#process
> 3. Wrap models with decorating models at the page level that check
> preconditions; E.g. BasketNotEmptyModel; Usually combined with
specialized
> subclass of Form which manages transaction and commit/rollback
>
> Of all these ways I prefer option 3 nowadays, as this is a close to the
> “root” of the problem as possible: at the point where the data is
accessed.
> Since such models are always caching models (LDM), the overhead is
minimal
> (called once or twice per request).
> Another advantage is that all components in the page point to the parent
> model, which means preconditions are always checked for any component on
> the page.
>
> When using JPA we can even do a simple check for the entity “last
modified”
> or version, to ensure that the entity did not change between requests.
>
> However, I’m evaluating which variant I will use from now on in projects
> (to standardize) and am wondering how others handle this.
>
> Any input/feedback is highly appreciated!
>
> Kind regards,
>
> Bas
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Illegal Reflective Access in DefaultPropertyLocator

2021-01-18 Thread Bas Gooren
Hi!

That’s actually quite easy to replace:

If you have a model containing the LocalDateTime, change the call to:

var model = Model.of( LocalDateTime.now() );
model.map( LocalDateTime::toLocalDate );

Since the “date” field is private final I assume your model was read-only.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 18 januari 2021 bij 17:13:42, Johannes Renoth (johannes.ren...@gmx.de)
schreef:

Hello,

In my project i have the following Warning since the Update to Java 11:

The issue remains even after trying with the latest Version 9.2.0

I am using a LocalDateTime Model Object with PropertyModel(LocalDateTime,
"date").

Of course i could try to split my Model into two parts date and time but it
is much more convenient as it is now.

Any suggestions what i could do?


Checking preconditions/changes in models

2021-01-12 Thread Bas Gooren
Hi all,

First off: best wishes to everyone for 2021, and that we may all have fun
this year building stuff in Wicket!

I’m wondering how others implement the following requirement…

Suppose a page has a model backed by something stored in the session or
database (e.g. an e-commerce basket page or checkout).
When the user opens multiple tabs (with different instances of the page),
either page can become “outdated” with regards to the actual data.

E.g. in Tab A the customer removes a product.

When the users then tries to update the quantity of that product in Tab B,
it can lead to a variety of runtime exceptions:
For example: Basket items are rendered with a repeater; If the # items in
the basket changes, rows may reference non-existant items (either by
database ID or by list index in the basket rows).

This sort of problem appears in various shapes and forms when a page
references data that may change independent from the page itself.

Over the years I have attempted to fix this in three ways:

   1. Catch RTEs/Exceptions and re-render page (works OK); But suppose a
   ListView is used, this also needs to handle things like
   IndexOutOfBoundsException (thrown from inside ListItemModel) /
   EntityNotFoundException / NullPointerException. Feels cluttered and
   “cleaning up after the fact” instead of preventing the RTE in the first
   place.
   2. Check preconditions in page’s onConfigure(). Mixed results,
   preconditions not always checked before action is executed (e.g. ajax link
   click, form submit). So leads to finding more spots to check for
   preconditions, e.g. Form#process
   3. Wrap models with decorating models at the page level that check
   preconditions; E.g. BasketNotEmptyModel; Usually combined with specialized
   subclass of Form which manages transaction and commit/rollback

Of all these ways I prefer option 3 nowadays, as this is a close to the
“root” of the problem as possible: at the point where the data is accessed.
Since such models are always caching models (LDM), the overhead is minimal
(called once or twice per request).
Another advantage is that all components in the page point to the parent
model, which means preconditions are always checked for any component on
the page.

When using JPA we can even do a simple check for the entity “last modified”
or version, to ensure that the entity did not change between requests.

However, I’m evaluating which variant I will use from now on in projects
(to standardize) and am wondering how others handle this.

Any input/feedback is highly appreciated!

Kind regards,

Bas


Re: Migration from 7 to 8.9.0 : Missing Ajax target in listener

2020-08-21 Thread Bas Gooren
Hi,

It sounds like you are using Ajax fallback links, and the javascript event
handlers are not properly registered or firing.
If that happens, the link is processed like a normal/non-ajax link.

When you inspect the Ajax response when the list is refreshed, do you see
“Wicket.Ajax.ajax” javascript calls?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 21 augustus 2020 bij 11:16:01, Frédéric Donckels (
frederic.donck...@gmail.com) schreef:

Hello,

we are in the process of migrating from Wicket 7 to 8.9.0 and have a
troubling issue. On one page, we have a list of elements. When we click on
an "Add Button", an ajax panel is modified in the page to add a new element
in the list. When the "submit button" (ajax) is clicked, the list is
refreshed (added to the ajax target).

But the puzzling thing, now, is that the Ajax buttons, in the list, do not
have an ajax target when clicked (the optional is empty, and from what I've
seen so far, the listener doesn't consider it has been called within an
Ajax request). This only happens when the list has been refreshed, when it
is populated initially, the button triggers properly an ajax listener.


And this didn't happen with the same code on Wicket 7.

Is that a known issue? How can I investigate further?


Regards


Re: "wicket:message" in markup combined with Property Expression Language

2020-08-14 Thread Bas Gooren
Hi Thorsten,

I had a quick look at the source code for this:

For wicket:message attributes, wicket uses WicketMessageTagHandler; For
wicket:message tags it uses WicketMessageResolver.

In both classes I see that wicket uses the provided message key verbatim,
without doing any property replacement prior to using it to find a
localized message.
This means you’ll have to wire things up in java code to make your use-case
work.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14 augustus 2020 bij 09:56:50, Thorsten Schöning (tschoen...@am-soft.de)
schreef:

Hi all,

I know how to use StringResourceModel with Property Expression
Language to read keys and values from language files using some
dynamic parts. The point is that StringResourceModel needs to be
provided to some component, like a label, or that model needs to be
used manually to read some values.

But is the same available when Wicket does things automatically, like
handling localized messages?

>  title="Show details of all [...] meters."
> wicket:message="title:caption.${kindOfDetail}.show.title">
> 
> Details of all [...] meters.
> 

That link is part of some markup of some component, but is not used by
the component itself, only by some client-side JavaScript. Though, I
would like to make the "caption"-text be resolved by some dynamic key
provided by the component.

Is that posisble and if so, how do I need to provide that key? Do I
need to set a StringResourceModel with that key as default model of
that component?

Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/

Telefon...05151- 9468- 55
Fax...05151- 9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Issues with refreshing panel with form

2020-08-03 Thread Bas Gooren
Hi Michal,

Can you provide some code, e.g. a Quickstart application [1] so we can have
a look?

It’s hard to say why it’s not working without seeing some code.

1) https://wicket.apache.org/start/quickstart.html

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 augustus 2020 bij 13:53:36, Zimen, Michal (michal.zi...@anasoft.com)
schreef:

Hi Wicket Users,


I've just started to learn the Wicket by fixing some issues in our legacy
backlog repository.

Therefore, I need some clarification to manage my blockpoints. Having spent
enough time to fix it by myself,
I finally must turn out to this help.

The weird problem could be described following:


1. A base form contains components and links to
AbstractFormDialog(Jquery-ui) for user inputs.
2. When the formDialogA is submitted, some parent components are updated,
some remain empty, as it is expected.
3. Another modal formDialogB is open and submitted and expecting components
are not updated.

When this procedure is done in swapped sequence - firstly formDialogB and
then formDialogA is opened, everything works ok.

Seems as if, the submitting formDialogA breaks the references for
submission formDialogB.

Could you please clarify me, what should be checked to avoid this problem?

Thanks,

M.



Michal Zimen
e-mail: michal.zi...@anasoft.com


Re: Page locked for a long time

2020-07-23 Thread Bas Gooren
Hi Maxim,

You need to call parseFileParts() on the request yourself before accessing
files and post parameters, or there are no parts and post parameters.

Am on mobile so cannot quickly find java doc for 8 or 9 but api is the same:

https://ci.apache.org/projects/wicket/apidocs/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.html#parseFileParts()

// Bas

Verstuurd vanaf mijn iPhone

Op 24 jul. 2020 om 05:49 heeft Maxim Solodovnik  het
volgende geschreven:

Hello Martin, All,

finally I have started to implement this functionality and faced weird
issue: no post parameters are retrievable :((
I was able to reproduce this using quickstart
https://github.com/solomax/upload-resource
Can you please take a look at it?

On Mon, 6 Jul 2020 at 14:33, Thomas Heigl  wrote:

We've been using Martin's solution with JQueryFileUpload for years and it

works great.


Best,


Thomas


On Mon, Jul 6, 2020 at 8:59 AM Maxim Solodovnik 

wrote:


Thanks a million :))


On Mon, 6 Jul 2020 at 13:43, Martin Grigorov 

wrote:


On Sun, Jul 5, 2020 at 9:16 PM Sven Meier  wrote:


Hi Maxim,


you'll have to upload these files to a resource separately.


I'm not aware of a reusable solution for that.



Here is a blog article on this topic:

http://wicketinaction.com/2012/11/uploading-files-to-wicket-iresource/

and

its demo app:

https://github.com/martin-g/blogs/tree/master/file-upload




Have fun

Sven



On 05.07.20 17:20, Maxim Solodovnik wrote:

Hello All,


our app allows huge file uploads

I have noticed the page is locked while incoming input stream is

being

copied

(might take more than an hour)


 at java.base@11.0.7/java.io

.InputStream.read(InputStream.java:205)

at org.apache.commons.fileupload.util.Streams.copy(Streams.java:98)

at org.apache.commons.fileupload.util.Streams.copy(Streams.java:68)

at





org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:346)

at





org.apache.wicket.protocol.http.servlet.MultipartServletWebRequestImpl.parseFileParts(MultipartServletWebRequestImpl.java:196)

at


org.apache.wicket.markup.html.form.Form.handleMultiPart(Form.java:1470)


Are there any options to prevent page lock?



-

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

For additional commands, e-mail: users-h...@wicket.apache.org






--

Best regards,

Maxim





-- 
Best regards,
Maxim


Re: Change pageId Parameter structure

2020-07-14 Thread Bas Gooren
Hi Ravi,

Instead of writing custom implementations of existing mappers, maybe there
is an alternative approach:

Wrap the application’s root request mapper with a decorator, and translate
the parameter in question.
So as the last call in your application’s init method, write:

setRootRequestMapper(new PageComponentInfoRewritingDecorator(
getRootRequestMapper()));

So for incoming requests, remove QueryParameter “pageId” and prepend a new
QueryParameter at index 0 (name=“”, value=(name of original param))
You can clone the request with a new url, see Request#cloneWithUrl
Pass the cloned request on to the delegate/original compound mapper.

For generated urls, check for a QueryParameter at position 0 with an empty
value.
If it’s present, replace it with a new QueryParameter (name=(value of
original param), value=“”)

This does couple you to wicket internals (so write some unit tests!), but
also allows you to solve this in 1 location instead of many locations.

Source: I have written many such custom mappers and mapper decorators, e.g.
for localization of urls.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14 juli 2020 bij 14:54:07, Ravi Knox (ravi.k...@intellinet.de) schreef:

Hi Martin,



that was a good starting point, thank you.

I had to overwrite basically all Mappers within the SystemMapper and mounts
(since they create mappers themselves).



The following Methods I had to overwrite:

- #encodePageComponentInfo - for adding the custom page param

- #getPageComponentInfo - for reading the custom page param as
component id

- #extractPageParameters - to remove the custom page param from the
parameter list



Does that make sense to you or did I miss something?



Thanks,



Ravi





Hi Ravi,



The logic you look for is at

https://github.com/apache/wicket/blob/267fb06eec31e8e530fb5f0a4f691a0782e3d5
b8/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractC

omponentMapper.java#L79

It is called by:

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/a
pache/wicket/core/request/mapper/PageInstanceMapper.java#L133



You will need to use custom version of PageInstanceMapper that overrides

protected void encodePageComponentInfo(Url url, PageComponentInfo info)



On Mon, Jul 13, 2020 at 8:40 AM Ravi Knox  wrote:



> Hi all,

>

>

>

> my client has a website, where he includes our Wicket application (Wicket

> 8.3.0) via JQuery.load() in his template.

>

> Because of a Reverse-Proxy, he has to whitelist all PageParameters.

>

>

>

> To keep it short;

>

> We need to change the pageId Parameter to something like

> "myapp.com/homepage?pageId=1".

>

>

>

> After reading source code and googleing I couldn't find a way to do this.

>

> Is it even possible? If so, where would be the place to look for?

>

>

>

> Thanks for any hints,

>

>

>

> Ravi

>

>





Quoted from:

http://apache-wicket.1842946.n4.nabble.com/Change-pageId-Parameter-structure
-tp4684229p4684233.html


Re: Preventing AJAX behavior to execute during page reload

2020-03-06 Thread Bas Gooren
Hi Sebastian,

I’m confused: you say you have a stateful page but redirect in a stateless
manner (to a new page instance).

I think this is relatively easy to fix if you remain stateful, because (a)
wicket guards against concurrent acces to a single page instance and (b)
you can track in the page state if an action was executed or not.

May I ask why you are not simply calling setResponsePage(getPage())?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 6 maart 2020 bij 10:58:59, Sebastian Lichtenfels (
sebastian.lichtenf...@tomtec.de) schreef:

Hi all,

I have a problem with an AJAX behavior that I have on a stateful page. The
behavior is triggered by the user by clicking a button (the button is
outside my control).
The behavior then does some backend action on the server and afterwards
reloads the page (by calling
RequestCycle.get().setResponsePage(page.getPageClass(),
page.getPageParameters());, where page is the the current page).
My problem now is that it can happen that the user clicks the button twice
which results in the following sequence of calls:

1. First behavior is triggered on page version 1

2. Backend action is done

3. Server sends 302 to reload page

4. Second behavior is triggered (still for page version 1)

5. Backend is done for second behavior

6. Client cancels AJAX request for second behavior, because of the page
redirect -> so no additional page reload here

7. Page render is triggered by the page reload

My goal is to always reload the page if the backend action is triggered,
because the page's state depends on the backend state.
So either the second behavior should not be triggered at all or it should
be correctly executed (meaning backend action AND page reload should be
triggered).
How can I achieve this?

Best regards,
Sebastian


Re: Dealing with editing of nested objects in a multiple screens for a single entity

2020-01-18 Thread Bas Gooren
Hi Sven,

Thank you for your input.

Agreed - change tracking is hard and having simple models is always key. It
also means everything is much simpler to reason about.

This actually leads me to a new way to investigate: perhaps I can simply
detach the entity for editing and merge on saving.
That would make my use-case possible.

In all my 13? years of wicket development I have always used EntityModels
(LoadableDetachableModel subclass) to (a) load a fresh entity from the
database to update, or (b) create a new instance on the fly.

And a little more complex things for editing nested lists in-place in an
entity editor screen, by tracking additions and deletions.
But I guess those cases could be handled with detached entities, too.

How are others managing this? Same like me - so with some kind of
EntityModel, or do you also work with detached entities?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 17 januari 2020 bij 21:42:54, Sven Meier (s...@meiers.net) schreef:

Hi Bas,

>set of custom models that remembers what was provided in “setObject”
and can later replay this

in my experience most attempts on putting to much logic into model
implementations have failed.
Long class names (ahem NestedPropertyChangeListenerModel) or deeply
nested model delegations are warning signs for me.

Change tracking is hard, so I'd advice to work directly on your entities.
I'd go with a) or c) "always keep a default variant in the product".

Have fun
Sven



On 16.01.20 11:41, Bas Gooren wrote:
> Hi all!
>
> I’m currently working on an editing system which has composite elements;
>
> For example:
>
> We store Products (e.g. an iPod 64GB) and those Products have Variants
> (Blue).
> Since a variant cannot exist without a product, and we want to enforce
that
> every product has at least one variant, we want to implement this in a
> single screen.
> So here the Product is a composite which contains one or more Variants.
>
> To extend my example: a Variant has pricing based on Country, Website etc.
> So the Variant is also a composite;
>
> In all previous projects we either
> a) relaxed the requirements, like don’t require a product to have at least
> one variant, which means the creation of variants happens when the Product
> already exists
> b) perform all editing in a single form, so everything is committed in one
> go
>
> But since our composites are more complex in this project, the UI becomes
a
> bit crazy, so we want to break out the nested editors.
> Essentially this requires us to build some sort of change tracking
feature,
> like a set of custom models that remembers what was provided in
“setObject”
> and can later replay this.
> We can then track all changes that happen in editors, and replay those
> changes later (e.g. when the Product editor is submitted).
>
> Given that we want to support nested composites (Product -> List of
Variant
> -> List of VariantPrice), this can get quite complex.
>
> So before embarking on this, I’d like to ask if others have implemented a
> similar system, or if they have other suggestions.
>
> I seem to recall that a long time ago there was discussion about this as
> well, perhaps it was regarding a really complex
> NestedPropertyChangeListenerModel (;-)) at topicus or hippo or similar.
> I think it was ultimately refactored into something much simpler due to
the
> difficulty in maintaining it.
> But alas, I cannot seem to find any mention of it anymore.
>
> Thank you all for reading and any input you can provide.
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: An open source devops platform completely created with Wicket

2020-01-16 Thread Bas Gooren
Hi Robin,


Wow - that looks like a really polished product, compliments to you!


Regarding Wicket I completely agree; While there are more fashionable
techniques, I tend to feel like they drastically increase complexity when
compared to wicket.

I’m happy to hear stories such as yours (which mimic mine), as there are
not that many (public) stories about wicket usage :-)


I will certainly have a close look at your product.


Thanks!

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 17 januari 2020 bij 01:26:06, Robin Shen (ro...@pmease.com) schreef:

Dear wicket users,

I'd like to introduce OneDev, an open source all-in-one devops platform:
https://github.com/theonedev/onedev

It is created completely with Wicket with only one person. I know that
there are modern and fashion techniques such as React/Vue, but I still feel
that Wicket is the most suitable framework for this product, considering
that I can work with the same set of code from front-end to back-end, with
Java's mature libraries and toolings. I must say I gain great productivity
with Wicket.

Hope this product is useful to someone.

Robin


Dealing with editing of nested objects in a multiple screens for a single entity

2020-01-16 Thread Bas Gooren
Hi all!

I’m currently working on an editing system which has composite elements;

For example:

We store Products (e.g. an iPod 64GB) and those Products have Variants
(Blue).
Since a variant cannot exist without a product, and we want to enforce that
every product has at least one variant, we want to implement this in a
single screen.
So here the Product is a composite which contains one or more Variants.

To extend my example: a Variant has pricing based on Country, Website etc.
So the Variant is also a composite;

In all previous projects we either
a) relaxed the requirements, like don’t require a product to have at least
one variant, which means the creation of variants happens when the Product
already exists
b) perform all editing in a single form, so everything is committed in one
go

But since our composites are more complex in this project, the UI becomes a
bit crazy, so we want to break out the nested editors.
Essentially this requires us to build some sort of change tracking feature,
like a set of custom models that remembers what was provided in “setObject”
and can later replay this.
We can then track all changes that happen in editors, and replay those
changes later (e.g. when the Product editor is submitted).

Given that we want to support nested composites (Product -> List of Variant
-> List of VariantPrice), this can get quite complex.

So before embarking on this, I’d like to ask if others have implemented a
similar system, or if they have other suggestions.

I seem to recall that a long time ago there was discussion about this as
well, perhaps it was regarding a really complex
NestedPropertyChangeListenerModel (;-)) at topicus or hippo or similar.
I think it was ultimately refactored into something much simpler due to the
difficulty in maintaining it.
But alas, I cannot seem to find any mention of it anymore.

Thank you all for reading and any input you can provide.

Met vriendelijke groet,
Kind regards,

Bas Gooren


Re: Retrieve user's page on the site

2019-12-30 Thread Bas Gooren
Hi!

We see these typos of errors every now and then too. It’s usually people
navigating to old pages, double clicking on links etc.

Nevertheless, in our logs these are relatively easy to find: we send out
e-mail notifications when such errors occur, and the e-mail includes quite
some details (page, component, session id, logged in user etc, user ip);
So far, I have always been able to trace the user’s steps by simply
grepping the access logs for their IP around the time of the exception.

Should you not be able to do that, I guess it would be relatively simple to
track user actions (e.g. the last 10 actions) yourself in the user session.
Simply write a request cycle listener, and get some meaningful information
from the next handler to be executed.

E.g. override onRequestHandlerScheduled() and deduct the action from the
request handler;

ListenerRequestHandler: component or behavior invoked
etc.

Store the actions as strings (e.g. “render pageX(pageParams=XYZ)”, “Click
on link a.b.c in PageX”, “Submit form path.to.component in PageX”).

If you have an app where users are logged in, you can track the last X
actions in the user’s session; Otherwise you could externalize this (either
in-memory by IP, or some other backing store).
When an exception occurs, you can catch it in your request cycle listener
and fetch the last user actions. Together, these should provide a better
trail of actions leading up to the exceptions.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 30 december 2019 bij 05:24:19, Илья Нарыжный (phan...@ydn.ru) schreef:

Hello,

We have pretty widely used software with thousands of visits per day.
And from time to time we observe pretty weird Wicket related errors
in logs. Commonly it's something about components structure: no such
child, there is already such element and etc. But the problem is that
commonly we can't reproduce the problem right away: page is working as
expected. So such mysterious problems just lie in logs and not being
fixed.
And here is the question: is there some good way to retrieve and log
previous user actions and etc.? Theoretically everything should be in
PageStore. What can you recommend to handle such problems properly?

P.S. To be able to catch such problems we even build a system for
gathering all logs on a central server and correlate them with each
other according to some correlation logic. But still - no big luck -
so we really believe that problem is in fact that we know only current
user page/location and do not know historical aspect.

Thanks,
Ilia

-
Orienteer(http://orienteer.org) - open source Business Application Platform

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Application not seri

2019-12-21 Thread Bas Gooren
Hi,

The stacktrace shows you that you are passing a LoadableDetachableModel
to info.sls.GMapPanel which contains a non-serializable reference
to info.sls.WicketApplication$3;

info.sls.WicketApplication$3 is an anonymous class inside your
WicketApplication, which contains a reference to it’s owning class
(WicketApplication).

Can you show us the code where you initialize the GMapsPanel and it’s
LoadableDetachableModel? That’s where we’ll probably find the culprit :-)

Usually this is caused by code like this:

MyServiceInsideApplication service = MyApplication.getService();
LoadableDetachableModel ldm = new LoadableDetachableModel() {
X load() {
return service.getX();
}
};

The above code will attempt to serialize MyServiceInsideApplication.

Code like this should be rewritten as follows:

LoadableDetachableModel ldm = new LoadableDetachableModel() {
X load() {
MyServiceInsideApplication service = MyApplication.getService();
return service.getX();
}
};

This way, there is no need to serialize the service, as it can be looked up
just-in-time when it is needed.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 21 december 2019 bij 07:03:18, ShengChe Hsiao (front...@gmail.com)
schreef:

Dear all
I faced a strange exception, the error message:

A problem occurred while checking object with type:
info.sls.WicketApplication

Field hierarchy is:

1 [class=info.sls.MapPage, path=1]

private java.lang.Object org.apache.wicket.MarkupContainer.children
[class=java.util.ArrayList]

private java.lang.Object
org.apache.wicket.MarkupContainer.children[write:27][write:28]
[class=org.apache.wicket.markup.html.form.StatelessForm,
path=1:formGMapSelect]

private java.lang.Object org.apache.wicket.MarkupContainer.children
[class=java.util.ArrayList]

private final java.lang.String
org.apache.wicket.markup.html.form.ChoiceRenderer.idExpression[write:8][write:11]

[class=org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink,
path=1:formGMapSelect:btnSelect]

final info.sls.GMapPanel info.sls.MapPage$1.val$gMapPanel
[class=info.sls.GMapPanel, path=1:gmaps]

java.lang.Object org.apache.wicket.Component.data
[class=[Ljava.lang.Object;]

java.lang.Object org.apache.wicket.Component.data[0]
[class=org.apache.wicket.model.LoadableDetachableModel]

final info.sls.WicketApplication
info.sls.WicketApplication$3.this$0 [class=info.sls.WicketApplication]
<- field that is causing the problem


I use transient with WicketApplication in my BasePage, but the issue
continued.


private transient WicketApplication wicketApplication;



Any suggestions?

--->
To boldly go where no man has gone before.

--->
We do this not because it is easy. We do this because it is hard.
-
-->
If I have seen further it is by standing on the shoulders of giants.
--
->
front...@gmail.com
->


Re: Is there a way to control Wicket's id generation?

2019-10-25 Thread Bas Gooren
Hi!

It sounds like you are referring to markup ids.

Have a look at the source code of Component:

https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/Component.java#L1508

This is where “random” ids are generated for components.
These generally have the format “id” + random chars.

Looking through the source code, the only reference I can find to “radio” +
unique id, is in Radio:

https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Radio.java#L115

You can see that wicket auto-generates a “radioX” value there.
Of course the value can be overridden, but not with a central strategy.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 25 oktober 2019 bij 17:06:32, Entropy (blmulholl...@gmail.com) schreef:

I work on a government project and one of our rules is that all of our apps
scrape the request object and log it so that everything that happens can be
reviewed. Partly this is for audit reasons, sometimes it comes in handy for
lawsuits, but mostly it's handy for our L2 support team.

But when a dev fails to provide an explicit name for something, we get
things in the log like 'radio54' and the like. Which is understandable as
the dev failed to provide a name (bad dev! *swats dev with newspaper*).

A recent lawsuit revealed yet another place where the unhelpful 'radio38'
is
logged. Our PM asked if we can help our devs out because this mistake is
happening too often. Can we disable wicket's natural tendency to generate
these names and force an exception instead? Thus, the mistake would be
caught early.

Wicket often exposes 'strategy' objects or other overrides to do this sort
of thing, so I'm wondering if such a facility exists? Even if it weren't an
exception, but were some other kind of thing that drew the dev's attention
it would be useful.

We're in Wicket 6.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Wrapping a FormComponent with a Border

2019-09-04 Thread Bas Gooren
Hi Tom,

I can have a look over the weekend, to see if I can extract some code and
put it on GitHub for you.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 september 2019 bij 13:05:42, Tom Götz (t...@richmountain.de) schreef:

Hi Bas and thanks for your input! I guess this would also be my preferred
way to deal with that task. But this also means that all "client"
applications would have to be adapted and at least change their HTML markup
which I'd like to avoid. I'm currently looking for a solution that avoids
code changes as far as possible in existing client applications (and we
have _several_ of those) ...

Any chance you could share some parts of your custom code?

Tom

> Gesendet: Dienstag, 03. September 2019 um 12:19 Uhr
> Von: "Bas Gooren" 
> An: users@wicket.apache.org, "Tom Götz" 
> Betreff: Re: Wrapping a FormComponent with a Border
>
> Hi Tom,
>
> I have tried various ways to make this work: from custom markup filters
and
> component tree manipulation to custom form components, which are added to
a
> repeater (and thus the entire form is created programmatically, apart
from
> a single div which our FormPanel connects to.
> In other projects I have experimented with rewriting the markup with a
> custom parser, implementing a custom markup cache etc.
>
> I think, in general, the wicket-way is to not have (too) much magic; This
> also became evident for me when working with markup filters and custom
> markup caches. I got it all to work, but it’s quite complex.
>
> In my current projects I pick (or mix) from these two strategies:
>
> a) add the div for a border component to the layout:
>
> 
> 
> 
>
> b) use custom form components, and render them with a repeater
>
> E.g. a TextInput implements Input, which contains the border, input
> component etc.
> The repeater then accepts a list of Input.
> Actually, we added a FormElement base class, since we also want to have
> non-input components in our forms like tabbed panels, information boxes
etc.
>
> In both cases, in your code you know what markup and component tree you
are
> dealing with.
> In other words: no magic.
>
> My 2 cents :-)
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 3 september 2019 bij 11:19:06, Tom Götz (t...@richmountain.de) schreef:
>
> Well ok, I'll give the Panel solution a try. In the panel I will have a
> FormGroup Border and inside that there's my input/textfield. Only thing
> that still worries me:
> user creates the TextField in Java code with wicket:id that he has in
it's
> markup file. This wicket:id can't be changed afterwards (final). But in
> MyFormGroupPanel I need markup for the input, and this markup needs an
id.
> Hm, maybe I'll look into some repeater solution for that problem ...
>
> Tom
>
>
> > Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> > Von: "Martin Grigorov" 
> > An: "users@wicket.apache.org" 
> > Betreff: Re: Wrapping a FormComponent with a Border
> >
> > On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz"  wrote:
> >
> > > Thanks Martin, I will look into that. But won't it be a problem that
I
> > > will add the  / TextField to the Border without having any
> markup
> > > inside the Border? Won't I need my  markup inside the border
> > > s?
> > >
> >
> > right! it is a Border, not a Panel (
> >
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> > )
> > I think it would be easier if you roll MyFormGroupPanel instead of
using
> a
> > Border.
> > If you decide to stick with FormGroup then you will need to override
> > onComponentTagBody() too
> >
> >
> > >
> > > Tom
> > >
> > >
> > > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > > Von: "Martin Grigorov" 
> > > > An: "users@wicket.apache.org" 
> > > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > > >
> > > > Hi Tom,
> > > >
> > > > Since your "user" is going to add a TextField in the Java code then
I
> > > > assume (s)he is going to add  in the
markup.
> > > > Your IComponentInitializationListener will replace all components
of
> type
> > > > TextField which do not have FormGroup as a parent with a
MyFormGroup.
> > > >
> > > > public class MyFormGroup extends FormGroup {
> > > > // constructor(s)
> > > &

Re: Wrapping a FormComponent with a Border

2019-09-03 Thread Bas Gooren
Hi Tom,

I have tried various ways to make this work: from custom markup filters and
component tree manipulation to custom form components, which are added to a
repeater (and thus the entire form is created programmatically, apart from
a single div which our FormPanel connects to.
In other projects I have experimented with rewriting the markup with a
custom parser, implementing a custom markup cache etc.

I think, in general, the wicket-way is to not have (too) much magic; This
also became evident for me when working with markup filters and custom
markup caches. I got it all to work, but it’s quite complex.

In my current projects I pick (or mix) from these two strategies:

a) add the div for a border component to the layout:





b) use custom form components, and render them with a repeater

E.g. a TextInput implements Input, which contains the border, input
component etc.
The repeater then accepts a list of Input.
Actually, we added a FormElement base class, since we also want to have
non-input components in our forms like tabbed panels, information boxes etc.

In both cases, in your code you know what markup and component tree you are
dealing with.
In other words: no magic.

My 2 cents :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 september 2019 bij 11:19:06, Tom Götz (t...@richmountain.de) schreef:

Well ok, I'll give the Panel solution a try. In the panel I will have a
FormGroup Border and inside that there's my input/textfield. Only thing
that still worries me:
user creates the TextField in Java code with wicket:id that he has in it's
markup file. This wicket:id can't be changed afterwards (final). But in
MyFormGroupPanel I need markup for the input, and this markup needs an id.
Hm, maybe I'll look into some repeater solution for that problem ...

Tom


> Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> Von: "Martin Grigorov" 
> An: "users@wicket.apache.org" 
> Betreff: Re: Wrapping a FormComponent with a Border
>
> On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz"  wrote:
>
> > Thanks Martin, I will look into that. But won't it be a problem that I
> > will add the  / TextField to the Border without having any
markup
> > inside the Border? Won't I need my  markup inside the border
> > s?
> >
>
> right! it is a Border, not a Panel (
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> )
> I think it would be easier if you roll MyFormGroupPanel instead of using
a
> Border.
> If you decide to stick with FormGroup then you will need to override
> onComponentTagBody() too
>
>
> >
> > Tom
> >
> >
> > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > Von: "Martin Grigorov" 
> > > An: "users@wicket.apache.org" 
> > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > Since your "user" is going to add a TextField in the Java code then I
> > > assume (s)he is going to add  in the markup.
> > > Your IComponentInitializationListener will replace all components of
type
> > > TextField which do not have FormGroup as a parent with a MyFormGroup.
> > >
> > > public class MyFormGroup extends FormGroup {
> > > // constructor(s)
> > >
> > > @Override
> > > public void onComponentTag(ComponentTag tag) {
> > > super(tag);
> > > tag.setName("div"); // this modifies  to 
> > > }
> > > }
> > >
> > > I am not sure, but you may also need to expand the tag from OpenClose
> > (i.e.
> > > ) to open+close (i.e. ). See
> > ComponentTag#isOpenClose()
> > > and Component#afterRender();
> > >
> > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" 
wrote:
> > >
> > > > Martin,
> > > >
> > > > maybe you could point me into the right direction concerning the
markup
> > > > manipulation part?
> > > >
> > > > This is what I got in my HTML:
> > > >
> > > > 
> > > > 
> > > > 
> > > >
> > > > I guess this is what I need for effectively replacing the input
with a
> > > > FormGroup border:
> > > >
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > > Where would be the best place in the code to start looking?
> > > >
> > > > Thanks in advance
> > > > Tom


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Migrating to 8.5

2019-08-19 Thread Bas Gooren
Hi!

It sounds like you are not referencing the correct wicket-request
dependency.

Did you check your maven dependency tree to ensure there are no old (or
duplicate/multiple) versions of wicket dependencies being resolved?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 19 augustus 2019 bij 12:44:24, sb_apa...@bursch.com (sb_apa...@bursch.com)
schreef:

Hi

I'm trying to migrate my project from 7.x to 8.5. I created a new
pom.xml using your Quick Start Wizard, checked the old dependencies for
new versions, inserted the dependencies to the new pom.xml and fixed the
compile errors.

But deploying the war-file to tomcat 8, I'm receiving the following error:

java.lang.NoSuchMethodError:
org.apache.wicket.request.mapper.ParentPathReferenceRewriter.(Lorg/apache/wicket/request/IRequestMapper;Ljava/util/function/Supplier;)V



I would be grateful for any tip on where the mistake might be or to
debug this problem.

Kind Regards,
Sven

(full Errormessage attached)


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Control how and where the Bootstrap css resources are included in the page

2019-05-10 Thread Bas Gooren
Hi!

To ensure your resources render *after* bootstrap, you need to make them
dependent on the bootstrap css resource.

You can override HeaderItem#getDependencies() in your custom CssHeaderItem,
and add the bootstrap css resource to its list of dependencies.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 mei 2019 bij 17:24:43, Matteo Alessandroni (
matteo.alessandr...@tirasa.net) schreef:

Hi,

I would like to know whether there is a way to decide where to place the
Bootstrap css resources in the  element.

I'm asking this because I have a "BookmarkablePageLink" element on page
A and, when you click it, it redirects to page B.
Now on B I see all my custom css resource files that are placed BEFORE
the Bootstrap ones, on the contrary, in page A everything is fine
because my custom css files are placed AFTER Bootstrap, so my page
styling is correct as I expect.

Is there a way to control that behaviour? Or, what could I do to make my
css resources render AFTER the Bootstrap ones?

See on [1] how I load Bootstrap from Java code.
The wrapper main page code is on [2] and [3] and the code of the child
page that is loaded and has the issue is on [4] and [5].


[1]
https://github.com/apache/syncope/blob/master/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeWebApplication.java#L240-L244
[2]
https://github.com/apache/syncope/blob/master/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/BaseEnduserWebPage.html#L66
[3]
https://github.com/apache/syncope/blob/master/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/pages/BaseEnduserWebPage.java
[4]
https://github.com/apache/syncope/blob/master/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable.html
[5]
https://github.com/apache/syncope/blob/master/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/pages/Flowable.java

Thank you!
Regards,
Matteo


Re: ModalWindow cannot trigger setWindowClosedCallback or setCloseButtonCallback problem

2019-03-06 Thread Bas Gooren
Hi,

Since you are not storing pages, how does the form in your modal
window work? I assume you are using a stateless form?

Since your on close callback is stateful, it will not work; you will
either need to use a stateless Ajax behavior or stateless form where
in onsubmit you redirect to a new page with up-to-date information.

// Bas

Verstuurd vanaf mijn iPhone

> Op 7 mrt. 2019 om 07:56 heeft kyc  het volgende geschreven:
>
> Our page open a WindowModal for editing a form, there is an exception throw
> when closed the modal window.
> This problem only happens when our site is using NoPageStore but we have to
> use NoPageStore.
>
> The following exception happen and the setWindowClosedCallback cannot be
> called.
> Page with id '16' has expired.
> org.apache.wicket.protocol.http.PageExpiredException: Page with id '16' has
> expired.
>
>
> The modal window close call back function works on without NoPageStore
> setting:
>
>abcModalWindow.setWindowClosedCallback(new WindowClosedCallback() {
>private static final long serialVersionUID = 
> 7961678233294274184L;
>
>public void onClose(AjaxRequestTarget target) {
>doRefresh(target);
>}
>});
>
> Please help if anyone knows the solution.  Thanks a lot.
>
>
> --
> Sent from: 
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practice for custom page renderer

2019-02-28 Thread Bas Gooren
Hi!


We have many stateless pages in our apps (public-facing, indexed,
e-commerce websites), and use the default render strategy provided by
wicket.

When a page is stateless, wicket does not redirect.


Are you sure your pages are stateless?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 28 februari 2019 bij 10:48:25, Alberto Brosich (abros...@inogs.it)
schreef:


Hello,

I didn't find any useful information about that in the documentation.

For some reasons (e.g. search engine bots or clients unable to follow
redirects) on some pages I would like to have an http 200 response. By
default Wicket uses REDIRECT_TO_BUFFER render strategy that send a 302
redirect first.

Which is the best practice for use ONE_PASS_RENDER strategy?

Is it reasonable to adopt ONE_PASS_RENDER for all stateless pages or is
it better to change the render strategy only for specific pages?

Is setPageRendererProvider() the good place where to handle that?

For example:

setPageRendererProvider( new IPageRendererProvider() {

@Override
public PageRenderer apply(RenderPageRequestHandler handler) {
br/> return new WebPageRenderer(handler) {{
br/> @@Override
protected boolean isOnePassRender() {
br/> IRequestablePage page =
getRenderPageRequestHandler().getPage();

return page.isPageStateless() ||
page instanceof BrowserInfoPage || super.isOnePassRender();
}
};
}
});

I' working with wicket version 8.3.0.

Best regards

Alberto


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Model map with enum as a key

2019-02-04 Thread Bas Gooren
Hi!

In your first code example you are binding the property model to your
config map, using a string key for lookup (“VALUE1”).
Since generics in java is mostly syntactic sugar, I think the PropertyModel
reads & writes from your config map using a String key.
This is why hibernate complains: the map contains a String key instead of
an Enum.

We use a specialized MapKeyModel in our apps for this:

---

import java.util.Map;

import org.apache.wicket.model.IModel;

public class MapKeyModel implements IModel
{
private final IModel> mapModel;
private final K key;

public static  MapKeyModel of( IModel> mapModel,
K key )
{
return new MapKeyModel( mapModel, key );
}

public MapKeyModel( IModel> mapModel, K key )
{
this.mapModel = mapModel;
this.key = key;
}

@Override
public V getObject()
{
Map map = mapModel.getObject();

return map.get( key );
}

@Override
public void setObject( V object )
{
Map map = mapModel.getObject();

map.put( key, object );
}

@Override
public void detach()
{
mapModel.detach();
}

}

---

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 4 februari 2019 bij 13:51:28, Zbynek Vavros (zbynekvav...@gmail.com)
schreef:

I got this class that has map with enums as keys:

public class MasterClass {

private Map config = Maps.newHashMap();
}

enum is classic:

public enum MyEnum {
VALUE1,
VALUE2
}

now I would like to use one entry of this map as a model for TextField:

new RequiredTextField<>("componentId", new
PropertyModel<>(modelObject.getConfig(), "VALUE1")))

but when saved to DB Hibernate says the key is String and Enum is expected:
java.lang.ClassCastException: java.lang.String cannot be cast to
java.lang.Enum

Using ChainingModel or
Model.of(modelObject.getConfig().get(MyEnum.VALUE1))) causes the value not
to be bind at all.

I know I can use "side" property and fill this map manually in onSubmit
just before saving to DB but would like to avoid that.

Thanks


Re: web session not available to current thread

2018-12-10 Thread Bas Gooren
Hi!

You need to configure the XForwardedRequestWrapperFactory, see

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapperFactory.java

You can call (in your application’s init() method):

getFilterFactoryManager().add( new XForwardedRequestWrapperFactory() );

You might need to configure it, depending on your reverse proxy and it’s IP
address; When the proxy’s IP matches the “allowedInternalProxies” regex,
the real remote address will be available to wicket.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 december 2018 bij 09:39:12, Arunachalam Sibisakkaravarthi (
arunacha...@mcruncher.com) schreef:

But, It didn't give remote address when run the app in Tomcat, but in Jetty
It gives correct remote address

RequestCycle requestCycle = RequestCycle.get();
ServletRequest containerRequest = (ServletRequest)
requestCycle.getRequest().getContainerRequest();
return containerRequest.getRemoteAddr();

Can you all help me why I can't get the remoteAddr when run the app in
Tomcat?



*Thanks And RegardsSibi.ArunachalammCruncher*


On Fri, Dec 7, 2018 at 11:30 AM Arunachalam Sibisakkaravarthi <
arunacha...@mcruncher.com> wrote:

> It woks. Thank you.
>
>
> *Thanks And RegardsSibi.ArunachalammCruncher*
>
>
> On Thu, Dec 6, 2018 at 3:18 PM Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
>> Hi,
>>
>> See
>>
>> http://wicketinaction.com/2014/07/working-with-background-jobs/
>> https://github.com/reiern70/antilia-bits/tree/master/bgprocess
>>
>>
>>
>> On Thu, Dec 6, 2018 at 7:35 AM Arunachalam Sibisakkaravarthi <
>> arunacha...@mcruncher.com> wrote:
>>
>> > Hi guys,
>> > I am facing problem when try to get current session in separate
thread.
>> > Have a button in a page to import contacts.
>> > When user clicks the button, it invoke Spring Async method in service
>> > class.
>> > The method saves the contacts.
>> > Inside the method I have used Sessiong.get() to get username.
>> >
>> > But it throws following exception
>> >
>> > org.apache.wicket.WicketRuntimeException: There is no application
>> attached
>> > to current thread commonTaskExecutor-2
>> > at org.apache.wicket.Application.get(Application.java:235)
>> > at org.apache.wicket.Session.get(Session.java:175)
>> >
>> >
>> >
>> >
>> > *Thanks And RegardsSibi.ArunachalammCruncher*
>> >
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>>
>


Re: LambdaModel use

2018-11-14 Thread Bas Gooren
Hi!


Well, that’s a different use-case :-)


We have written a specialized ConversionModel for the exact same reason:
convert an underlying model to a target type.

And of course a specialization of that called LambdaConversionModel, which
also allows conversion of null values.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 11 november 2018 bij 00:42:38, Илья Нарыжный (phan...@ydn.ru) schreef:

Thank you, Bas!
Fully agree with you that if setters is to set something on a main target
object. In my particular case, I tried to use LambdaModel for "conversion"
between one type and another. So targetModel contain original object and
LambdaModel just wrap and convert correspondingly. Also I tried to use
exactly that method, because if targetModel is provided to LambdaModel - it
manages lifecycle and invoke onDetach when it's applicable. Use of `public
static  IModel of(SerializableSupplier getter,
SerializableConsumer setter)` is not so convenient in this case, because
target model is out of required lifecycle.

Thanks,
Ilia

-
Orienteer(http://orienteer.org) - open source Business Application Platform

On Thu, Nov 8, 2018 at 11:41 PM Bas Gooren  wrote:

> Hi,
>
> The LambdaModel method you are referring to is dependant on another model:
>
> public static  IModel of(IModel target,
> SerializableFunction getter, SerializableBiConsumer setter)
>
> Since the setter depends on the target model, the target model object
> needs to be non-null for the setter to be able to do anything (you can’t
> set a property on a null object reference).
>
> If I look at the current master branch [1], I see that the functionality
> you probably are looking for is present:
>
> public static  IModel of(SerializableSupplier getter,
> SerializableConsumer setter)
>
> … which is simply a model which delegates getting and setting the value to
> the specified supplier and consumer, without having a target model.
>
> 1)
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 9 november 2018 bij 08:30:39, Илья Нарыжный (phan...@ydn.ru) schreef:
>
> Hello,
>
> How it was expected to use LambdaModel with setters?
> Right now it seems to be not quite usable, because, of the following code
> inside:
>
> @Override
> public void setObject(R r)
> {
> X x = target.getObject();
> if (x != null)
> {
> setter.accept(x, r);
> }
> }
>
> As you can see, if previous value of target model is null, there is no way
> to change it. Why?
> And also it will be interesting to know why SerializableBiConsumer was used
> for a setter?
>
> Thanks,
> Ilia
>
> -
> Orienteer(http://orienteer.org) - open source Business Application
> Platform
>
>


Re: AjaxSelfUpdatingBehaviour detaches my DataTable

2018-11-14 Thread Bas Gooren
Hi Sandor,

Can you explain more clearly (step by step, request by request) what is
happening and what you expect to happen?

Most dataproviders (e.g. ones backed by a database model) reload their
underlying data on every request, so reloading should be easy (simply add
the datatable to the ajax request or reload the entire page).
What kind of data provider are you using?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 12 november 2018 bij 14:19:09, Sandor Feher (sfe...@bluesystem.hu)
schreef:

Hi,

I feel a little bit dump but I can't fix it.

At the moment it looks like if I want my DataTable get reloaded then I must
call explicitly a public method in my DataProvider.

So far I simply called detachModel() on my DataTable and in detach method I
reloaded list using my DAO.
Because of AwareAjaxSelfUpdatingBehaviour (which is in my HeaderPanel which
is included by BasePage and every page classes extend the BasePage) all
pages get detached in every second.

TIA, Sandor

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: LambdaModel use

2018-11-08 Thread Bas Gooren
Hi,

The LambdaModel method you are referring to is dependant on another model:

public static  IModel of(IModel target, SerializableFunction getter, SerializableBiConsumer setter)

Since the setter depends on the target model, the target model object needs
to be non-null for the setter to be able to do anything (you can’t set a
property on a null object reference).

If I look at the current master branch [1], I see that the functionality
you probably are looking for is present:

public static  IModel of(SerializableSupplier getter,
SerializableConsumer setter)

… which is simply a model which delegates getting and setting the value to
the specified supplier and consumer, without having a target model.

1)
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 9 november 2018 bij 08:30:39, Илья Нарыжный (phan...@ydn.ru) schreef:

Hello,

How it was expected to use LambdaModel with setters?
Right now it seems to be not quite usable, because, of the following code
inside:

@Override
public void setObject(R r)
{
X x = target.getObject();
if (x != null)
{
setter.accept(x, r);
}
}

As you can see, if previous value of target model is null, there is no way
to change it. Why?
And also it will be interesting to know why SerializableBiConsumer was used
for a setter?

Thanks,
Ilia

-
Orienteer(http://orienteer.org) - open source Business Application Platform


Re: Rendering a page for storage

2018-09-16 Thread Bas Gooren
Hi René,

If I recall correctly, the component renderer uses a mock request and
response to render components. Does your page (or any injected
services) require the request to be a servlet request?

// Bas

Verstuurd vanaf mijn iPhone

> Op 16 sep. 2018 om 21:48 heeft René Stolle  het volgende 
> geschreven:
>
> Hello,
>
> most of my projects have a AppStatus Page containing some statistics.
>
> No I need to store this information on web server shut down and I was
> wondering, if I could just persist a freshly rendered page and have
> everything I need nicley formatted in a html file. The javadoc looked
> promising but the following code in my app class
>
> @Override
> protected void onDestroy() {
> ComponentRenderer cr = new ComponentRenderer(this);
> logStatus (cr.renderPage(AppStatus::new));
> }
>
> gave me only a java.lang.IllegalArgumentException: Request must be
> ServletWebRequest
>
> What did I miss? Am I on the right path?
>
> René
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-10 Thread Bas Gooren
Hi!


Sounds like wicket is redirecting to the login page due to the user not
being authenticated.


To handle cross-framework authorization, I suggest you either share the
http session, use a shared security framework (e.g. apache shiro) or (what
we do every now and then) have a shared list of one-time-tokens so you can
forward to wicket with that token and wicket can fetch the user based on
the token.


In any case, can you debug the code? If you set some breakpoint I think
you’ll figure out quickly where the problem lies :-)


Good luck.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 september 2018 bij 20:01:31, extraquoo (extraq...@gmail.com) schreef:

the purpose is the clients want to reuse an existing wicket html page for
some enhancement in a spring mvc flow of business. br/>I am ttrying three
ways "redirect:../[url]" , "redirect:[url]" and "/[url]"
.The first two just kicks me out and return to the application home page
which is coded by wicket. The last one is throwing stack trace of apache
tiles which is used by spring mvc/spring web flow.

you are right, the wicket owns authentication functionality when a user
logins the application. Maybe this is the root cause of kick out. Not sure
if it could pass the entire session of authentication by some additional
code or config file ?

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-08 Thread Bas Gooren
Hi!


I’m not sure why wicket is wrapping a spring exception. Sounds like wicket
is not handling the request, but passing it on to spring.


I don’t use spring on a daily basis, but from what I read you should be
using a “redirect:[url]”-style model and view.

Which login page is shown? Your wicket one or the spring one?


Of the two pages/urls in question (your spring endpoint running the code
you’ve shown and the wicket page), which ones require authentication?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 7 september 2018 bij 20:24:35, extraquoo (extraq...@gmail.com) schreef:

Thanks for your answer.

The panel class has its HTML file and it is mounting in the startup
initialization br/> <
mountBookmarkablePage("/CaseVerificationUpload.html",CaseVerificationUploadsPage.class);


when I am using
return new ModelAndView("redirect:../CaseVerificationUpload.html")
then the application kicks me out to the login page

then I change to br/>return new
ModelAndView(""/CaseVerificationUpload.html")
I get stack trace saying br/>org.apache.wicket.WicketRuntimeEException:
javax.servlet.ServletException: No
Tiles definition found for name 'CaseVerificationUpload.html'

am I missing some configuration ? Can you tell me what is the correct value
to put in the ModelAndView? br/> <
-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: spring controller redirect ModelAndView to a wicket panel class

2018-09-07 Thread Bas Gooren
Hi!

Wicket and Spring have different render cycles, so if you want to redirect
from spring to a wicket panel, you’ll need to put the wicket panel in a
page and expose that page on a public url by mounting it.

That wicket page can then take url parameters (either path or query
params), which you can extract and use to construct your panel in any way
you need.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 7 september 2018 bij 06:20:54, extraquoo (extraq...@gmail.com) schreef:

Hi
my project is implemented by two frameworks: spring web flow and wicket.
Now in one of the spring controller, I want to the spring ModelAndView
redirects to an existing wicket panel class.

the code of spring controller is below :
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
..
if (StringHelper.isValid(startAppEvent)) {
return new
ModelAndView("redirect:../services/continueApplication?_eventId=startApp&_flowExecutionKey="+

flowExecutionKey);
}else if (StringHelper.isValid(cboVerifEvent)){
return new ModelAndView("");// want to redirect to wicket panel
}

I also have an existing panel class: ImageUploadsPanel

then how can ModelAndView redirect and pass parameters to call the panel
class?

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: renderFullUrl for apache internal redirected page

2018-08-04 Thread Bas Gooren
Hi!


This is because without additional configuration, your tomcat does not
“know”/see that the original request came in by https.


Wicket has support for automatically picking this up, see
https://ci.apache.org/projects/wicket/apidocs/org/apache/wicket/protocol/http/servlet/XForwardedRequestWrapperFactory.html

(property “protocolHeader).

You can install it with the following code in your Application’s init
method:


getFilterFactoryManager().add( new XForwardedRequestWrapperFactory() );


We have set the property “protocolHeader” to “X-Forwarded-Proto”, and set
this header in our apache vhost configuration:


Header set X-Forwarded-Proto “https”

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 4 augustus 2018 bij 12:44:59, smallufo (small...@gmail.com) schreef:

My server is apache frontend , redirecting all port 80 to 443
and with '/app' prefix , proxyPass to internal tomcat , listening to port
8080

I use the following line to get full url
val absUrl =

requestCycle.urlRenderer.renderFullUrl(Url.parse(urlFor(MyPage::class.java,
pps).toString()))


The browser url shows https
but the absUrl is http

I trace the code , down to
UrlRenderer.resolveProtocol() and choose()

find my
request.getClientUrl().getPort() = 80

so it chooses http , not https

Any way to fix this ?

wicket-8.0.0


Re: ListenerRequestHandler / urls from the past... - component not found

2018-06-30 Thread Bas Gooren
Hi!

Well that’s something you can fix by embedding a canonical url in your
page. It tells search engines to ignore all other urls for that page,
including the ones with wicket info in them.

// Bas

Verstuurd vanaf mijn iPhone

> Op 30 jun. 2018 om 19:41 heeft Korbinian Bachl 
>  het volgende geschreven:
>
> Hi Sven,
>
> well, the problem here are our clever webbots - especially bing and even 
> worse google :)
>
> See, bingbot or googlebot index now e.g.:
> (derived from wicket examples)
>
> www.domain.com/choice
>
> and a load of bullshit like
>
> choice?2-1.IBehaviorListener.0-form-makes
> choice?2-1.IBehaviorListener.0-form-go
> [add here sometimes 100's of further ajax links]
>
> that now lead to having indexed many many pages that nearly cant be taimed; 
> Even using robots.txt or their webmastertools makes this a nightmare as the 
> potential namings you can manually fix are in the hundreds or thousands;
>
> If all wicket things would be behind an parameter e.g:
> ?wicketHandling=2-1.IBehaviorListener.0-form-makes
> ?wicketHandling=2-1.IBehaviorListener.0-form-go
>
> you could just concentrate on that parameter and save literally many many 
> hours of work and seo complaints :)
>
> IMHO this was standard up to wicket 1.4 in a way that all those page and 
> component info was put to a certain wicket interface root path e.g:
> ?wicket:interface=:0 and that allowed much easier taming of these 
> problems than its currently for me;
>
> Best,
>
> KB
>
>
>
>
> - Ursprüngliche Mail -
>> Von: "Sven Meier" 
>> An: users@wicket.apache.org
>> Gesendet: Samstag, 30. Juni 2018 13:37:06
>> Betreff: Re: ListenerRequestHandler / urls from the past... - component not 
>> found
>
>> Hi,
>>
>>> http://examples7x.wicket.apache.org/forminput/?0-1.IFormSubmitListener-inputForm
>>
>> "0-1.IFormSubmitListener-inputForm" *is* a parameter, it just doesn't
>> have a value.
>>
>> How would renaming that parameter improve anything?
>>
>> Have fun
>> Sven
>>
>>
>>> Am 30.06.2018 um 12:06 schrieb Korbinian Bachl:
>>> Thanks for the answer - that gives me the right direction. Say, do you know 
>>> if
>>> it would be possible to have the wicket component part not in the url like
>>> currently but using a named parameter? e.g.:
>>>
>>> http://examples7x.wicket.apache.org/forminput/?0-1.IFormSubmitListener-inputForm
>>>
>>> should instead be
>>>
>>> http://examples7x.wicket.apache.org/forminput/?wicketHandling=0-1.IFormSubmitListener-inputForm
>>>
>>> where wicketHandling would be the global named paramter where the wicket 
>>> puts
>>> all its infos into that parameter and not just add it to the url?
>>>
>>> Best,
>>>
>>> KB
>>>
>>>
>>>
>>> - Ursprüngliche Mail -
>>>> Von: "Bas Gooren" 
>>>> An: users@wicket.apache.org, "Korbinian Bachl" 
>>>> 
>>>> Gesendet: Freitag, 29. Juni 2018 12:06:39
>>>> Betreff: Re: ListenerRequestHandler / urls from the past... - component not
>>>> found
>>>> Hi!
>>>>
>>>> I think there are many ways to fix this, ranging from easy to complex.
>>>>
>>>> The easiest one: either catch it in a IRequestCycleListener (in
>>>> onException), and “fix” the request handler by stripping the
>>>> pageAndComponent info from it
>>>> Next option: override wicket’s exception mapper (see
>>>> DefaultExceptionMapper), and catch/fix it there.
>>>>
>>>> Since this is a common issue for you, I’d got with a request cycle listener
>>>> since it’s quite easy to plug in:
>>>> - catch ComponentNotFoundException
>>>> - check if the request handler is a ListenerInterfaceRequestHandler
>>>> - return a BookmarkablePageRequestHandler or a RenderPageRequestHandler,
>>>> depending on the type of page that was being rendered (stateless,
>>>> bookmarkable)
>>>>
>>>> Good luck.
>>>>
>>>> Met vriendelijke groet,
>>>> Kind regards,
>>>>
>>>> Bas Gooren
>>>>
>>>> Op 29 juni 2018 bij 11:50:27, Korbinian Bachl (
>>>> korbinian.ba...@whiskyworld.de) schreef:
>>>>
>>>> Hi,
>>>>
>>>> I've got some problems with 404/ 500 error codes in my wicket app that
>>>> happen to come from the past... Now, wh

Re: ListenerRequestHandler / urls from the past... - component not found

2018-06-29 Thread Bas Gooren
Hi!

I think there are many ways to fix this, ranging from easy to complex.

The easiest one: either catch it in a IRequestCycleListener (in
onException), and “fix” the request handler by stripping the
pageAndComponent info from it
Next option: override wicket’s exception mapper (see
DefaultExceptionMapper), and catch/fix it there.

Since this is a common issue for you, I’d got with a request cycle listener
since it’s quite easy to plug in:
- catch ComponentNotFoundException
- check if the request handler is a ListenerInterfaceRequestHandler
- return a BookmarkablePageRequestHandler or a RenderPageRequestHandler,
depending on the type of page that was being rendered (stateless,
bookmarkable)

Good luck.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 29 juni 2018 bij 11:50:27, Korbinian Bachl (
korbinian.ba...@whiskyworld.de) schreef:

Hi,

I've got some problems with 404/ 500 error codes in my wicket app that
happen to come from the past... Now, when wicket makes any url for a
component this one gets added to the path, e.g.:
http://examples7x.wicket.apache.org/forminput/?0-1.IFormSubmitListener-inputForm

So when time goes by and the component name changes to e.g.: inputForm3 and
one then calls the above URL wicket annoys with an 500 error...
(attention: it is also related to the fact if there is an active session or
there is not! - happy debugging !)

reason:

org.apache.wicket.core.request.handler.ComponentNotFoundException:
Component 'brix-tile-24:form' has been removed from page.
at
org.apache.wicket.core.request.handler.ListenerRequestHandler.respond(ListenerRequestHandler.java:166)

at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:912)


(error from my app - u get a bit different one from the wicket examples app
if you manually change the component info part - sometimes just an 404,
sometimes 500)


So, how can this be fixed that instead of giving us this 500er error in
live systems that wicket should just ignore the problem? I mean failing in
dev is OK but in deploy? So basically wicket shall treat it as

http://examples7x.wicket.apache.org/forminput/

request;


IMHO the problem here is in ListenerRequestHandler at 164:

if ((component == null && !freshPage) || (component != null &&
component.getPage() != page))
{
throw new ComponentNotFoundException("Component '" + getComponentPath()
+ "' has been removed from page.");
}

so we know there is no component and then wicket goes berserk and throws
it... Problem arises with many URLs indexed anywhere on the web and
pointing to ones page as well as bookmarked pages from users - they have
the old component info in the paths and there is no way to remove that!


Best
KB

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: DropDownChoice and null value

2018-06-25 Thread Bas Gooren
Hi!

See AbstractSingleSelectChoice#setNullValid(boolean)

Of course, it is still shown when the user has not selected a value before
(so null model value at render time). But once a value has been selected
before (so non-null value at render time), the “Choose one” option is not
shown anymore.

To override the “Choose one” text on the initial render, have a look at
AbstractSingleSelectChoice#getDefaultChoice(String), as it documents which
translation keys are used for these cases.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 25 juni 2018 bij 14:26:46, JavaTraveler (meteor.ei...@gmail.com) schreef:

Hello everyone, I wish to get rid of the "choose one" option. Wich is
equivalent to null, if i'm not mistaken.

ddlSociete = new DropDownChoice("societe", new
PropertyModel(pointageMasseSearchDto, "societe"), new
LoadableDetachableModel>() {
@Override
protected List load() {
return societes;
}

}, new ChoiceRenderer("numeroLibelle", "numero"));

I was thinking about imposing a default value to replace the null one with
one from my List.
I tried everything i could find but nothing worked. It can't be that
complicated, can it ?

THanks in advance for your answers.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: wicket 8 / RootRequestMapper vs CompoundRequestMapper

2018-06-11 Thread Bas Gooren
Hi!

The Compound mapper is merely a wrapper which can have many child mappers.
The Root mapper is the mapper that wicket calls to do mapping and reverse
mapping. For wicket itself it’s not important whether it is a mapper or
compound mapper.

The higher up in the mapper hierarchy (root -> compound -> compound ->
mapper etc), the earlier it is called.
Note that this is not that important, since the compound mapper works with
scores, but nevertheless if you want to do something like prefixing or
postfixing urls, order does matter.

This is also why, for example, the https mapper should be installed after
all other mappers, and as the root mapper.

If you just want to map some pages, just add the mapper and don’t worry
about where in the hierarchy it is. As long as it returns a score higher
than any other, it will be used.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 11 juni 2018 bij 11:38:31, Korbinian Bachl (
korbinian.ba...@whiskyworld.de) schreef:

Hi,

situation: I need to add some "special" URL handling for certain URLs to
have product pages and catalog pages on root. As we also use brix we
already have at least one compoundRequestMapper already in use.
Now, wicket seems to have 2 places for that. A new RootRequestMapper e.g.:

YourApplication#init():
old = application.getRootRequestMapper()
application.setRootRequestMapper(new CustomRequestMapper(old))

or a CompoundRequestMapper e.g.:

application.getRootRequestMapperAsCompound().add(new
CustomRequestMapper(old));

But what are the pros or cons of using either RootRequestMapper vs
CompoundRequestMapper?

>From my point of view the only difference is that CompoundRequestMapper
gets exectued based on score, where max score gets used first and lower
scores later as long as the

public IRequestHandler mapRequest(Request request)

doesnt return null anymore; Did I miss something?


Best,

KB

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: How to use language/locale from url without creating a session?

2018-05-31 Thread Bas Gooren
Thank you, Martin! That’s an interesting way to fix this.


Didn’t think of that, and it fits quite well with our current code, too. We
can put our own “requestedLocale” field in our WebSession subclass, and use
that if the session is temporary.


Thanks!

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 26 mei 2018 bij 13:41:25, Martin Grigorov (mgrigo...@apache.org) schreef:

Hi,

Here is another solution:
- put the locale in RequestCycle's metadata
- override Session#getLocale() and if Session#isTemporary() then use the
metadata, otherwise use the session's locale

On Fri, May 25, 2018 at 7:20 PM, Bas Gooren  wrote:

> Hi!
>
> We build mainly e-commerce websites on wicket, which means most pages are
> publicly visible and indexable.
> Since our websites are multi-language we have a custom
> CompoundRequestMapper which checks if the url contains a valid locale,
and
> updates the session locale accordingly.
>
> This works great! With one small issue we would ideally like to fix:
wicket
> binds the session once you call setLocale on it. As a result, every
> (stateless) public url that is requested leads to a session being
created,
> and a cookie being sent to the requester.
>
> Since every component (effectively) depends on Session.get().getLocale()
to
> get the current locale, we see no other way to handle this cleanly.
>
> Writing this now and having another look at the wicket source code, I
> reckon we could wrap the wicket request and override its getLocale()
> method. I probably hesitated to do so before because wicket expects a
> ServletWebRequest in some places, so the wrapper cannot simply extend the
> base Request class.
> Anyone here that has a good solution for this? Otherwise we have to check
> for implementations and decide on the wrapper based on that, but that’s
> rather ugly code.
>
> Also, I realize that we don’t just want to wrap the request for request
> mapping purposes (in our compound mapper). We need to wrap the request
> earlier, since we need to ensure the actual request passed in to the
> session constructor returns a locale that matches with the url.
>
> Would appreciate any thoughts you have on this.
>
> Thanks!
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>


How to use language/locale from url without creating a session?

2018-05-25 Thread Bas Gooren
Hi!

We build mainly e-commerce websites on wicket, which means most pages are
publicly visible and indexable.
Since our websites are multi-language we have a custom
CompoundRequestMapper which checks if the url contains a valid locale, and
updates the session locale accordingly.

This works great! With one small issue we would ideally like to fix: wicket
binds the session once you call setLocale on it. As a result, every
(stateless) public url that is requested leads to a session being created,
and a cookie being sent to the requester.

Since every component (effectively) depends on Session.get().getLocale() to
get the current locale, we see no other way to handle this cleanly.

Writing this now and having another look at the wicket source code, I
reckon we could wrap the wicket request and override its getLocale()
method. I probably hesitated to do so before because wicket expects a
ServletWebRequest in some places, so the wrapper cannot simply extend the
base Request class.
Anyone here that has a good solution for this? Otherwise we have to check
for implementations and decide on the wrapper based on that, but that’s
rather ugly code.

Also, I realize that we don’t just want to wrap the request for request
mapping purposes (in our compound mapper). We need to wrap the request
earlier, since we need to ensure the actual request passed in to the
session constructor returns a locale that matches with the url.

Would appreciate any thoughts you have on this.

Thanks!

Met vriendelijke groet,
Kind regards,

Bas Gooren


Re: SPA, session replacement and pagestore

2018-05-19 Thread Bas Gooren
Hi Ravi!

We fixed this in all of our apps with a custom servlet response wrapper
(our NonEncodingHttpServletResponse), which prevents the application from
ever putting a session id into the url.

It’s a simple extension of HttpServletResponseWrapper which simply returns
the provided url in all four encode* methods.

We install it by overriding newWebResponse in our wicket application:

@Override
protected WebResponse newWebResponse( final WebRequest webRequest,
HttpServletResponse servletResponse )
{
// Make sure we never get JSESSIONID in the url
return super.newWebResponse( webRequest, new
NonEncodingHttpServletResponse( servletResponse ) );
}

Please note that this means clients which don’t accept cookies will not be
able to work with a session, but that has never been an issue for us. In
our case we never want a session id in urls, as our app has a lot of pages
indexed by google.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 18 mei 2018 bij 12:21:24, Ravi (ravi.k...@intellinet.de) schreef:

Hi all,

we have a single page application (SPA). On the first entree we of course
get a Session url that will never disappear due to the nature of an SPA.
So what we do is a session replacement on the first button click to battle
Session Hijacking when posting the link in some forum.
For a single tab that works just fine.

If you have two tabs open and tab A fires a sessionreplacement, it clears
the pagestore, causing to loose the page that is displayed on tag B.
Interacxtion with tab B then leads to a session expired page.

Is there any best practice or has someone of you guys tackled something
like
this before?
Or can I "remap" the old pagestore to the new session?

Thanks for any input,

Ravi

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: manual resolving of path

2018-04-11 Thread Bas Gooren
Hi,

This is actually relatively simple!

Steps:

   - Create a mapper for this which extends AbstractMapper
   - Return a compatibility score which is higher than other mappers if you
   want to override them (e.g. return Integer.MAX_VALUE)
   - Implement mapRequest() to resolve the url to a RenderPageRequestHandler
   - Implement mapHandler() to resolve a handler for your target page class
   to a url (e.g. check for IPageClassRequestHandler and use provided page
   parameters to build url)
   - Mount your custom mapper in your application’s init() method

Done!

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 11 april 2018 bij 09:47:16, Korbinian Bachl (
korbinian.ba...@whiskyworld.de) schreef:

Hi,

where would I need to look at if I wanted to resolve the path from the root
of the webapplication inside a wicket application root?


e.g.: domain.com <- has wicket app on ROOT deployed
domain.com/foo <- path mapped to foo-webpage
domain.com/foo/bar <- I now want to get the request not resolved by
foo-webpage but by my own custom resolver-webpage but I cant map this as
usual as the mapping comes from a DB and can change anytime
domain.com/bar2 <- I also want to hijack this one temporary even we have a
page mounted to /bar2

Any idea how I might "hijack" the request and resolve it to another page?

Best,

KB

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Wicket in a wildfly cluster

2018-03-02 Thread Bas Gooren
Hi Ravi,

Sorry - I have no experience with "real-time" session replication.

Personally I would never attempt it, as wicket sessions can grow relatively
large and thus replication may not be instantaneous (as you are
experiencing)…

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 2 maart 2018 bij 14:40:50, Ravi (ravi.k...@intellinet.de) schreef:

Hi Bas,

we have an apache that balances by using a round robin (byrequest).
The application runs in an infrastructure that does not support
sticky-sessions.

So far from what we've seen both servers getting pinged withing
milliseconds. One server responds correctly. The other one throws a
ComponentNotFoundException.

But it is not deterministic, meaning it does work at times.


Ravi

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Wicket in a wildfly cluster

2018-03-02 Thread Bas Gooren
Hi Ravi,

You don’t mention what’s in front of your application servers.

Are you doing non-sticky load balancing?

Or are you having issues when the user hits the same application server?
(Which would be a different issue)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 2 maart 2018 bij 13:43:49, Ravi (ravi.k...@intellinet.de) schreef:

Hi all,

we have the following scenario;

Our single-page application is a 100% used for application forms and makes
heavy use of ajax calls (validation, visibility, etc).
There might even be an ajax call for every blur on an input field.

We're trying to put this application in a wildfly cluster that replicates
the session & pagestore through infinispan.

It seemes that the pagestore is not replicated fast enough(?), so that we
get a ComponentNotFoundException.

After playing around with the wicket/infinispan configuration our setup
looks like this:

Wicket:
- HttpSessionDataStore
- getStoreSettings().setAsynchronous(false);
- getStoreSettings().setInmemoryCacheSize(0);
-
getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);


JBoss:
- cluster mode (ha profile)

Infinispan
- Distributed cache with default config

Although this configuration seems to work now and then, it still breaks
quite often and is very fragile.
Since no one here has a lot experience with clustering, maybe someone here
has any theoretical/practical experience and is willing to share :)

Needles to say that we googled the web and forum ;)

Thank you,

Ravi


-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Session discontinue

2018-03-01 Thread Bas Gooren
Hi!

It sounds like your session is not getting bound. Have you tried
explicitly calling bind()?

Ps it’s good practice to call replaceSession() on login to prevent
session fixation, so have a look at that, too.

// Bas

Verstuurd vanaf mijn iPhone

> Op 1 mrt. 2018 om 10:44 heeft "shengchehs...@gmail.com" 
>  het volgende geschreven:
>
> Dear all
>
> I built a application with parent BasePage, and child page extends it except 
> LoginPage.
> When I try to login, I saw the user data persist in session, but when 
> redirect to another page (extends BasePage) , the session data disappeared
> , how do i concur this?
>
> Thanks
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: strange error

2018-02-27 Thread Bas Gooren
Hi!

The last line of the stack trace indicates that a NullPointerException is
occurring; My guess is that this happens inside your code, probably in the
constructor of assets.endpoints.OIDCConsensusPage

You’ll have to get your hands on the full stack trace (when not in the
logs, simply set a debug breakpoint in your constructor, and step through
the code) to find out exactly where the NPE is thrown.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 27 februari 2018 bij 13:25:56, Shengche Hsiao (shengchehs...@gmail.com)
schreef:

Hi there,

I wrote a wicket-based application , users write some info on page A and
submit to page B. but it ran into error, logs list below

[Server:auth-003] 20:11:13,722 ERROR
[org.apache.wicket.DefaultExceptionMapper] (default task-44) Unexpected
error occurred: org.apache.wicket.WicketRuntimeException: Can't instantiate
page using constructor 'public
assets.endpoints.OIDCConsensusPage(org.apache.wicket.request.mapper.parameter.PageParameters)'

and argument 'Auth_Request_Migration=[true], Auth_Request_RedirectUri=[
https://oidc.tanet.edu.tw/serviceclient/client-service-back],
Auth_Request_State=[cGYIeirvLRTq25elwY0lrEtmr8ZVX9Yov2ku_IeC2Sk],
Auth_Request_Response_Type=[code],
Auth_Request_Client_ID=[ba3a199485df7b35c351fa6b73032863],
Auth_Request_Nonce=[gr4jpMbbFl9OLQU9v5Pvwtn1SbTq4X9ycGTlIZyhe1k],
Auth_Request_Scope=[openid email profile openid2 eduinfo personid guid]'.
An exception has been thrown during construction!

[Server:auth-003] at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:194)


[Server:auth-003] at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:99)


[Server:auth-003] at
org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:106)


[Server:auth-003] at
org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:271)


[Server:auth-003] at
org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:169)


[Server:auth-003] at
org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)


[Server:auth-003] at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:102)


[Server:auth-003] at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:195)


[Server:auth-003] at
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)


[Server:auth-003] at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)


[Server:auth-003] at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)


[Server:auth-003] at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)

[Server:auth-003] at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)


[Server:auth-003] at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)


[Server:auth-003] at
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)


[Server:auth-003] at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)


[Server:auth-003] at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)


[Server:auth-003] at
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)

[Server:auth-003] at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)


[Server:auth-003] at
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)


[Server:auth-003] at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)


[Server:auth-003] at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)


[Server:auth-003] at
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)


[Server:auth-003] at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)


[Server:auth-003] at
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)


[Server:auth-003] at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)


[Server:auth-003] at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)


[Server:auth-003] at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)


[Server:auth-003] at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)


[Server:auth-003

Re: Preventing directory list

2018-02-14 Thread Bas Gooren
Hi!


Since this is not something wicket core provides, I did a google search for
you (“wicket directory listing”).


This was the first hit:
http://apache-wicket.1842946.n4.nabble.com/Directory-Listings-td4661117.html


It looks like this is the culprit:


—

I believe I found the problem.


It appears Wicket does not really pass non-Wicket requests back to a

default handler, but handles them by itself in fallback() by using

getResourceAsStream() and in this case, for directories, WebSphere

returns a listing regardless of its own directoryBrowsingEnabled

setting.

—


Alas, that thread does not provide a fix. Although I do interpret the
thread as if this is only a problem with using a wicket servlet, instead of
a wicket filter. Are you using the servlet or filter?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13 februari 2018 bij 20:13:25, Entropy (blmulholl...@gmail.com) schreef:

Pretty sure WAS is getting the config. When I comment out all wicket stuff
from web.xml, and just run a bare bones EAR, I type:

http://localhost:9080/MyApp/images/info1.png

And i get that image (thus proving it's responding)

I drop to:

http://localhost:9080/MyApp/images/

and I get 404.

Put Wicket back in place and run the same test and get:

ajax-loader.gif
info1.png
mainLogoHeader_01.png
mainLogoHeaderTrans_01.png
ui-icons_44_256x240.png
ui-icons_55_256x240.png
ui-icons_777620_256x240.png
ui-icons_77_256x240.png
ui-icons_cc_256x240.png
ui-icons_ff_256x240.png


There's no other filter or servlet in the web.xml at all. Normally there's
an anti-XSS filter, but I took that out prior to running this test. br/> <
Anyway, that's why I think it's Wicket. Or something the presence of Wicket
is allowing.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Preventing directory list

2018-02-13 Thread Bas Gooren
Hi,

Yes I’m quite sure Wicket is not doing this; I’ve perused the source code
many times (especially the resource handling parts), and there is no code
for listings.

Furthermore, since listings can pose a security risk, there would be a
setting to disable this; Such a setting is not available.

Are you certain web sphere is picking up your configuration?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13 februari 2018 bij 17:12:19, Entropy (blmulholl...@gmail.com) schreef:

But I have "/*" mapped t the wicket servlet. /images is under "/*". I have
no servlet mapping enabling /images or other subdirs.

further, we're in websphere and in the ibm-web-ext.xml we have directory
browsing set to false.



You're certain Wicket doesn't do this? I tried removing my wicket servlet
and getting to the images folder and it didn't work. We're in Wicket 6 if
it matters.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Preventing directory list

2018-02-13 Thread Bas Gooren
Hi!

For as far as I know, wicket does not provide any directory listings; I
suspect this is either your application server, or your webserver which
responds with a directory listing.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13 februari 2018 bij 16:44:43, Entropy (blmulholl...@gmail.com) schreef:

The SecurePackageResourceGuard prevents access to files by extension, but I
notice that when I type /images into my URL, I get a sort of directory
listing of files under that folder. True, they're all public files, but I
don't want people to get a listing like that. How can I direct the resource
guard to not allow directory listings for ANY directory?

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: wicket:for inside a propertyListView doesn't generate id on the input

2018-01-03 Thread Bas Gooren
Hi Virginie,


Looking through the wicket source code, I see that wicket:for is handled
through a component resolver (see AutoLabelResolver).

Since these are run at render time (see MarkupContainer#renderNext()) and
your label is after the checkbox in html, it means that your checkbox input
is already rendered when the AutoLabelResolver runs.


To fix this, please call setOutputMarkupId(true) yourself on the checkbox,
or put the label before the checkbox in your html.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 januari 2018 bij 08:02:15, Virginie Garcin (
virginie.gar...@equitativa.com) schreef:

Hi there,

When we are using wicket:for into a PropertyListView, the id is not
automatically set on the related input, except if we force it by using
setOutputMarkupId(true).
Outside a propertyListView the id is generated without forcing it.
Please can you tell me if it's normal, if I use it incorrectly or if it is
a bug?
We are using Wicket 8.0.0-M8.

Thanks and regards,
Virginie

HTML:




Active




Java:
form.add( new PropertyListView( "variations" ) {
@Override
protected void populateItem(final ListItem variationItem)
{
variationItem.add( new CheckBox( "active" ) );
}
} );

Output HTML: the "for" on the label is there but the "id" on the input is
missing.




Active





Re: Odd Requirement

2017-10-06 Thread Bas Gooren
Hi,

Sounds like you need a decorator for all of your validators, which runs the
wrapped validator (or not) based on a flag.

This is a possible implementation:

E.g.

enum ValidationMode {
Format, Full
}

class ModeDependantValidatorDecorator implements IValidator {
IValidator wrapped;
IModel modeModel;
ValidationMode desiredMode;

… ctor …

void validate(IValidatable validatable) {
if(modeModel.getValue() == desiredMode) {
wrapped.validate(validatable);
}
}
}

You’ll need to wrap all validators that you want to toggle on/off with this
decorator.
Put the ValidationMode model in your page, and let the submitting
components set it based on their desired validation mode.
Detach the model on page detach.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 5 oktober 2017 bij 20:34:35, Entropy (blmulholl...@gmail.com) schreef:

We have an odd requirement that I was wondering how to implement in wicket.
we're in Wicket 6. The analysis team wants the ability to save a page in an
incomplete fashion. Only format validations fire (you can enter nothing,
but if you enter anything, you must at least comply with format rules...no
entering letters in a date field) on some save events, but when you hit a
Continue we validate the whole enchilada.

But they also want this exit button that is particularly throwing us for a
loop because they want to prompt, asking the user if they want to save
first, and if yes, we save with just format validators, and either way
invalidate the session.

Setting default form processing isn't quite right for us because it turns
ALL of the validators on or off, and AFAIK, can't be set after the event is
already underway.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: NumberTextField and LambdaModel, typing goes wrong?

2017-10-04 Thread Bas Gooren
Rob,

This is because a property model provides certain metadata (when available);
E.g. When the property model points to a field, it provides the type of field.
Even when the model value is null this type information is still available.

Since this metadata is not available when using lambdas wicket uses a
default (String).

The reason it also works with a regular Model is because you provide a
value; thus, wicket can detect the type based on the value.

When your lambda does not return a value, wicket cannot detect the type.

// Bas

Verstuurd vanaf mijn iPhone

> Op 4 okt. 2017 om 16:58 heeft Rob Audenaerde  het 
> volgende geschreven:
>
> We are preparing for migration to Wicket 8 (when it comes out). So we are
> already replacing our old PropertyModels with a backported LambdaModel (we
> use the implementation from Wicket 8).
>
> I noticed an odd behavior where the RangeValidator gets an empty String
> from the input (in validatable.getValue()) if the input is not an integer
> (for example, changing '2' to '2e' in the textfield).
>
> This results in a class cast exception.
>
> If I replace the Lambdamodel by a IModel = new Model(2)
> it works fine.
>
> After adding the type Integer.class to the NumberTextField it works fine
> again.
>
> Am I doing something wrong?
>
> Thanks!
>
> Here is the relevant code (see commented section):
> --
>
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
>
> static class MyInt implements Serializable
> {
> Integer i=2;
>
> public Integer getI() {
> return i;
> }
>
> public void setI(Integer i) {
> this.i = i;
> }
> }
> public HomePage(final PageParameters parameters) {
> super(parameters);
>
> IModel myInt = new Model(new MyInt());
> IModel intModel = LambdaModel.of(myInt, MyInt::getI, MyInt::setI);
> Form f = new Form("f") {
>
> };
> //Next commented line does not work if you change the input for '2' to '2e'
> and click outside the input box.
> //NumberTextField ntf = new NumberTextField<>("tf", intModel);
> NumberTextField ntf = new NumberTextField<>("tf", intModel, Integer.class);
> ntf.setOutputMarkupId(true);
> ntf.setMinimum( 1 ).setStep( 1 );
> ntf.add( new OnChangeAjaxBehavior()
> {
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onUpdate( AjaxRequestTarget target )
> {
> System.out.println("changed!");
> }
> }  );
> f.add(ntf);
> add(f);
>
> }
> }

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: why is DefaultNestedTree component treated as property within PropertyResolver ?

2017-08-18 Thread Bas Gooren
Hi Ulrich,

My guess (based on quickly looking at your code on my phone): the
DeafultNestedTree probably uses a model to store open/closed state or
selected states. Since you don't provide it in the constructor, wicket
automatically creates a property model since a parent component has a
CompoundPropertyModel.

Check if the DNT has additional constructors which take an
IModel. Provide your own model and your problem
should be fixed :-)

// Bas

Verstuurd vanaf mijn iPhone

> Op 18 aug. 2017 om 15:37 heeft Knaack, Ulrich 
>  het volgende geschreven:
>
> Hi,
>
> I'm trying to display a DefaultNestedTree (id="dataTreeView") within a 
> Bootstrap Modal
>
> Instances of Service contain an ID that I use for retrieving a recursive data 
> structure from database.
> The recursive structure is realized by instances of "RecursiveData" .
> See line 15 and method onModelChanged().
> RecursiveData contains self referencing properties "parent" and "children"
>
> 00 import com.example.Service
> 00
> 01 public class DataViewDialog extends Modal
> 02 {
> 03 private static final long serialVersionUID = 7766394608644043929L;
> 04
> 05 @SpringBean
> 06 private RecursiveDataBean dataBean;
> 07
> 08 private RecursiveDataTreeProvider treeProvider;
> 09
> 10 public DataViewDialog(String id, IModel model)
> 11 {
> 12 super(id, model);
> 13
> 14 Service service = model.getObject();
> 15 List data = 
> dataBean.getRootDataByServiceId(service.getServiceId());
> 16
> 17 BootstrapForm form = new BootstrapForm<>("form");
> 18 add(form);
> 19
> 20 treeProvider = new RecursiveDataTreeProvider(data);
> 21
> 22 DefaultNestedTree tree =
> 23 new DefaultNestedTree("dataTreeView"
> 24 , treeProvider)
> 25 {
> 26 private static final long serialVersionUID = 
> -7659715973883984412L;
> 27
> 28 @Override
> 29 protected Component newContentComponent(String id1
> 30 , IModel node)
> 31 {
> 32 return super.newContentComponent(id1, node);
> 33 }
> 34 };
> 35
> 36 form.add(tree);
> 37
> 38 BootstrapAjaxButton close = new BootstrapAjaxButton("close"
> 39 , Model.of("schließen"), Buttons.Type.Primary)
> 40 {
> 41 private static final long serialVersionUID = 
> 7877084020329862442L;
> 42
> 43 @Override
> 44 protected void onSubmit(AjaxRequestTarget target, Form form)
> 45 {
> 46 super.onSubmit(target, form);
> 47 appendCloseDialogJavaScript(target);
> 48 }
> 49 };
> 50 form.add(close);
> 51 }
> 52
> 53 @Override
> 54 protected void onModelChanged()
> 55 {
> 56 super.onModelChanged();
> 57 String serviceId = getModel().getObject().getServiceId();
> 58 List newDataList = 
> dataBean.getRootDataByServiceId(serviceId);
> 59 treeProvider.setRecursiveData(newDataList);
> 60 }
> 61 }
>
> I know from debugging that my implementation of ITreeProvider 
> is working well,
> also after execution of "onModelChanged()".
>
> But when the tree is rendered, this error occurs:
>
> org.apache.wicket.WicketRuntimeException: Property could not be resolved for 
> class: class  com.example.Service  expression: dataTreeView
> at 
> org.apache.wicket.core.util.lang.PropertyResolver.getGetAndSet(PropertyResolver.java:393)
> at 
> org.apache.wicket.core.util.lang.PropertyResolver.getObjectWithGetAndSet(PropertyResolver.java:355)
> at 
> org.apache.wicket.core.util.lang.PropertyResolver.getObjectWithGetAndSet(PropertyResolver.java:261)
> at 
> org.apache.wicket.core.util.lang.PropertyResolver.getValue(PropertyResolver.java:111)
> at 
> org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:86)
> at 
> org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree.getModelObject(AbstractTree.java:161)
> at 
> org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree.getState(AbstractTree.java:240)
> at 
> org.apache.wicket.extensions.markup.html.repeater.tree.nested.Subtree.isVisible(Subtree.java:136)
>
> Why does Wicket try to resolve a property that doesn't exist within "Service" 
> ?
>
> I've tried a version without a BootstrapForm within the Modal, where 
> "dataTreeView" is attached to the Modal directly. Same problem.
>
> Mit freundlichen Grüßen
> Ulrich Knaack
>
> Landesamt für Geoinformation und Landesvermessung Niedersachsen (LGLN)
> - Landesvermessung und Geobasisinformation - Landesbetrieb -
> Fachgebiet 224 - Geodateninfrastruktur
> Podbielskistraße 331, 30659 Hannover
> Tel.: +49 511 64609-287
> Fax: +49 511 64609-161
> 

Re: How to "force" page redirects to HTTPS?

2017-08-08 Thread Bas Gooren
Well, all redirects are mapped by the SystemMapper (and its child mappers);
So if you are certain that it’s mapped inside your HttpsMapper, that should
not be the problem.

Have you set a breakpoint inside BufferedWebResponse#sendRedirect? You
should check what url it receives and if it is a http url, whether the url
generation went through your HttpsMapper.
This also allows you to detect if the container is interfering (your app
server or reverse proxy).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 8 augustus 2017 bij 12:50:47, Hendy Irawan (he...@soluvas.com) schreef:

Thanks Sebastian for the hint.

But yes, I've mapped all pages before calling setRootRequestMapper.
I also put logs in my getDesiredSchemeFor and they're being called, and
returning HTTPS for all calls.

But is it possible there are some cases it's not being called (?) Or
perhaps
the ?1 stateful redirect is handled differently?

My current issue is only with the redirects. Everything else seems to be
fine...

Hendy

-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-force-page-redirects-to-HTTPS-tp4678479p4678484.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: How to "force" page redirects to HTTPS?

2017-08-08 Thread Bas Gooren
Hi!

How and when are you mounting your pages?

If you are mounting them _after_ installing the HttpsMapper, then those
pages will not be mapped “under” https.
This is because a compound request mapper is created on demand when
mounting pages, in case the current root mapper is not already a compound
mapper.

Please confirm if you are, in fact, mounting pages after your call to
setRootRequestMapper.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 8 augustus 2017 bij 12:39:12, Hendy Irawan (he...@soluvas.com) schreef:

I have managed to use XForwardedRequestWrapperFactory by creating a Filter.
I also use HttpsMapper as follows :

setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
HttpsConfig()) {
@Override
protected Scheme getDesiredSchemeFor(IRequestHandler handler) {
final HttpServletRequest request = (HttpServletRequest)
RequestCycle.get().getRequest().getContainerRequest();
// Assume runtime deployment is always reverse proxied and
SSL-terminated by load balancer
// WARNING: This requires proper
XForwardedRequestWrapperFactory configuration AND nginx configuration
final Scheme desiredScheme =
"https".equalsIgnoreCase(request.getScheme()) ? Scheme.HTTPS :
super.getDesiredSchemeFor(handler);
log.debug("Scheme: {} Secure: {} Remote Addr: {}
desiredScheme for {}: {}",
request.getScheme(), request.isSecure(),
request.getRemoteAddr(),
null != handler ? handler.getClass().getSimpleName()
: null, desiredScheme);
return desiredScheme;
}
});

However, even though I've confirmed that XForwardedRequestWrapperFactory
works as intended (settings scheme=https and isSecure=true),
getDesiredSchemeFor() always returns HTTPS in my case, initial redirect for
stateful pages are always done using HTTP. i.e. from https://.../match/edit
redirected to http://.../match/edit?1, while I would expect it to be
redirected to https://.../match/edit?1

Please help, thank you in advance.

-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-force-page-redirects-to-HTTPS-tp4678479p4678482.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


How do you handle rolling upgrades?

2017-07-26 Thread Bas Gooren
Hi All,

TL;DR: How/where do you host your wicket apps so you can deploy a new
version while users are actively using the old/current version? In
particular: when the new version cannot read the sessions of the old
version due to page changes.

We’re investigating how we can eliminate downtime in some of our apps while
we deploy a new version.

Most of the stuff we’ve built in the past could handle 30 sec downtime
without much issue (e.g. outside office hours).

However, we would like to be able to deploy more often; Perhaps even move
towards continuous deployment.

Currently, using wicket, this seems problematic due to two reasons:

   - Wicket’s sessions (http session and in particular wicket’s filestore)
   require affinity
   - Session incompatibility: new version of app usually cannot deserialize
   old sessions; If we simply take the old version offline, users will need to
   start with a fresh session

Since we would like to do deploys without service interruption for active
users, I imagine something like session draining on the “old” version after
the “new” version goes online.
Haproxy has support for this: launch new version and route new users to it,
put old one in maintenance mode and take it offline when all sessions for
it have expired (or after predetermined timeout, e.g. 30 minutes).

Most cloud providers (e.g. heroku, jelastic) don’t handle this gracefully
for as far as I can tell. While they do handle rolling upgrades, they
assume statelessness or otherwise transferable statefulness (new version
can read state of old version).

Tomcat has support for parallel deployments ([1]), but I’m not a big fan of
running multiple apps in a single JVM.

Since we don’t build things that will require massive horizontal
scalability, powerful virtual servers have always worked great for us.

That means we’ll probably need to put a reverse proxy in between our
frontend (apache for SSL termination) and app server (tomcat) to handle
routing.
But of course, before we build something like that on top of haproxy (or
other…) I’d like to make sure we’re not reinventing the wheel.

I’m curious how other users of wicket handle this: how do you handle active
user sessions (with state) when rolling out a new version of your app?

I’d be grateful for any insights and experiences from other wicketeers!

http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Parallel_deployment


Met vriendelijke groet,
Kind regards,

Bas Gooren


Re: How save entity after clicking on submit button inside Form Wicket class.

2017-03-29 Thread Bas Gooren
Hi Sokab,


I’m not an expert regarding EJB injection, but my first guess is that your


@EJB

NewSessionBeanLocal beanLocal


is null inside your form. Can you check this please?


If that is the case, it’s probably related to the way you have set up
injection. Can you share how you have configured the dependency injection?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 28 maart 2017 bij 18:59:33, Sokab (sokab3...@gmail.com) schreef:

Hi Everyone. When I try save entity inside simple WebPage like this
everything is ok:

import com.example.entities.Person;
import javax.ejb.EJB;

public class Register extends WebPage{
@EJB
NewSessionBeanLocal beanLocal;
br/> public Register(){{
br/> NavomaticBorder navomaticBorder = new
NavomaticBorder("navigationBorder"); br/> ReggisterForm form = new
RegisterForm("form"); br/> naavomaticBorder.add(form);
add(navomaticBorder);
br/> // save entity to database for test <
Person person = new Person();
person.setSurname("ABC");
person.setUsername("DEF");

beanLocal.addPerson(person); // IT IS OK
}
}

//


Html Form:



TODO supply a title




br/> 
Username 
Suername 

 br/> br/>  <


//


but when i try do this inside Form, becouse I want save entity after click
on Subimt button (register Person):

import com.example.Repository.NewSessionBeanLocal;
import com.example.entities.Person;
import javax.ejb.EJB;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;

public class RegisterForm extends Form{ br/> @@EJB
NewSessionBeanLocal beanLocal;
br/> Person person = new Person();
br/> public RegisterFForm(String id) {
super(id); br/> CompoundPropertyModel mmodel = new
CompoundPropertyModel(person);
this.setModel(model);
br/> this.add(new TextFField("username"));
this.add(new TextField("surname"));
}
br/> @@Override
public void onSubmit() {
Person p = (Person)this.getModelObject();
System.out.println("TO: : : "+ p.getUsername()+ " "+
p.getSurname()); // shows right data
br/> //Person p = new Person();
//p.setSurname("ABC");
//p.setUsername("DEF");

beanLocal.addPerson(p); // <-- PROBLEM IS HERE
} br/> br/>}}


I have error:
Unexpected RuntimeException:

Last cause: null
WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
[RegisterForm [Component id = form]] on component [RegisterForm [Component
id = form]] threw an exception

Root cause:
java.lang.NullPointerException
at
com.example.navigationBefore.RegisterForm.onSubmit(RegisterForm.java:34)
(...)

Something I'm doing wrong? I Should not save entity inside onSubmit() Form
method? Thank you for any advice.

-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-save-entity-after-clicking-on-submit-button-inside-Form-Wicket-class-tp4677474.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Generated IDs

2017-02-06 Thread Bas Gooren
You can always register a component instantiation listener (or on before render 
listener etc) in development mode, and let it set markups ids in any way you 
want to provide stable ids.

E.g. a configure listener, which listens for Page instances and runs a visitor 
over all it’s components to set the markup id according to some algorithm.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 6 februari 2017 bij 17:25:21, Entropy (blmulholl...@gmail.com) schreef:

Yes, but we have a whole lot of existing pages and fields and links and  
buttons. I was kind of hoping I could just get wicket's generated IDs to be  
stable from page run to page run, and avoid getting a work request approved  
to go back and tweak every field.  

--  
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Generated-IDs-tp4677000p4677002.html 
 
Sent from the Users forum mailing list archive at Nabble.com.  

-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Cannot mock final SortableDataProvider.getSortState

2017-01-13 Thread Bas Gooren
Hi Eric,


Well - looking at SortableDataProvider I suppose you cold mock an
implementation of it. As getSortState() is final, you need to trust that it
does it’s job. Why do you want to mock that method?

The same applies to LoadableDetachableModel - why do you need to mock final
getObject(), which has a know contract/implementation?


In general I’m not sure I understand yet why you are mocking your
SortableContactDataProvider.


If you want to test that your SortableContactDataProvider does it’s job
properly, provide it with a mock database so you can verify that it makes
all expected calls.

Since you are using a static call to locate your database, you could
introduce a way to force a ContactsDatabase for the current thread in your
locator class.


For example (pseudocode for a unit test):


… run before test

ContactsDatabase mockDatabase = createMock(…)

DatabaseLocator.setDatabaseForCurrentThread(mockDatabase)


… in test

expect(mockDatabase.getIndex(anyObject())).andReturn(…)

SortableContactDataProvider.iterator(….)

etc.


… run after test

DatabaseLocator.clearDatabaseForCurrentThread()

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13 januari 2017 bij 12:10:03, Eric J. Van der Velden (
ericjvandervel...@gmail.com) schreef:

Hoi Bas,

Thank you for your answer!

So maybe I am doing it wrong.

Let's take an example. In the wicket examples, in package
org.apache.wicket.examples.repeater, there is the provider:

public class SortableContactDataProvider_my extends
SortableDataProvider_my<Contact, String> implements
IFilterStateLocator
{
...

protected ContactsDatabase getContactsDB()
{
return DatabaseLocator.getDatabase();
}

@Override
public Iterator iterator(long first, long count)
{
List contactsFound = getContactsDB().getIndex(getSort());
return filterContacts(contactsFound).
subList((int)first, (int)(first + count)).
iterator();
}

I mocked the iterator method. But you are saying that I should mock the
getContactsDB method?

Thank you.

On Thu, Jan 12, 2017 at 11:10 AM, Bas Gooren <b...@iswd.nl> wrote:

> Eric,
>
>
> All of our data providers use an external source to load the actual data,
> e.g. a repository or dao.
>
> As all of our repositories and daos are interfaces, those are easy to mock.
>
>
> Testing the provider is then simply a matter of ensuring the right
> methods, with the right parameters are called on the mocked objects.
>
>
> What functionality in your (custom) data providers do you have that you
> want to test? In general I would say that final methods in a known and
> tested library (wicket) do not need to be tested anyway - that is the
> responsibility of the library.
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 12 januari 2017 bij 10:23:12, Eric J. Van der Velden (
> ericjvandervel...@gmail.com) schreef:
>
> Hello,
>
> SortableDataProvider, in
> package org.apache.wicket.extensions.markup.html.repeater.util, has a
> final
> method getSortState().
>
> I cannot mock this method.
>
> I have copied SortableDataProvider under a different name, and subclassed
> this one,but I do not like this.
>
> The same happens with final LoadableDetachableModel.getObject(), but in
> this case I could mock LoadableDetachableModel.load().
>
> So why are these methods final, and how do programmers test the provider?
>
> Thank you!
>
>


Re: Cannot mock final SortableDataProvider.getSortState

2017-01-12 Thread Bas Gooren
Eric,


All of our data providers use an external source to load the actual data,
e.g. a repository or dao.

As all of our repositories and daos are interfaces, those are easy to mock.


Testing the provider is then simply a matter of ensuring the right methods,
with the right parameters are called on the mocked objects.


What functionality in your (custom) data providers do you have that you
want to test? In general I would say that final methods in a known and
tested library (wicket) do not need to be tested anyway - that is the
responsibility of the library.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 12 januari 2017 bij 10:23:12, Eric J. Van der Velden (
ericjvandervel...@gmail.com) schreef:

Hello,

SortableDataProvider, in
package org.apache.wicket.extensions.markup.html.repeater.util, has a final
method getSortState().

I cannot mock this method.

I have copied SortableDataProvider under a different name, and subclassed
this one,but I do not like this.

The same happens with final LoadableDetachableModel.getObject(), but in
this case I could mock LoadableDetachableModel.load().

So why are these methods final, and how do programmers test the provider?

Thank you!


Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

2017-01-04 Thread Bas Gooren
Hi!

Yes, wicket does not automatically add changed components to the ajax response.
That would be a lot of magic, which does not fit with the way the rest of the 
framework works (for as far as I know).
I quite like how it currently works, as it’s very clear what happens.

Looking at your code, I have some tips:

Don’t store the AjaxRequestTarget (ART) in the session. The session can exist 
across requests, so this is not something you want to mix.
You can always get the current ART from inside a component in case you don’t 
have a reference to it:

getRequest().find(AjaxRequestTarget.class)

Making things more “automatic” for your specific application:
There is a number of ways to do this;
One example would be to create a custom component which does what you want, 
which either extends existing wicket components or wraps them (e.g. a Panel).
Another example would be to broadcast a wicket event from every component once 
it’s been updated (storing a component reference in the event); You can then 
listen for these events in your “parent”/owning component and add the component 
to the ART.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 4 januari 2017 bij 15:10:46, christophe (madeleine.christo...@wanadoo.fr) 
schreef:

Hello Sebastian  

That was a fast feedback!! I am impressed!!!  

For 2) I would have to go and modify the code to get you the exact error.  
What I was trying to point out was simply that if Ido not BOTH replace or 
update the component (its state, its content) AND add to to The 
AjaxRequestTarget ( target.add(myComponent) I get all sorts of malfunction.  
So the question was really is this how it mut be done or am I missing something 
important (after several years of Wicket programming, there would not be much 
to be proud about!!)  

This is an example (simplifed) to update the content of a text input field  

public void setValue(String value) {  
// Some business logic  
//Then  
model = new Model(value);  
field.setModel(model);// Does not add the field to the output stream  
if (getSession().getTarget() ) // If an Ajax event is being processed the 
Target it came with is stored for the duration of said “process”  
getSession().getTarget().add(field); //If I dont do this the content does not 
get updated on the browser  
}  

So my understanding is that, in the context of an event (intercepted by a 
behavior) that comes “bundled” with an AjaxRequestTarget updating the component 
(and possibly replacing it) is not enough for said component to be added to the 
output stream. I must manuall do it via AjaxRequestTarget#add(Component).  

Hence my 2 questions:  
I am right?  
What about mking this “automatic”?  

If I am wrong please let me know  

Regards  
Christopeh  

From: Sebastian [via Apache Wicket]  
Sent: Wednesday, January 04, 2017 2:28 PM  
To: christophe  
Subject: Re: Question/Suggestion about updating a component in aw existing page 
(Wicket 6.x)  

Hi Christophe!  

Regarding (1): it sounds like you are not using models properly; Models are 
what makes a component “dynamic” - they pull data from a source (which could be 
a static string).  
Can you show us some code?  

Regarding (2): Can you show us the exceptions you get?  
In any case you should be aware that you cannot re-render a hidden component, 
unless you set its setOutputMarkupPlaceholderTag(true) method, ensuring that 
there is always a HTML element to replace.  
Another common solution is to re-render a container element which is always 
present in the HTML.  

Met vriendelijke groet,  
Kind regards,  

Bas Gooren  

Op 4 januari 2017 bij 14:33:34, christophe ([hidden email]) schreef:  

Hello dear readers  
I am working on a web application that is very very AJAX-oriented. In other  
words any "displayed" page gets updated many times as a consequence of  
events such as (html) blur, mouse click.  
By updating I mean  
One or more fields become visible or invisible  
One or more fields become enabled or disabled  
Their content (for example a drop down list) changes  
Many more  

To actually "change" a markup component I  
1) create a new one and replace the existing one or udpate the Component  
(for example to enable it)  
2) Add this component to the AjaxRequestTarget  

I must do both because if I do  
1 only: the change is not reflected in the web page.  
2 only the component is not in the right "state" and I get all sorts of  
exceptions when it receives a message  

So I was wondering  
1) AM i doing this right or amm I missing the obvious  
2) If I am not doing anything wrong would it be possible to "enhance" Wicket  
so that any replace or "state", content update gets added "automatically" to  
the Request Target?  

I sincerely hope to hear from someone.  
Christophe  

--  
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Question-Suggestion-about-updating-a-component-in-aw-existing-page-Wicket-6-x-tp46

Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

2017-01-04 Thread Bas Gooren
Hi Christophe!

Regarding (1): it sounds like you are not using models properly; Models are 
what makes a component “dynamic” - they pull data from a source (which could be 
a static string).
Can you show us some code?

Regarding (2): Can you show us the exceptions you get?
In any case you should be aware that you cannot re-render a hidden component, 
unless you set its setOutputMarkupPlaceholderTag(true) method, ensuring that 
there is always a HTML element to replace.
Another common solution is to re-render a container element which is always 
present in the HTML.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 4 januari 2017 bij 14:33:34, christophe (madeleine.christo...@wanadoo.fr) 
schreef:

Hello dear readers  
I am working on a web application that is very very AJAX-oriented. In other  
words any "displayed" page gets updated many times as a consequence of  
events such as (html) blur, mouse click.  
By updating I mean  
One or more fields become visible or invisible  
One or more fields become enabled or disabled  
Their content (for example a drop down list) changes  
Many more  

To actually "change" a markup component I  
1) create a new one and replace the existing one or udpate the Component  
(for example to enable it)  
2) Add this component to the AjaxRequestTarget  

I must do both because if I do  
1 only: the change is not reflected in the web page.  
2 only the component is not in the right "state" and I get all sorts of  
exceptions when it receives a message  

So I was wondering  
1) AM i doing this right or amm I missing the obvious  
2) If I am not doing anything wrong would it be possible to "enhance" Wicket  
so that any replace or "state", content update gets added "automatically" to  
the Request Target?  

I sincerely hope to hear from someone.  
Christophe  

--  
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Question-Suggestion-about-updating-a-component-in-aw-existing-page-Wicket-6-x-tp4676637.html
  
Sent from the Users forum mailing list archive at Nabble.com.  

-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: AbstractToolbar vs AjaxFallbackDefaultDataTable

2016-12-29 Thread Bas Gooren
It sounds like your code keeps adding the toolbar. Can you show us
some code that adds your custom toolbar? It should only add the
toolbar once, when the table is created.

// Bas

Verstuurd vanaf mijn iPhone

> Op 29 dec. 2016 om 09:53 heeft nino martinez wael 
>  het volgende geschreven:
>
> After looking into
> https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/data/table/export/ExportToolbar.html
>
> I realised that it was using onInitialize() so I moved my code there
> instead of the constructor.. But it made no change what so ever..
>
>
>
> On Thu, Dec 29, 2016 at 9:37 AM, nino martinez wael <
> nino.martinez.w...@gmail.com> wrote:
>
>> Hi
>>
>> I am having a little trouble, making my own toolbar. Currently on
>> pagination change my toolbar are added, but the old toolbar are not removed
>> / updated. So for every click on pagination, additional toolbars are added.
>>
>> Short story:
>> User clicks page 2 on AjaxFallbackDefaultDataTable
>> User now sees two delete buttons
>>
>> public abstract class SelectedListActionToolbar extends AbstractToolbar {
>>
>>public SelectedListActionToolbar(final IModel>
>> model, final DataTable table)
>>{
>>super(table);
>>setOutputMarkupId(true);
>>Link link=new Link("onAction"){
>>@Override
>>public void onClick() {
>>SelectedListActionToolbar.this.onClick(model);
>>}
>>};
>>add(link);
>>
>>
>>}
>>
>>public abstract void onClick(final IModel>
>> model);
>>
>>
>> 
>>Delete Selected
>>
>> 
>>
>>
>>AjaxFallbackDefaultDataTable dataTable = getTable();
>>dataTable.addBottomToolbar(new 
>> SelectedListActionToolbar(selectedSites,dataTable)
>> {
>>@Override
>>public void onClick(final IModel>
>> model) {
>>//Delete the stuff!
>>}
>>});
>>
>>add(dataTable);
>>
>>
>> --
>> Best regards / Med venlig hilsen
>> Nino Martinez
>>
>
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Calling Javascript for any event in a parent

2016-12-22 Thread Bas Gooren
Hi!


You can override #onEvent in your “parent” component.

The AjaxRequestTarget is broadcast as an event (you can check if the
payload is an ART).


You can then check if the ART contains your table component, and if it
does, append your javascript.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 22 december 2016 bij 15:40:23, MissOvenMitts (
chantal.lucette.da...@gmail.com) schreef:

Thank you guys so much for your quick responses!

I had not tried global listeners - mostly because if I have a component and
not a target (as one of the method parameters) I don't really get how to
call a javascript function. For example, when I have a target, I can do a
target.appendJavaScript()

target.appendJavaScript("alert('You clicked a button!')"); br/> <
... and that runs immediately. I guess with this example I'm not sure where
to put the javascript, is my point.

So, for more detail on what I'm trying to do:

It is, in fact, the same exact Javascript that needs to be run for every
button/link in the data table (in addition to the function the buttons
already perform, obviously, like paging).

At the moment I have a behavior attached to a random WebMarkupContainer on
the base page where the datatable is (the datatable is not a child of the
WebMarkupContainer.. this is just the only way I really know how to add
javascript into the header and into the onDomReady). br/> <
This behavior simply renders javascript to the header for the javascript
function that I want to use called myTableFunction.

Then the behavior simply adds the following javascript on Dom Ready:

("$(\"html\").find(\".mySpecialTableClass\").myTableFunction({'left' : 1,
'foot' : true, 'head' : true});");

This javascript just searches the page for a particular class and runs a
javascript function on it.

The javascript doesn't need the wicket's Component ID, and the behavior
that
creates the javascript isn't even attached to the wicket table which
receives the changes from the javascript.

So, as it stands, the javascript function is called when the page loads up
and everything works perfectly. However, obviously, whenever any paging
links in the .mySpecialTableClass data-table are clicked, the table is
refreshed and the changes that the javascript myTableFunction() made on the
table naturally disappear. br/> <
As a result, we want to tack the same javascript we already put onDomReady
onto any other clicks within the data table that might refresh it.

I hope that makes more sense!

Again, your help is so appreciated. This has been one of those changes that
has you pacing outside wanting to tear your hair out. It's *so* close to
completion that it's that much more frustrating.





-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Calling-Javascript-for-any-event-in-a-parent-tp4676501p4676510.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Bug in wicket 7.5.0 caused by WICKET-6231; Reported as WICKET-6266

2016-11-01 Thread Bas Gooren
Hi all,

Some of our apps broke pretty badly when upgrading from 7.4.0 to 7.5.0.

Using auto-components (which are created & added using component resolvers)
and overriding getVaration() on a parent component breaks the page render
for us.

Under these circumstances a render fails with a RTE for us:
- page overrides getVaration() returning some non-empty value
- page html doesn’t have a version for that variation, so the default
version is used (MyPage.html and not MyPage_variation.html)
- component resolvers break: WICKET-6231 ignores the markup set for
auto-components if the variation does not match; there is no other way to
find the markup (since it is an auto-component)

See https://issues.apache.org/jira/browse/WICKET-6266
I have included a quickstart which demonstrates the problem and have added
a comment with a possible fix to the ticket.

PS I would hereby also like tor request write access to the wicket wiki
(username bgooren), to list the company I work for on the “Companies that
provide services”-page. Thanks!

Met vriendelijke groet,
Kind regards,

Bas Gooren


Re: stop wicket from rewriting references in my css file

2016-06-23 Thread Bas Gooren
Can you show us how the references are being rewritten? Maybe the format is
an indication of where it is being rewritten…

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23 juni 2016 bij 08:18:34, nino martinez wael (
nino.martinez.w...@gmail.com) schreef:

I've looked everywhere and cant find references to CssUrlReplacer.. I
will look into it later.. Thanks for the hints...


-Nino

On Thu, Jun 16, 2016 at 2:16 PM, Tobias Soloschenko
<tobiassolosche...@googlemail.com> wrote:
> Hi,
>
> If you don't add the CssUrlReplacer manually it is not active by default.
If URLs are replaced into Reference URLs it might be a manually added
CssUrlReplacer.
>
> If you don't want that some of the URLs are replaced you can consider to
add them into a different CSS file and add the name of the file to the
excludes of the CssUrlReplacer.
>
> kind regards
>
> Tobias
>
>> Am 16.06.2016 um 08:12 schrieb nino martinez wael <
nino.martinez.w...@gmail.com>:
>>
>> Ok it looks like it could be something like that. BUT,i've changed
>> nothing from stock options. Could that be enabled by default in 6.22 .
>> Other option of course are that it is because of something in pax
>> wicket.. I'll go check.
>>
>>> On Wed, Jun 15, 2016 at 1:15 PM, Bas Gooren <b...@iswd.nl> wrote:
>>> Sounds like you have enabled the css compressor / rewriter. By default
it is
>>> off.
>>>
>>> This assumes that you are letting wicket handle the css (which you do,
as
>>> you mention it is a shared resource).
>>>
>>> You are looking for Application#getResourceSettings() and
>>> (I)ResourceSettings#(get|set)CssCompressor().
>>> It sounds like it is currently set to an instance of CssUrlReplacer in
your
>>> app, as that rewrites all references in CSS.
>>>
>>> Met vriendelijke groet,
>>> Kind regards,
>>>
>>> Bas Gooren
>>>
>>> Op 15 juni 2016 bij 12:11:12, nino martinez wael
>>> (nino.martinez.w...@gmail.com) schreef:
>>>
>>> Hi
>>>
>>> I currently have an issue where I add a shared css resource, but
>>> wicket rewrites all references in the resource. I can't seem to find
>>> the setting to turn of that part of wickets processing?
>>>
>>> --
>>> Best regards / Med venlig hilsen
>>> Nino Martinez
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>> --
>> Best regards / Med venlig hilsen
>> Nino Martinez
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- br/>Best regards / Med venlig hilsen <
Nino Martinez

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: wicket-guice and recursive injection of non serializable JPA2 objects

2016-06-17 Thread Bas Gooren
Hi Dieter,


That’s what I expected (and why I did not recommend it); The error you see
is because somewhere in the component tree inside your page serialization
breaks. Since it happens when wicket passes the page to an (internal)
ObjectOutputStream, the only way to debug it would be to set a breakpoint
inside the OOS. As Martin recommends, you can do so in the future.


Happy to hear you found the root cause of your problem!


Although I do wonder why you are trying to cache JPA objects by yourself -
you could simply plug in a second level cache to your JPA provider. Then it
will cache transparently.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 17 juni 2016 bij 12:38:00, Dieter Tremel (tre...@tremel-computer.de)
schreef:

Hello Martin,

I tried this to learn it, but didn't find it.

I put a breakpoint at org.apache.wicket.serialize.java.JavaSerializer
SerializationCheckerObjectOutputStream#writeObjectOverride line 260 and
277 and looked at the variables content.

The obj was the complete page PersonenTable and I had to look at all the
children in the page hierarchy. Not straight forward to find.

Did I miss something?

Thanks Dieter

Am 17.06.2016 um 11:56 schrieb Martin Grigorov:
> Hi Dieter,
> br/>> It is quite easy to debug such issues by puttinng a breakpoint at
line where
> the exception is being thrown.
> Once you have the debugger stopped there you could click on the stack
> methods to see what was the parent object of the currently failing one.
> br/>> Martin Grigorov <
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> br/>> On FFri, Jun 17, 2016 at 11:46 AM, Dieter Tremel <
tre...@tremel-computer.de>
> wrote:
> br/>>> Hello Bas, <
>>
>> first of all let me thank you and Martin for your great support and the
>> helpful thoughts and examples :-)
>>
>> I am using wicket 7.30, the use of onBefore() is an old pattern I have
>> been used to, changed it now to
>> @Override
>> protected void onInitialize() {
>> super.onInitialize();
>> initMarkup();
>> }
>> on all pages.
>>
>> The last days I spent a lot of time in analyzing, debugging, some
>> refactoring, searching. But I didn't find the culprit yet. :-(
>>
>> Your example is useful, I read some similar blogpost about outside final
>> vars in methods of anonymous inner classes, but had no match in my code
>> so far.
>>
>> I will do some more exhaustive search and report, if I solved the
problem.
>>
>> Thank You
>> Dieter
>>
>> Am 16.06.2016 um 16:32 schrieb Bas Gooren:
>>> Hi Dieter,
>>>
>>>
>>> Which version of wicket are you using? (I ask since I see you are using
>>> onBeforeRender() to initialize your components, while since wicket 1.5
>>> there is onInitialize() for that in each component).
>>>
>>>
>>> For as far as I can see there are no references to your dao in the gist
>>> you provided; However, since it is serialized somewhere in the
component
>>> tree, it could be in one of the smaller components used in your
>>> PersonenTable page.
>>>
>>> In any case, your page (or a component inside it) has a reference to
>>> your dao.
>>>
>>>
>>> Since I’ve seen this a lot when I started using wicket, please check if
>>> you are referencing your dao somewhere inside an anonymous inner class
/
>>> component.
>>>
>>>
>>> E.g.:
>>>
>>>
>>> public Component createMyComponent(String id) {
>>>
>>> DAO dao = getDaoFromPageOrElsewhere();
>>>
>>> return new AjaxLink(id) {
>>>
>>> public void onClick(AjaxRequestTarget target) {
>>>
>>> // This is where an instance of DAO will get serialized into the
>>> component tree!
>>>
>>> dao.performAction();
>>>
>>> }
>>>
>>> }
>>>
>>> }
>>>
>>>
>>> Rewrite such code (if you have it) to look up the DAO reference at the
>>> time you actually need it:
>>>
>>>
>>> public void onClick(AjaxRequestTarget target) {
>>>
>>> DAO dao = getDaoFromPageOrElsewhere();
>>>
>>> dao.performAction();
>>>
>>> }
>>>
>>>
>>> My guess is that you’ll find the culprit by simply looking at all
places
>>> in your code where you use the PersonenDao.
>>>
>>>
>>> Met vriendelijke groet,
>>> Kind regards,
>>>
>>> Bas Gooren
>>>
>>> Op 15 juni 2016 bij 16:25:25, Dieter Tremel (tre...@tremel-computer.de

Re: wicket-guice and recursive injection of non serializable JPA2 objects

2016-06-16 Thread Bas Gooren
Hi Dieter,


Which version of wicket are you using? (I ask since I see you are using
onBeforeRender() to initialize your components, while since wicket 1.5
there is onInitialize() for that in each component).


For as far as I can see there are no references to your dao in the gist you
provided; However, since it is serialized somewhere in the component tree,
it could be in one of the smaller components used in your PersonenTable
page.

In any case, your page (or a component inside it) has a reference to your
dao.


Since I’ve seen this a lot when I started using wicket, please check if you
are referencing your dao somewhere inside an anonymous inner class /
component.


E.g.:


public Component createMyComponent(String id) {

DAO dao = getDaoFromPageOrElsewhere();

return new AjaxLink(id) {

public void onClick(AjaxRequestTarget target) {

// This is where an instance of DAO will get serialized into the component
tree!

dao.performAction();

}

}

}


Rewrite such code (if you have it) to look up the DAO reference at the time
you actually need it:


public void onClick(AjaxRequestTarget target) {

DAO dao = getDaoFromPageOrElsewhere();

dao.performAction();

}


My guess is that you’ll find the culprit by simply looking at all places in
your code where you use the PersonenDao.


Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 15 juni 2016 bij 16:25:25, Dieter Tremel (tre...@tremel-computer.de)
schreef:

Hello Martin,

it is:

personenProvider = (com.sun.proxy.$Proxy24)
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler@6eb3b9ea

wrapInProxies is true

I added a SignIn mechanism, SignInSession uses PersonenDao too to
authorize in the database. But I checked not to have any references to
it, that could be serialized. I added more of this this part to the gist:

https://gist.github.com/tremel/dd9bfa252282b5853d6d464feccaad29

Dieter

Am 15.06.2016 um 15:00 schrieb Martin Grigorov:
> Hi,
>
> Put a breakpoint at PersonenTable constructor and see what is the type of
'
> personenProvider'.
> It must be JDK Proxy instance.
> If it is not then something wrong is going on.
>
>
org.apache.wicket.guice.GuiceComponentInjector#GuiceComponentInjector(org.apache.wicket.Application,

> com.google.inject.Injector, boolean) - the last parameter here is
> 'wrapInProxies'. It must be 'true'.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Jun 15, 2016 at 2:18 PM, Dieter Tremel <tre...@tremel-computer.de>

> wrote:
>
>> Hi Bas,
>>
>> I put it in http://pastie.org/private/19zeomb8uy1beb1gfjegq
>>
>> I fear it is not really useful, since it starts with
>>
>> org.apache.wicket.WicketRuntimeException: A problem occurred while
>> trying to collect debug information about not serializable object
>>
>> Dieter
>>
>> Am 15.06.2016 um 13:39 schrieb Bas Gooren:
>>> Hi Dieter,
>>>
>>> Can you share the stack trace of the serialization checker error?
>>> Normally it points out where in the hierarchy it found a
>>> non-serializable object.
>>> My first guess is that you are referencing the dao class somewhere
>>> directly from your page. The stack trace will prove me right or wrong
:-)
>>>
>>> Met vriendelijke groet,
>>> Kind regards,
>>>
>>> Bas Gooren
>>>
>>> Op 15 juni 2016 bij 13:29:24, Dieter Tremel (tre...@tremel-computer.de
>>> <mailto:tre...@tremel-computer.de>) schreef:
>>>
>>>> Hello Bas,
>>>>
>>>> I try to cut small pieces of the code, please tell me if you want to
see
>>>> more.
>>>>
>>>> First the error:
>>>>
>>>> 12:59:03.919 [http-nio-8084-exec-6] WARN
>>>> o.a.w.c.u.o.c.CheckingObjectOutputStream - error delegating to
>>>> writeObject :
>>>>
>>
de.tremel_computer.abi81.datahandling.PersonenDao$$EnhancerByGuice$$4769627f,

>>>>
>>>> path: /children
>>>> 12:59:03.925 [http-nio-8084-exec-6] ERROR
>>>> o.a.w.serialize.java.JavaSerializer - Error serializing object class
>>>> de.tremel_computer.abi81.pages.PersonenTable [object=[Page class =
>>>> de.tremel_computer.abi81.pages.PersonenTable, id = 1, render count =
1]]
>>>> org.apache.wicket.WicketRuntimeException: A problem occurred while
>>>> trying to collect debug information about not serializable object
>>>> at
>>>>
>>
org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:278)

>>>>
>>>>
>>>>
>>>>
>>>> public class PersonenTable extends B

Re: wicket-guice and recursive injection of non serializable JPA2 objects

2016-06-15 Thread Bas Gooren
Hi Dieter,

Can you share the stack trace of the serialization checker error? Normally it 
points out where in the hierarchy it found a non-serializable object.
My first guess is that you are referencing the dao class somewhere directly 
from your page. The stack trace will prove me right or wrong :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 15 juni 2016 bij 13:29:24, Dieter Tremel (tre...@tremel-computer.de) schreef:

Hello Bas, 

I try to cut small pieces of the code, please tell me if you want to see 
more. 

First the error: 

12:59:03.919 [http-nio-8084-exec-6] WARN 
o.a.w.c.u.o.c.CheckingObjectOutputStream - error delegating to 
writeObject : 
de.tremel_computer.abi81.datahandling.PersonenDao$$EnhancerByGuice$$4769627f, 
path: /children 
12:59:03.925 [http-nio-8084-exec-6] ERROR 
o.a.w.serialize.java.JavaSerializer - Error serializing object class 
de.tremel_computer.abi81.pages.PersonenTable [object=[Page class = 
de.tremel_computer.abi81.pages.PersonenTable, id = 1, render count = 1]] 
org.apache.wicket.WicketRuntimeException: A problem occurred while 
trying to collect debug information about not serializable object 
at 
org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:278)
 



public class PersonenTable extends BasePage { 

@Inject 
private ICachingAbiDataProvider personenProvider; 
... 
} 

public class AbstractProvider extends 
SortableDataProvider<E, String> implements IAbiDataProvider { 

@Inject 
private ReadOnlyDao dao; 
... 
} 

public abstract class JPAReadOnlyDao implements 
ReadOnlyDao { 

private Provider emProvider; 
private final Class entityClass; 

public JPAReadOnlyDao(Class entityClass) { 
this.entityClass = entityClass; 
} 
... 

@Inject 
public void setEntityManagerProvider(Provider 
emProvider) { 
this.emProvider = emProvider; 
} 
... 
} 

public class Abi81GuiceModule extends AbstractModule { 

@Override 
protected void configure() { 
bind(PersistServiceInitializer.class).asEagerSingleton(); 
bind(new TypeLiteral<ReadOnlyDao>() 
{}).to(AbiartikelDao.class); 
bind(new TypeLiteral<ReadOnlyDao>() 
{}).to(PersonenDao.class); 
bind(new TypeLiteral<WritingDao>() 
{}).to(PersonenDao.class); 
bind(new TypeLiteral<ICachingAbiDataProvider>() 
{}).to(CachingAbiartikelProvider.class); 
bind(new TypeLiteral<ICachingAbiDataProvider>() 
{}).to(CachingPersonenProvider.class); 
} 
} 

BasePage creates a SignInPanel that links to a SignIn-Page, that uses 
methods of SignInSession, that makes use a PersonenDao in only in a method. 

I also made a gist: 
https://gist.github.com/tremel/dd9bfa252282b5853d6d464feccaad29 

Thank you 
Dieter 


Am 15.06.2016 um 08:17 schrieb Bas Gooren: 
> Dieter, 
> 
> Since the data provider is inject as a proxy, only the proxy should be 
> serialized. On deserialization it should look up the actual data 
> provider again. 
> 
> Can you share some code so we can see how you set things up? What you 
> are trying is something that should work out of the box - it does for 
> us. 
> 
> Bas 
> 
> Verstuurd vanaf mijn iPhone 
> 
>> Op 15 jun. 2016 om 07:53 heeft Dieter Tremel <tre...@tremel-computer.de> het 
>> volgende geschreven: 
>> 
>> Hallo wicket-user, 
>> 
>> IMHO combining wicket with non serializable objects is a challenging topic. 
>> 
>> On a page I have a DataProvider, that is injected by wicked-guice. 
>> Inside this provider an injected dao is used for fetching the data. 
>> Inside the dao a provider for a JPA2 entity manager (EclipseLink) is 
>> injected. 
>> 
>> Page -> DataProvider -> Dao -> Provider 
>> 
>> Seems to be useful, but since the page is stateful I recognized the non 
>> serializeable error for the dao at the end of page rendering. 
>> 
>> After some code studies I think wicket-guice is only using a proxy for 
>> the DataProvider, the second second and third level of injection is done 
>> only by guice, not handled by wicket-guice and wicket-ioc. This causes 
>> serializable error for dao. Am I right here? wicket-guice is not as 
>> useful as it could be, if it would not be restricted to the fields in 
>> the first level. Setter injection is another topic. The name-pair lets 
>> associate a transparent combination of the two technologies, but it isn't. 
>> 
>> At the moment I have no solution for this. 
>> I still struggle with the right architecture fore using generic JPA2 
>> provided entities on my pages. The only idea so far is not to use guice 
>> and use the application as a link to the non serializable JPA objects 
>> and using detachable models to handle the on pages. 
>> 
>> Any hints for my confused mind welcome. Thanks! 
>> 
>> Dieter Tremel 

- 
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
For additional commands, e-mail: users-h...@wicket.apache.org 



Re: stop wicket from rewriting references in my css file

2016-06-15 Thread Bas Gooren
Sounds like you have enabled the css compressor / rewriter. By default it is 
off.

This assumes that you are letting wicket handle the css (which you do, as you 
mention it is a shared resource).

You are looking for Application#getResourceSettings() and 
(I)ResourceSettings#(get|set)CssCompressor().
It sounds like it is currently set to an instance of CssUrlReplacer in your 
app, as that rewrites all references in CSS.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 15 juni 2016 bij 12:11:12, nino martinez wael (nino.martinez.w...@gmail.com) 
schreef:

Hi 

I currently have an issue where I add a shared css resource, but 
wicket rewrites all references in the resource. I can't seem to find 
the setting to turn of that part of wickets processing? 

-- 
Best regards / Med venlig hilsen 
Nino Martinez 

- 
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
For additional commands, e-mail: users-h...@wicket.apache.org 



Re: wicket-guice and recursive injection of non serializable JPA2 objects

2016-06-15 Thread Bas Gooren
Dieter,

Since the data provider is inject as a proxy, only the proxy should be
serialized. On deserialization it should look up the actual data
provider again.

Can you share some code so we can see how you set things up? What you
are trying is something that should work out of the box - it does for
us.

Bas

Verstuurd vanaf mijn iPhone

> Op 15 jun. 2016 om 07:53 heeft Dieter Tremel  het 
> volgende geschreven:
>
> Hallo wicket-user,
>
> IMHO combining wicket with non serializable objects is a challenging topic.
>
> On a page I have a DataProvider, that is injected by wicked-guice.
> Inside this provider an injected dao is used for fetching the data.
> Inside the dao a provider for a JPA2 entity manager (EclipseLink) is
> injected.
>
> Page -> DataProvider -> Dao -> Provider
>
> Seems to be useful, but since the page is stateful I recognized the non
> serializeable error for the dao at the end of page rendering.
>
> After some code studies I think wicket-guice is only using a proxy for
> the DataProvider, the second second and third level of injection is done
> only by guice, not handled by wicket-guice and wicket-ioc. This causes
> serializable error for dao. Am I right here? wicket-guice is not as
> useful as it could be, if it would not be restricted to the fields in
> the first level. Setter injection is another topic. The name-pair lets
> associate a transparent combination of the two technologies, but it isn't.
>
> At the moment I have no solution for this.
> I still struggle with the right architecture fore using generic JPA2
> provided entities on my pages. The only idea so far is not to use guice
> and use the application as a link to the non serializable JPA objects
> and using detachable models to handle the on pages.
>
> Any hints for my confused mind welcome. Thanks!
>
> Dieter Tremel
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Issue with the FileUploadField

2016-06-14 Thread Bas Gooren
Hi CN,


I would expect it to simply work, as wicket transparently handles this.

So what exactly is unclear for you? Perhaps I can help you with that.


How we do it: we have a panel which contains a form, which in turn contains
a FileUploadField. We have an ajax submit button in the form, and handle
the upload on ajax submit.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13 juni 2016 bij 17:20:28, ChambreNoire (a...@tentelemed.com) schreef:

Hey there,

Little late in the day, but I'm trying to find a working example of a
simple
ajax fileuploadfield to be used within a modal window. A lot of post refer
to
http://www.dooriented.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window/
however this link is dead and I couldn't find a cached version.

If anyone could point me towards a working example I'd really appreciate
that!

Thanks

CN

-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Issue-with-the-FileUploadField-tp1868606p4674879.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Generate css from less for package resources at runtime.

2016-05-25 Thread Bas Gooren
Lars, Martin,


Sorry for hijacking this thread (sort of).


Hmmm, I am 100% sure it was not working for us in a web app we currently
have running.

I just checked which version of wicket-bootstrap-less it uses (version
0.9.11), and that version already has the recursive check on the
last-modified time of imported sources.


I’ll try to do some debugging to see if it really is not working, and if
that’s the case: why it’s not working.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 24 mei 2016 bij 20:25:52, Lars Törner (lars.tor...@gmail.com) schreef:

Thanks Martin, I'll take a look at it!

tisdag 24 maj 2016 skrev Martin Grigorov <mgrigo...@apache.org>:

> Hi,
>
> I checked the code last night and I believe this use case should be
covered
> by
>
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/a64af20bcd65f365dbd487c7480db441fd6b6489/bootstrap-less/src/main/java/de/agilecoders/wicket/less/LessCacheManager.java#L156
> It uses Less4j's APIs to get all imported resources recursively and
> extracts the latest modification time.
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, May 18, 2016 at 3:17 PM, Lars Törner <lars.tor...@gmail.com
> <javascript:;>> wrote:
>
> > Thanks, we'll try this!
> >
> > Cheers
> > Lasse
> >
> > 2016-05-18 13:21 GMT+02:00 Bas Gooren <b...@iswd.nl <javascript:;>>:
> >
> > > Hi all,
> > >
> > > We’ve encountered this issue, too; Simple fix is to touch the less
> file,
> > > even when a secondary file was the only change.
> > >
> > > The root cause is simple: wicket is not aware of any includes in the
> less
> > > file, and as such only looks at the “parent” less file to see if it
was
> > > changed. A potential way to fix this is to make it more intelligent,
> > > assuming the less compiler can expose such details (referenced files,
> > > last-modified time of those files).
> > >
> > > Met vriendelijke groet,
> > > Kind regards,
> > >
> > > Bas Gooren
> > >
> > > Op 18 mei 2016 bij 13:06:59, Martin Grigorov (mgrigo...@apache.org
> <javascript:;>)
> > > schreef:
> > >
> > > Hi Lasse,
> > >
> > > I'll take a look in the coming days!
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Wed, May 18, 2016 at 11:43 AM, Lars Törner <lars.tor...@gmail.com
> <javascript:;>>
> > > wrote:
> > >
> > > > Hi Martin!
> > > >
> > > > We have now implemented this solution and we're using
bootstrap-less
> -
> > > > thanks for that!
> > > >
> > > > But we have a little problem...
> > > > The browser does not recognize when the css has changed, the cause
> > seems
> > > to
> > > > be that the newly generated css is placed in a file with the same
> name
> > as
> > > > before. The name has a hashsum in the name that is generated from
the
> > > > less-file and the less file has not changed.
> > > >
> > > > What happens is:
> > > > A less-variable (put in a separate file) gets a new value.
> > > > This triggers the less compiler to re-generate css
> > > > The name of the file with generated css has the same name as before
> so
> > > the
> > > > browser decides to use its cached version instead.
> > > >
> > > > (I'm not the developer of this issue, but hopefully I got it
> right...)
> > > >
> > > > Any suggestions?
> > > >
> > > > Cheers
> > > > Lasse
> > > >
> > > >
> > > >
> > > > 2016-03-01 13:02 GMT+01:00 Lars Törner <lars.tor...@gmail.com
> <javascript:;>>:
> > > >
> > > > > Thanks for your quick answer Martin! We will look into your
> > suggestions
> > > > > and get back to you if we have more questions!
> > > > >
> > > > > 2016-03-01 11:49 GMT+01:00 Martin Grigorov <mgrigo...@apache.org
> <javascript:;>>:
> > > > >
> > > > >> Hi Lasse,
> > > > >>
> > > > >> I think the easiest would be to save the generated CSS in
memory,
> > e.g.
> > > > in
> > > > >> YourApplication.
> > > > >> Once you receive an update from the other system you should just
> > > delete
> >

Re: AjaxFormValidatingBehavior on component

2016-05-18 Thread Bas Gooren
Uhh, that error message is right there on the AFVB’s onBind(): 

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java#L102

The problem is that the check for a parent form is happening in onBind(), so 
when the behavior is attached to a component.
In other words: you can only add AFVB to a component _after_ you have added 
that component to a Form.

I suspect that the main reason for this is that this behavior is meant to be 
used on a whole form, not a single form component.
Even when you attach it to a single component, it will always validate _all_ 
components in the form.
See 
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java#L117

The OP should probably be using a AjaxFormComponentUpdatingBehavior, adding any 
feedback panels in onUpdate() and onError().

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 18 mei 2016 bij 11:29:26, Sven Meier (s...@meiers.net) schreef:

Hi,  

I cannot find that error message in Wicket's source.  

Are you using org.apache.wicket.ajax.form.AjaxFormValidatingBehavior or  
some subclass or alternative?  

Have fun  
Sven  


On 18.05.2016 02:37, Lon Varscsak wrote:
> Hey guys, I may be missing something here, but if I do:  
>  
> TextField textField = new TextField("keyCode", new PropertyModel<>(  
> order, OrderHeader.SOURCE_KEY_KEY));  
>  
> textField.add(new AjaxFormValidatingBehavior("blur"));  
>  
>  
> * add(textField);*
>  
> I get an error “*AjaxFormValidatingBehavior should be bound to a Form  
> component or a component that is inside a form!*”  
>  
> If I change it to:  
>  
> TextField textField = new TextField(“keyCode", new PropertyModel<>(  
> order, OrderHeader.SOURCE_KEY_KEY));  
>  
>  
> * add(textField);*
>  
> textField.add(new AjaxFormValidatingBehavior("blur"));  
>  
> It works. Basically the AjaxFormValidatingBehavior is expecting to find a  
> form in it’s parent, but it’s parent hasn’t been assigned yet.  
>  
> Is this expected behavior?  
>  
> Thanks,  
>  
> Lon  
>  


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Generate css from less for package resources at runtime.

2016-05-18 Thread Bas Gooren
Hi all,

We’ve encountered this issue, too; Simple fix is to touch the less file, even 
when a secondary file was the only change.

The root cause is simple: wicket is not aware of any includes in the less file, 
and as such only looks at the “parent” less file to see if it was changed. A 
potential way to fix this is to make it more intelligent, assuming the less 
compiler can expose such details (referenced files, last-modified time of those 
files).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 18 mei 2016 bij 13:06:59, Martin Grigorov (mgrigo...@apache.org) schreef:

Hi Lasse,  

I'll take a look in the coming days!  

Martin Grigorov  
Wicket Training and Consulting  
https://twitter.com/mtgrigorov  

On Wed, May 18, 2016 at 11:43 AM, Lars Törner <lars.tor...@gmail.com> wrote:  

> Hi Martin!  
>  
> We have now implemented this solution and we're using bootstrap-less -  
> thanks for that!  
>  
> But we have a little problem...  
> The browser does not recognize when the css has changed, the cause seems to  
> be that the newly generated css is placed in a file with the same name as  
> before. The name has a hashsum in the name that is generated from the  
> less-file and the less file has not changed.  
>  
> What happens is:  
> A less-variable (put in a separate file) gets a new value.  
> This triggers the less compiler to re-generate css  
> The name of the file with generated css has the same name as before so the  
> browser decides to use its cached version instead.
>  
> (I'm not the developer of this issue, but hopefully I got it right...)  
>  
> Any suggestions?  
>  
> Cheers  
> Lasse  
>  
>  
>  
> 2016-03-01 13:02 GMT+01:00 Lars Törner <lars.tor...@gmail.com>:  
>  
> > Thanks for your quick answer Martin! We will look into your suggestions  
> > and get back to you if we have more questions!  
> >  
> > 2016-03-01 11:49 GMT+01:00 Martin Grigorov <mgrigo...@apache.org>:  
> >  
> >> Hi Lasse,  
> >>  
> >> I think the easiest would be to save the generated CSS in memory, e.g.  
> in  
> >> YourApplication.  
> >> Once you receive an update from the other system you should just delete  
> >> the  
> >> cache (entry). I guess you will have to use read lock when serving the  
> >> response and write lock when updating it.  
> >> Wicket uses AbstractResource#dataNeedsToBeWritten()  
> >> <  
> >>  
> https://github.com/apache/wicket/blob/ffa34c6bfbd2ccd8340e23ff1601edd3e0e941d6/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java#L433
>   
> >> >  
> >> method to decide whether the client/browser has the latest version. I.e.  
> >> when the browser makes a request for the CSS you should first check  
> >> whether  
> >> there is a cached entry for this CSS file. If there is no such then  
> >> generate it, save it in the cache and serve it back. If there is such  
> >> cache  
> >> entry then let Wicket check its last modification time against the
> request  
> >> header value for 'If-Modified-Since'.  
> >>  
> >> Additionally you may want to pre-build the CSS resources at application  
> >> start time, or even preserve the current build-time solution, so it is  
> >> faster for the first users of the application before any changes in the  
> >> variables.  
> >> I've had an issue with similar setup in the past - we were using CDN  
> >> (Akamai) and their request timed out while waiting for the Less  
> >> compilation. For requests from normal browsers this shouldn't be a  
> problem  
> >> though.  
> >>  
> >> You may also check Wicket Bootstrap Less  
> >> <  
> >>  
> https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-less  
> >> >.  
> >> It is a module of Wicket-Bootstrap project but could be used without the  
> >> other modules.  
> >> It provides most of the features you need. You just need to see how to  
> >> plug  
> >> the update of the variables.
> >>  
> >> Martin Grigorov  
> >> Wicket Training and Consulting  
> >> https://twitter.com/mtgrigorov  
> >>  
> >> On Tue, Mar 1, 2016 at 10:45 AM, Lars Törner <lars.tor...@gmail.com>  
> >> wrote:  
> >>  
> >> > Hi!  
> >> >  
> >> > We would like to be able to set new colors in our gui at runtime, i.e.  
> >> > change the theme.  
> >> > We use less on component basis. To day we compile the less files to  
> css  
> 

Re: Generating table header ids for multiple tables pe rpage

2016-05-17 Thread Bas Gooren
Hi Thorsten,

Yeah, wicket is beautiful haha! Whenever I encounter a tricky problem, I always 
find a nice and clean way to handle it with wicket.
One of the reasons it is my framework of choice.

Regarding the transformer behavior: yeah, that is probably a good fit for you.

On another note: why not simply use a data table and manage everything in java 
code?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 15 mei 2016 bij 20:01:15, Thorsten Schöning (tschoen...@am-soft.de) schreef:

Guten Tag Thorsten Schöning,  
am Sonntag, 15. Mai 2016 um 11:14 schrieben Sie:  

> So next I will have a look at extending  
> AbstractTransformerBehavior with its "tranform" method.  

Hi,  

this was far easier to use, beautiful Wicket... Sadly I saw it too  
late and wasted quite some hours on the former approach. :-)  

Mit freundlichen Grüßen,  

Thorsten Schöning  

--  
Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de  
AM-SoFT IT-Systeme http://www.AM-SoFT.de/  

Telefon...05151- 9468- 55  
Fax...05151- 9468- 88  
Mobil..0178-8 9468- 04  

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln  
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow  


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Generating table header ids for multiple tables pe rpage

2016-05-14 Thread Bas Gooren
Hi Thorsten,

Can you show us some code (html and java) - perhaps as a github gist or 
similar? It’s not 100% clear to me what you are asking.

For page-unique ids, simply let wicket render the components and call 
setOutputMarkupId(true).
If you want to control the ids yourself, cal setMarkupId(String id).

Regarding the “headers” attribute: simply override onComponentTag in your table 
component, and change the headers attribute as you want; This way you don’t 
have to add an AttributeModifier, and don’t have to think of it.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14 mei 2016 bij 08:18:07, Thorsten Schöning (tschoen...@am-soft.de) schreef:

Hi all,  

I have a page where one and the same table (in terms of markup) is  
rendered multiple times with different data at the same time, simply  
underneath each other. The markup uses "id" and "headers" attributes,  
but with static values in the markup and with multiple instances of  
the table this is wrong of course, because ids need to be unique  
across a whole page, not only across a single table.  

In terms of Wicket the tables itself are rendered using IDataView with
the table markup coming from a panel. The rows of the table are  
rendered using IDataView as well and each cell is e.g. a simple Label  
component.  

With each cell being a Label, I could add an AttributeReplacer or sich  
replacing the static "headers" from the markup with some generic  
value. But I would like to avoid the need to think of this for every  
table and a more generic approach. Additionally, the "thead" of the  
table with the column headers and ids is no wicket component  
currently, but I would need to make each column header one to be able  
to change the "id" using an AttributeReplacer as well.  

So is there some easy, somewhat clean way to change the markup of a
component instance before it is used for rendering and produce some  
page unique ids in it?  

Thanks!  

Mit freundlichen Grüßen,  

Thorsten Schöning  

--  
Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de  
AM-SoFT IT-Systeme http://www.AM-SoFT.de/  

Telefon...05151- 9468- 55  
Fax...05151- 9468- 88  
Mobil..0178-8 9468- 04  

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln  
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow  


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Which model to use for forwarding form processing results?

2016-05-10 Thread Bas Gooren
Thorsten,

Yes, that is normal behavior I think - for invisible components we either wrap 
it in a container which receives the event, or let the page be the coordinator.

Invisible components also don’t receive clicks on links etc, so I think this 
was done to be consistent.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 mei 2016 bij 19:48:48, Thorsten Schöning (tschoen...@am-soft.de) schreef:

Guten Tag Bas Gooren,  
am Dienstag, 10. Mai 2016 um 13:43 schrieben Sie:  

> This sounds like a good use-case for an event.  

Thanks for this hint, I totally forgot about it and decided to give it  
a try. There was a pitfall in my case, though: 
Component.canCallListenerInterface  
is asked before an event is dispatched and I'm starting with an  
invisible panel, so the method returns false, waiting for data to  
become visible, which is never dispatched... Doesn't seem to be  
mentioned in the docs or I must have missed it.  

Mit freundlichen Grüßen,  

Thorsten Schöning  

--  
Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de  
AM-SoFT IT-Systeme http://www.AM-SoFT.de/  

Telefon...05151- 9468- 55  
Fax...05151- 9468- 88  
Mobil..0178-8 9468- 04  

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln  
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow  


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Which model to use for forwarding form processing results?

2016-05-10 Thread Bas Gooren
Hi Thorsten,

This sounds like a good use-case for an event.

You can have the form broadcast an event to the page, and let any component 
that needs to redraw based on the data handle that event. This provides a nice 
decoupling between the form result and 0…n other components in your page that 
need the data.

The components handling the event then also don’t need to know where the event 
originated.

For more info, see the wicket guide; the info is under chapter 17.2, scroll 
down to “Wicket events infrastructure”.
https://ci.apache.org/projects/wicket/guide/6.x/guide/advanced.html#advanced_2

And a bonus tip: you can use the wicketstuff-annotationeventdispatcher jar to 
make your life even easier. Just include it in your project (it will 
automatically register itself in wicket), and then you can annotate any public 
component method in your page with @OnEvent, for example:

@OnEvent
public void onFormDataSubmittedEvent(FormDateSubmittedEvent event) {
… impl
}

It’s actually a great way to handle data-passing in pages.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 mei 2016 bij 08:54:14, Thorsten Schöning (tschoen...@am-soft.de) schreef:

Hi all,  

I have one and the same form on different pages used to provide some  
input data which is afterwards used by the form's onSubmit handler to  
request some complex data structure from a 3rd party service. This  
result needs to be forwarded to the caller/owner of the form, mainly  
pages, so those can provide the data to different views focussing on  
different aspects of the data. Most of those views are panels using  
different DataViews to provide data in HTML tables in the end.  

The important thing is that the form shouldn't render the results  
itself, only return some raw data structure, and the panels shouldn't  
need to know about the form as well.  

What is the best way to send those resulting data around?  

From my understanding it's not the default model of the form with all  
the convert input stuff, those input comes from the user, but it may  
be that of the page containing form and panels, so both could access  
the page and its default model. Else I could simply create a model  
instance and forward it using the CTORs of the form and panels,  
without (misusing?) the page's default model.  

Does it even matter at all?  

Thanks!  

Mit freundlichen Grüßen,  

Thorsten Schöning  

--  
Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de  
AM-SoFT IT-Systeme http://www.AM-SoFT.de/  

Telefon...05151- 9468- 55  
Fax...05151- 9468- 88  
Mobil..0178-8 9468- 04  

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln  
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow  


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org  



Re: Issue with serialization of a page

2016-03-10 Thread Bas Gooren
Hi Daniele,

In general I would not rely on a page not being serialized, as you have no 
control over the timing of serialization :-)

We always generate a UUID for each object we need to track and store it in 
global state (e.g. a static final ConcurrentHashMap<UUID, ClassOfObjectWeTrack> 
on the page or application).

The page then needs to store the UUID so it can locate the actual object in the 
global state map.

What’s important is to handle cleanup properly:
- clean up the map item after usage, or
- clean up map items after a certain timeout, or
- clean up map items (oldest first) after the map reaches a certain size

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 maart 2016 bij 10:04:53, Daniele IPPOLITI (daniele.ippol...@amadeus.com) 
schreef:

 

Hello,

I would like to write you because I’m migrating since wicket 1.4.X to wicket 
7.X, but I’m facing a problem that I was not facing before:

 

In the onSubmit of AdvancedSearchForm, the class set the next page creating 
MultiAvailResultPage

 



 

In the initiate of MultiAvailResultPage we have used a Future variable

 


 

 

When we need to show the page to the user we call:

 



But this time future is not any more containing the original value but is 
null!!! This because the variable is declared transient and we passed through a 
serialization that apparently before we were not. Do you have explanations to 
that? Maybe something changed between the old version? Idea on how to solve it? 
(even creating a detachable model it seems not solving the issue because the 
Future variable doesn’t have any id that I can keep to retrieve it after the 
serialization.

 

The two classes are attached to the mail if you need to have a deeper look.

Your help it will be really appreciated.

Kind regards,
___
Daniele Ippoliti
Software Engineer, PMP ®

R

Amadeus SAS
Phone: +33 (0) 4 97042180
daniele.ippol...@amadeus.com


 


-  
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
For additional commands, e-mail: users-h...@wicket.apache.org

  1   2   3   >