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

Re: Wicket 6.16 problem with popup window to the front by IE11

2016-03-04 Thread Bas Gooren
Hi Harry,

What exactly is the problem? Is the popup not rendering at all in IE11?

Have you checked the javascript console to see if there is a javascript problem?

Your code is mostly about redirecting (or rendering) to a url for a manual; Is 
that part not working in IE11?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 4 maart 2016 bij 11:42:20, Harry (hkl...@csc.com) schreef:

Hi all,  

I’m new in this forum and I am no expert on wicket.  
I try to get a popup window to the front at the browser IE11,  
with Firefox and Chrome it works.  
I open the popup window with an item "*HELP*" from a  
Choicebox. Here the code:  

public class SwitchAboutChoice extends DropDownChoice {  
private static final long serialVersionUID = 1L;  

private final Logger log =  
LoggerFactory.getLogger(SwitchAboutChoice.class);  

@SuppressWarnings("unused")  
private final CHOICE currentChoice = CHOICE.INFO;  

private class ChoiceRenderer implements IChoiceRenderer {  
private static final long serialVersionUID = 1L;  

@Override  
public Object getDisplayValue(CHOICE c) {  
return new StringResourceModel("HIST." + c.name(),  
SwitchAboutChoice.this, null).getString();  
}  

public String getIdValue(CHOICE c, int arg1) {  
return c.name();
}  
}  

public SwitchAboutChoice(String id, final PtsModal modalAbout, final  
ICommonWebSession iws) {  
super(id);  
this.setDefaultModel(new PropertyModel(this, "currentChoice"));  
setOutputMarkupId(true);  
setChoices(Arrays.asList(CHOICE.values()));  
setChoiceRenderer(new ChoiceRenderer());  
add(new AjaxFormComponentUpdatingBehavior("onchange") {  
private static final long serialVersionUID = 1L;  

@Override  
protected void onUpdate(AjaxRequestTarget target) {  
log.debug("AboutChoice update: {}", getModelObject().name());  
switch (getModelObject()) {  
case HELP:  
// Makes the pop-up window RESIZABLE  
PopupSettings popup = new PopupSettings("_blank",  
PopupSettings.RESIZABLE);  

//Generates URL only dependent on the current base Url  
popup.setTarget("'"+  
RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(iws.getManualUri())+"'");
  

target.appendJavaScript(popup.getPopupJavaScript());  

break;  

case ABOUT:  
if (target != null) {  
………..  
}  
break;  

default:  
break;  
}  
setModelObject(CHOICE.INFO);  
target.add(SwitchAboutChoice.this);  
}  
});  

setNullValid(false);  
}  
}  

Can anyone help here?  
Kind regards  
Harry  


--  
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-problem-with-popup-window-to-the-front-by-IE11-tp4673821.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: Wicket model problem

2016-02-19 Thread Bas Gooren
Hi,

I think the only way to track this is with custom code (or with aspects for 
example).

Since the contract of IModel only has detach() (and not isDetached()), this 
cannot be tracked easily.

What I would do in such a case is probably to add a requestcyclelistener which 
walks a page after a request, iterates (/visits) over all the components and 
checks their models.
Of course this requires the models to expose a way to check their status and 
origin.

Also, what we do to prevent this: we have an abstract base model called a 
AbstractConversionModel which takes a parent model (S) and converts to a 
target type (T), caching the conversion.
This model takes a parent model as input (and subclasses of it require a java 8 
Function or expose an abstract method for the conversion etc).
This model also takes care of detaching the parent model.

In the end it’s all about education I guess: programmer’s should be careful 
when chaining models and ensure they detach the parent (/chained) model.

Met vriendelijke groet,
Kind regards,

Bas

Op 19 februari 2016 bij 15:41:03, gmparker2000 (greg.par...@brovada.com) 
schreef:

Thanks for the reply. I suspect this is exactly the case we have created for  
ourselves. Although we have a good grasp on the detach process I suspect  
that there are places where this rule of thumb is not being followed.  
Although the example I gave is somewhat fictitious, any of the LDMs we have  
in our framework perform a detach on the parent. In the form there are  
numerous places where adhoc anonymous models are created and this is  
probably where the problems occur. Is there a recommended way to track  
these down? I ended up recompiling a version of Wicket with changes to  
LoadableDetachableModel that would essentially track every LDM within a  
RequestCycle. At the end of a request cycle I was left with a list of the  
models that never got detached. I also added a "whereAmI" member variable  
to LDM that would capture the stack trace in the constructor so I could  
figure out who instantiated the model in the first place.  

--  
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-model-problem-tp4673620p4673664.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: Wicket model problem

2016-02-19 Thread Bas Gooren
Hi!

Perhaps this is stating the obvious since it looks like you know what you are 
doing, but just to be sure:

Does your LoadableDetachableExpressionModel call detach on its “parent” model? 
This is the most frequently occurring source of model leaks I have seen.
Since the last model in the chain is usually attached to a component, that 
model gets detached, but if your “child” model does not call detach on the 
“parent” model and the “parent” model is not attached to a component, it will 
never get detached.

Which model in your example is not getting detached without your override of 
onDetach() in MyPanel? Does it happen to be “abc”?

Met vriendelijke groet,
Kind regards,

Bas

Op 19 februari 2016 bij 15:18:41, gmparker2000 (greg.par...@brovada.com) 
schreef:

It's hard to give specifics as the form is very complex. I do have a general  
example of a pattern prevalent throughout the form. The pseudo code goes  
something like this:  

// Page  
class MyPage extends Page {  
onInitialize() {  
Panel p = PanelFactory.createPanel("myPanel", "myObject");  
this.add(p);  
}  
}  

// Factory for creating panels that use a document cache based loadable  
detachable  
// model  
class PanelFactory {  
Panel createPanel(String panelName, String cachedObjectName) {  
// uses the document name to retrieve doc from the cache using it's  
name  
DocumentCacheLDM ldm = new DocumentCacheLDM(cachedObjectName);  

// return a panel initialized with the model  
if ("myPanel".equals(panelName)) {  
return new MyPanel(ldm);  
}  

  
}  
}  

// Panel  
class MyPanel extends Panel {  

MyPanel(final IModel cacheLDM) {  

// create an LDM that uses the cache LDM and an expression. Note  
that it is marked final  
// so it can be used in the list panel below  
final LoadableDetachableModel abc = new  
LoadableDetachableExpressionModel(cacheLDM, "a.b.c");  

// another one based on abc  
LoadableDetachableModel def = new  
LoadableDetachableExpressionModel(abc, "d.e.f");  

// create a panel for DEF object  
Panel subPanel = new SubPanel(def);  
this.add(subPanel);  

// create a model for a repeating list of GHI  
LoadableDetachableModel ghi = new  
LoadableDetachableExpressionModel(abc, "g.h.i");  

// create a repeating section for GHIs  
ListPanel listPanel = new ListPanel("listPanel", ghi) {  
@Override  
public Component createItemComponent(String id, IModel  
model, Item item) {  
return new GHIPanel(id, model, isReadonly, mode);  
}  

@Override  
public void addItem(AjaxRequestTarget target) {  
// uses abc model from above to add the new GHI  
abc.getObject().addNewGHI();  
}  

@Override  
public IModel getItemModel(GHI item) {  
// create an LDM for the GHI item that might use the items's  
id internally  
// to load  
return new LoadableDetachableExpressionModel(abc, item);  
}  

@Override  
public void removeItem(GHI item, AjaxRequestTarget target) {  
abc.getObject().deleteGHI(item);  
}  
}  

this.add(listPanel);  
}  
}  


This pattern, in our case, seems to end with a bunch of models that never  
get detached. Therefore on subsequent request we end up with some parts of  
the form reattached to the document from the cache and other parts attached  
to orphaned transient models from their unattached models. Then when you  
submit the form the components that are attached to the cached object update  
the correct model object but the ones that didn't get detached properly  
update the orphaned model objects. So we end up with data lose. To get  
this working we changed the MyPanel class to something like this:  

// Panel  
class MyPanel extends Panel {  

private LoadableDetachableModel abc;  
private LoadableDetachableModel def;  
private LoadableDetachableModel ghi;  

void onDetach() {  
abc.detach();  
def.detach();  
ghi.detach();  
}  

MyPanel(final IModel cacheLDM) {  

// create an LDM that uses the cache LDM and an expression  
abc = new LoadableDetachableExpressionModel(cacheLDM, "a.b.c");  

// another one based on abc  
def = new LoadableDetachableExpressionModel(abc, "d.e.f");  

// create a panel for DEF object  
Panel subPanel = new SubPanel(def);  
this.add(subPanel);  

// create a model for a repeating list of GHI  
ghi = new LoadableDetachableExpressionModel(abc, "g.h.i");  

// create a repeating section for GHIs  
ListPanel listPanel = new ListPanel("listPanel", ghi) {  
@Override  
public Component createItemComponent(String id, IModel  
model, Item item) {  
return new GHIPanel(id, model, isReadonly, mode);  
}  

@Override  
public void addItem(AjaxRequestTarget target) {  
// uses abc model from above to add the new GHI  
abc.getObject().addNewGHI();  
}  

@Override  
public IModel getItemModel(GHI item) {  
// create an LDM for the GHI item that might use the items's  
id internally  
// to load  
return new LoadableDetachableExpressionModel(abc, item);  
}  

@Override  
public void removeItem(GHI item, AjaxRequestTarget target) {  
abc.getObject().deleteGHI(item);  
}  

Re: ResourceFinders - order of looking into folders for resource

2016-02-11 Thread Bas Gooren
Hi Marieke,

I see that ResourceSettings exposes method getResourceFinders() which returns a 
List.
Assuming that’s where you register your custom finder, isn’t the easy solution 
to simply add it to the top of the list?

E.g. add(0, yourFinder) instead of add(yourFinder)?


Met vriendelijke groet,
Kind regards,

Bas

Op 11 februari 2016 bij 12:11:46, Marieke Vandamme (marieke.vanda...@tvh.com) 
schreef:

​Hi,  

​We work with an extra ResourceFinder a lot, so that we can modify html  
when webapplication is already running.  
Now I want to change the html from a library, but the html is still in the  
library. I can not remove it from there.. Is there some way I can override  
this existing html, without removing it from the library? Something like  
defining a ResourceFinder as the first to look from?  
Thanks for any help ! Kind Regards, Marieke Vandamme  

--  


 DISCLAIMER   

http://www.tvh.com/glob/en/email-disclaimer  

"This message is delivered to all addressees subject to the conditions  
set forth in the attached disclaimer, which is an integral part of this  
message."  


Re: Listing on http://builtwithwicket.tumblr.com/

2016-02-08 Thread Bas Gooren
Hi Martin,

I’ve just resubmitted it (and got the “Thank you! Your submission has been 
received and is awaiting moderator approval.”-screen, just like last time…).

Thanks!

Met vriendelijke groet,
Kind regards,

Bas

Op 8 februari 2016 bij 14:04:58, Martin Grigorov (mgrigo...@apache.org) schreef:

Hi Bas,  

There was no notification from Tumblr for new entries for approval the last  
few months.  
Please re-post!  
Thank you!  

Martin Grigorov  
Wicket Training and Consulting  
https://twitter.com/mtgrigorov  

On Mon, Feb 8, 2016 at 1:58 PM, Bas Gooren <b...@iswd.nl> wrote:  

> Hi all!  
>  
> We submitted one of our websites to the “Built with wicket” Tumblr a short  
> while ago but never heard back. Is it still maintained?  
>  
> Met vriendelijke groet,  
> Kind regards,  
>  
> Bas  


Listing on http://builtwithwicket.tumblr.com/

2016-02-08 Thread Bas Gooren
Hi all!

We submitted one of our websites to the “Built with wicket” Tumblr a short 
while ago but never heard back. Is it still maintained?

Met vriendelijke groet,
Kind regards,

Bas

Re: DateTimeField AJAX DatePicker not work

2016-02-04 Thread Bas Gooren
Hi Christopher, Martin,

I just did a quick debug, and it’s caused by the inline enclosure. When I 
replace that with a WebMarkupContainer, and manage the visibility of that 
element, everything works as expected.

See my gist here: https://gist.github.com/bgooren/11602fa0d786548bfd70

We’ve had some unexpected issues with inline enclosures in the past, which is 
why I usually use explicit containers.

In any case: the DatePicker behavior does not get it’s renderHead() method 
called once the second DateTimeField becomes visible, and it is inside the 
inline enclosure. Why that is the case requires more debugging. My gist 
provides a solution in the meantime.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3 februari 2016 bij 23:41:21, Martin Grigorov (mgrigo...@apache.org) schreef:

Hi,  

I don't have time to debug this problem now but I'll try to do it early  
next week.  
Please create a ticket in JIRA so it won't get forgotten! Thanks!  

Martin Grigorov  
Wicket Training and Consulting  
https://twitter.com/mtgrigorov  

On Tue, Feb 2, 2016 at 2:02 PM, Christopher Auth <a...@hexix.de> wrote:  

> Hi,  
> I have some problems with the  
> org.apache.wicket.extensions.yui.calendar.DateTimeField. In the  
> constructor I set the visibility to false. Ajax redraw, when a checkbox  
> is clicked, the DateTimeField is marked as visible. As far as everything  
> works. Only then I can't open the DatePicker of the second DateTimeField.
>  
> An example is below https://github.com/ChrAu/wickettest  
> to find.  
>  
> I have test it with Wicket 6.19/6.22/7.2  
>  
> Regards  
> Christopher  
>  
> -  
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org  
> For additional commands, e-mail: users-h...@wicket.apache.org  
>  
>  


Replacement for MarkupContainer#get and MarkupContainer#swap

2016-01-25 Thread Bas Gooren
Hi All,

Since wicket 7 I see that index-based methods in MarkupContainer have been 
deprecated.

We use those methods in some of our list editors - components that allow 
editing of lists of entities inside a form which provides ordering (move an 
item up & down).
The beauty of the current methods is that we easily have very fast re-renders 
of complex editors, since we can swap the items on the server-side, and swap 
them on the client side too, and don’t have to rerender the entire list 
component.

I know wicket 8 is quite a while away still, but would like to know what the 
preferred way of building such editors will be when wicket 8 comes out.
Since it will not be possible anymore to access elements by index and swap 
them, the only alternative we see is to re-render the entire list component - 
which means it will also have to be a “soft” form submit to not lose any input.

Any ideas?

Met vriendelijke groet,
Kind regards,

Bas

Re: Accessing WebApplication from the service layer

2014-02-03 Thread Bas Gooren
Well, you can either store it as application metadata or make your 
locking service implementation a singleton (managed by your dependency 
injection framework of choice).


Either way, you abstract away the exact storage location of your locks 
behind the facade of your EntityLockingService.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef ChambreNoire op 3-2-2014 14:48:

Hello,

OK so no storing my MapString, EntityLock in the Application MetaData
then?

Many thanks,

Chambre

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Accessing-WebApplication-from-the-service-layer-tp4664145p4664147.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: AjaxLazyLoadPanel loading asynchronously

2014-02-03 Thread Bas Gooren

Hi,

When your page gets serialized (which can happen between requests), 
transient fields (like the future field) are set to null.
When your behavior is triggered and the page is deserialized, the field 
is null.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef vp143 op 3-2-2014 15:16:

I cannot get future here
(https://gist.github.com/jonnywray/636875#file-futureupdatebehavior-java-L31)
to have a value.
I do not understand when/how it gets deserialized?


Martin Grigorov-4 wrote

Because it is transient:
https://gist.github.com/jonnywray/636875#file-futureupdatebehavior-java-L19
After deserialization it will be null.

Martin Grigorov
Wicket Training and Consulting



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadPanel-loading-asynchronously-tp4664035p4664151.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: XSS in wicket. Wicket fault or my fault?

2014-01-30 Thread Bas Gooren

Hi!

You can also replace your Label's model with a StringResourceModel.

See 
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/model/StringResourceModel.html


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Gonzalo Aguilar Delgado op 30-1-2014 11:17:

Hi Martin,

This is how I've done it.

label = new Label(message, getString(main.message, new 
ModelWebUser(authSession.getUser(;

label.setOutputMarkupId(true);


And in the MainTmsPage.properties I have:

main.message=Hello b${realName}/b.br Welcome to the 
Technoactivity Payment Solutions main page.



And it worked!


El 30/01/14 10:03, Martin Grigorov escribió:

Hi,

On Wed, Jan 29, 2014 at 6:26 PM, Gonzalo Aguilar Delgado 
gagui...@aguilardelgado.com wrote:


Hi there,

I'm building an application for a client and my security advisor 
told me

about a XSS attack that can be performed on the site.

When user logs-in I welcome they by Saying Hello user.

div class=thumbnail
 p wicket:id=message
 Hello ${realName}.


How do you substitute the value of ${realName} ?
Wicket doesn't support such placeholders.

The Wicket syntax would be: Hello span wicket:id=realName/span.
Together with: page.add(new Label(realName, Some Name);



 Welcome to the Synapse web.
 /p
 /div


As you can see I use I18N so this is not the real text that will 
show up,

but's similar.

I used to think that wicket validated output before building web but 
the
white hat hacked it by just putting a fake name into the database. 
Too easy

for me...

The content of realName is:

'';!--SCRIPTalert('XSS')/SCRIPT={()}


So I ended with:

Hellob'';!--scriptalert('XSS')/script=amp;{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate
everything that goes to the database. But it should be a better 
solution.


Can you point me to right one?



Best regards,






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






Re: a little question about add(new XComponent(id).setVisible(false))

2013-12-16 Thread Bas Gooren
I think it's fine to change the hierarchy in onBeforeRender(), as long 
as you do it before calling super.onBeforeRender(), since that calls OBR 
on the children of your panel.
And (you gotta love wicket), this is even made explicit in the source 
code of MarkupContainer#onBeforeRender():


/**
 * Called just before a component is rendered.
 * p
 * strongNOTE/strong: If you override this, you *must* call 
super.onBeforeRender() within

 * your implementation.
 *
 * Because this method is responsible for cascading {@link 
#onBeforeRender()} call to its
 * children it is strongly recommended that super call is made at 
the end of the override.

 * /p
 */

Before we had onInitialize, we would use onBeforeRender() and a boolean 
guard variable (boolean initialized) to accomplish the same thing.


Conclusion, it's fine, as long as you call super.onBeforeRender() at the 
end of your method.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Decebal Suiu op 16-12-2013 16:50:

I tested with:

public class MyPanel extends Panel {

public MyPanel(String id) {
super(id);  
}

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

add(new MyLabel(l1, Label 1));
add(new MyLabel(l2, Label 2));
add(new MyLabel(l3, Label 3));
  }

}

in MyPanel, where MyLabel extends Label with the constructor contains and
debug message:

public MyLabel(String id, String label) {
super(id, label);

System.out.println(MyLabel.MyLabel(): + id);
}

And yes, the MyLabel constructed is not called if MyPanel is not visible.

My impression was that in onBeforeRender I cannot change the hierarchy (add
children).

The 100 children was a random number that show you that my panel contains
many components :)

Thanks,
Decebal




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041p4663045.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





Thanks!

2013-12-06 Thread Bas Gooren

Hi *,

I have to say, the more I work with wicket, the happier I become. A big 
thank you! to both the excellent developers and those helping others 
on the mailing list! Wicket is a truly amazing piece of kit.


Having recently played with a number of other frameworks for real 
production apps, wicket continues to impress me. Even after using it for 
years in rather big projects.

I love the whole less magic is better-attitude and configurability.

--

Met vriendelijke groet,
Kind regards,

Bas Gooren



Re: Optional wrapping H1 tag

2013-11-23 Thread Bas Gooren

I'd do it like this:

h1 wicket:id=logo-h1
a wicket:id=logo-home.../a
/h1

add(new WebMarkupContainer(logo-h1) {
void onConfigure() {
super.onConfigure();
setRenderBodyOnly(!getPage().getClass().equals(Homepage.class));
}
}.add(new Link...));

In other words: only render the H1 body when not on the homepage.
setRenderBodyOnly() allows you to control if a tag should be fully 
rendered, or just it's body.


onConfigure() can be overriden to update a components settings whenever 
it is about to be rendered.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Scott Carpenter op 22-11-2013 19:24:

Suppose you have a web site with a logo in the header which links to the
home page. On the home page itself, you have the same logo and the link,
but you also want to wrap the logo with an H1 tag.

(Or maybe it's not that you have a burning desire to do this, but your
client has requested it.)

In my Wicket inexperiencedness, I might try this:

wicket:enclosure child=homePageHomeLink
   h1a wicket:id=homePageHomeLink title=Home href=#ABC,
Inc./a/h1
/wicket:enclosure
wicket:enclosure child=homeLink
   a wicket:id=homeLink title=Home href=#ABC, Inc./a
/wicket:enclosure

And then on the Java side, set one or the other to be invisible.

That works, but I'd like to know if there's a better way.

Thank you!





Re: Session invalidation and background thread

2013-11-23 Thread Bas Gooren

Hi,

I guess it depends on the lifecycle of those threads how I would handle 
this.
Suppose the session is invalidated and destroyed, what should happen to 
the threads? Do they continue (A) or do they need to stop (B)?


A) In this case I would not depend on the session at all, if possible. 
Simply copy the OAuth token to a private variable in your threads.


B) Instead of the threads polling to see if the session is still 
there, I'd turn things around. Keep track of sessions-and-their-threads 
somewhere. Register a session invalidation listener, and when the 
session is invalidated, you can run some code to neatly stop and clean 
up your threads.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Marios Skounakis op 22-11-2013 23:45:

Hi all,

This is maybe a Spring question but as my app is a wicket app and I use
this list regularly and everyone is very helpful I thought I'd ask here
first.

I have a RequestCycleListener which during onBeginRequest() conditionally
spawns some background threads and runs them using an Executor. These
threads need access to an oauth token which is stored in the session. So I
create my threads in the RequestCycleListener, give them a reference to the
wicket session and run them in the background thread. The threads also have
a reference to Spring's session (via spring's
RequestContextHolder.getRequestAttributes()/setRequestAttributes()).
Actually the dependence on spring session is much harder to alleviate as
they often need to access session scoped beans.

I'm wondering what exactly happens if I try to invalidate the session (e.g.
when the user logs out) while such a background thread is running. Is there
a possibility for harmful side-effects?

Should I consider adding code to my threads to periodically check that the
session is still valid? After all they do have a reference to the session
object, so this sounds feasible.

If it matters at all, I'm using Tomcat.

Thanks in advance,
Marios





Re: Java EL for Wicket

2013-11-21 Thread Bas Gooren

Hi Steve,

Thanks for sharing!

As longtime wicket users we are doing something similar.
We have the notion of a page context to which components can 
contribute data (it's a simple mapString, Object) by implementing an 
interface (PageContextContributor).

A component can then either:
- add an InlineContextLabel, which will replace expressions in it's body 
using the page context, or
- add an InlineContextMarkupContainer, which can serve as a parent to 
wicket:message tags, so they can resolve properties in the page context


The reason we have started using this in more recent projects is that we 
didn't like the split you get once you have pages (or components) which 
have localized html files, but also contain some dynamic content: 
labels with property replacement.
Before using our above solution, we would have some of the content in 
properties files, and some in the localized html files. Now we can have 
a lot more of the localized stuff directly in the html files.


I'll have a look at your code.

Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Steve op 21-11-2013 12:05:

This will probably horrify some of the wicket dev team.  It's probably
not the 'wicket way'.  But I've been using wicket for years and there's
plenty of thing you can do in many different ways but a few things that
you just can't.

An incidental but very useful part of this package in a Renderer class.
It's an extension of wicket's ComponentRenderer that allows you to
Render components without having to create a wicket application.  If you
do happen to be inside a wicket application when you invoke it no
problem.  But with the wicket version you have no choice.  So for a
quick and dirty HTML output it lets you go with 2 lines of code:

Renderer.init();
String html = Renderer.renderComponent(myPanel).toString();

The main part of the package is an integration of JUEL with wicket
allowing you to put Java Expression Language into your markup which will
be evaluated just before the wicket rendering cycle.  It might seem odd
but I've wished this was part of wicket for years.  There's many times
when I just want to populate a html element with a bean property and it
gets a bit tedious having to add it in both markup and code.  It also
makes dynamic markup generation a lot easier given that your generator
only needs to spit out HTML for many purposes and doesn't need to
generate java code as well.

The wicket version would be something like this:

markup:
span wicket:id=label1 color=red/span span
wicket:id=label2/span

code:
add(new Label(label1, bean.getFirstName())
.add(AttributeModifier.replace(color, new Model(green) {
 public String getObject() {
 bean.getColor();
 }
}));
add(new Label(label2, bean.getLastName());

The EL version would be simply:more

span color=bean.color${bean.firstName}/span
span${bean.lastName}/span

No code needed at all if 'bean' is a property of the Component.
Otherwise you can just add a single line:
setELBaseObject(bean);

then the above html becomes even simpler:
span color=color${firstName}/span span${lastName}/span

All the magic of wicket is retained.  But with a much neater way of
adding simple values to markup.

The code is model aware.  If any part of an expression evaluates to a
wicket model it will be unwrapped before the rest of the expression is
evaluated.  So all the model magic is also retained and models can be
used to achieve anything particularly fancy needed for an evaluation.

Currently the code is split into two behaviours.  The first part enables
modifiable markup.  If you want a simple way to interfere with markup
before wicket gets to it you can use this behaviour on it's own by
overriding a single method: String modifyMarkup(String).  The second
part is the EL implementation (which uses the JUEL library).  Both are
implemented using the behaviour pattern because there's no common parent
class to inject this behaviour into the Component class heirarchy.
Currently there's implementations for Panel, ListView and Page but
looking at those an example should give you an idea how to add the
behaviour to other component types.

Be warned the code is very fresh so is likely got a few bugs and I have
fairly hefty TODO list.  But I intend using it for a couple of projects
I'm working on so it should be getting plenty of developer love in the
near future.  I'm the first to admit it's a bit hacky in the way it
hooks into the wicket lifecycle.  Wicket really doesn't make it easy to
intercept markup.  With luck the dev team won't hate this idea too much
and might provide some neater hooks in future versions of the API.

You can find it here: https://bitbucket.org/shadders/wicket-el



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





Re: Wicket Components as Class Members

2013-11-09 Thread Bas Gooren
Since the original question was about storing component references as 
class members, let me answers how we handle that in our shop.


Wicket serializes stateful pages anyway, so any component references 
within the page don't hurt (at all). It's just a 4-byte reference to an 
object wicket already references (through the component hierarchy).
As for stateless pages it matters even less, as they are not serialized 
at all (so only a 4-byte reference per component uses some memory).


I think the most important rules regarding serialization are:
- don't reference other pages or components within those pages
- don't reference large object (use loadable detachable models instead)

Like an earlier reponse to this question said: referencing components by 
their (string) id within the page is quite ugly. not to mention it 
breaks quite easily.


We use component references extensively (e.g. when the visibility of one 
component depends on the state others), and have never encountered any 
problems.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef meduolis op 8-11-2013 17:20:

The only thing I googled related to final and wicket is this:

7. Java nuances — There are two Java nuances that catch many Wicket
newcomers off-guard.


1. The first is serialization. Wicket uses Java serialization to store the
state of your component hierarchy (the page and all its components and their
components and so-on) in memory or on disk between page requests. This means
you need to be careful because things can get serialized by accident. The
most common cause of this is declaring a variable final outside of an
anonymous inner class and then using it inside that anonymous inner class.
Doing this causes the compiler to add a member variable to the anonymous
inner class. If that final variable is a large collection or a service from
your middle-tier, this can cause a gigantic explosion of memory usage and
can be hard to track down. In short: be very cautious with what you
reference within anonymous inner classes and use member variables in your
classes sparingly.


source:
http://wickettraining.com/ten-things-every-wicket-programmer-should-know.html



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Components-as-Class-Members-tp4662235p4662237.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: Component detecting Ajax update

2013-11-04 Thread Bas Gooren
And from within the component itself you can override onEvent and handle 
the event whose payload is an AjaxRequestTarget.
The component can then check if it's in the getComponents() collection 
of said target.


e.g.

@Override
public void onEvent( IEvent ?  event )
{
Object payload = event.getPayload();

if( payload instanceof AjaxRequestTarget )
{
AjaxRequestTarget target = (AjaxRequestTarget) payload;
if(target.getComponents().contains(this)) {
 // your logic goes here
}
}
}

Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Martin Grigorov op 4-11-2013 8:27:

Hi,

You can use
org.apache.wicket.ajax.AjaxRequestTarget.IListener#onBeforeRespond(MapString,
Component map, AjaxRequestTarget) to be notified before ART starts
preparing its XML response.
The 'map' contains all already added components.



On Fri, Nov 1, 2013 at 3:45 PM, Nick Pratt nbpr...@gmail.com wrote:


Is there a way for a Component to detect if its been added to an
AjaxRequestTarget?

N





Re: Displaying ListView After Being Hidden

2013-10-26 Thread Bas Gooren
That's precisely why that method/functionality exists. If you have a 
component which is not visible on the first render, how can wicket 
replace it on subsequent ajax renders?


When you call setOutputMarkupPlaceholderTag(true), wicket will render a 
tag with style=display:none which provides wicket's ajax library with 
a hook in the dom.


Suppose you don't call that method, there will be no element in the dom 
which can be replaced.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Jared Sol op 25-10-2013 23:03:

No problem. I'm not exactly sure. I just know when hiding an element and then 
unhiding it you have to tell the component to keep a placeholder so it doesn't 
lose access to the component when you hide it. Might have something to do with 
keeping it around in the dom and using display=none. I haven't looked into the 
details.

Sent from my iPhone


On Oct 25, 2013, at 11:45 AM, dhongyt davidhtr...@gmail.com wrote:

Thanks you! That worked for me. What is the reason for this? Is this so that
it would it would hold the placeholder with in wmc?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Displaying-ListView-After-Being-Hidden-tp4661963p4661972.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


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





Dynamic markup loading caching in base page

2013-10-03 Thread Bas Gooren

Hi *,

We built an app which has a base page, and several child pages which 
inherit from the base page.
The app is themeable, and one of the requirements of the app is/was that 
these themes should be manageable.

This means we have a set of themes which can be changed on-the-fly.

To add flexibility to our app, a theme can override the html of the base 
page.
To handle the custom html, our base page implements 
IMarkupResourceStreamProvider and IMarkupCacheKeyProvider.


Every user of the app can select a theme, so the theme is determined per 
request.


The cache key is generated based on the theme id and the container class:

@Override
public String getCacheKey( MarkupContainer container, Class ?  
containerClass )

{
final Theme theme = getWebsite().getTheme();
return Theme# + theme.getId() + - + containerClass.getName();
}

The markup resource stream is only overriden for the base page:

@Override
public IResourceStream getMarkupResourceStream( MarkupContainer 
container, Class ?  containerClass )

{
final Theme theme = getWebsite().getTheme();

if( containerClass.equals( WebsiteLayout.class ) )
{
String markup = theme.getMarkup();
return new StringResourceStream( markup, text/html );
}

return defaultResourceStreamProvider.getMarkupResourceStream( 
container, containerClass );

}

(where defaultResourceStreamProvider is a 
DefaultMarkupResourceStreamProvider instance).


The problem we are facing is that when the user switches to a different 
theme, they keep seeing the html code of the previously selected theme. 
Debugging shows that when the theme is changed:

- getCacheKey is hit for both the child page and the base page
- getMarkupResourceStream is hit for both the child page and the base page

I think it could be due to the way wicket's 
DefaultMarkupResourceStreamProvider handles inheritance: maybe it (too) 
caches the base page markup?


Can anyone help with this? How do we properly cache dynamic html for a 
base page which is used by several (static) child pages?


Thanks!

--

Met vriendelijke groet,
Kind regards,

Bas Gooren



  1   2   3   >