IllegalArgumentException within WicketURLDecoder

2011-10-07 Thread Patrick Petermair

Hi!

From time to time we are getting an IllegalArgumentException within 
WicketURLDecoder (see below). We can't reproduce the error and it seems 
to not bother the users since we haven't had any reports about errors in 
the UI or so .. yet it keeps showing up in our logs.
Could it be some problem with the CryptedUrlWebRequestCodingStrategy we 
are using? I already did some Google searches but have found nothing so 
far - I have no idea where to start debugging this problem..


Any ideas?

Cheers,
Patrick


2011-10-06 01:49:19,916 [http-8080-28] ERROR - RequestCycle - 
URLDecoder: Illegal hex characters in escape (%) pattern - For input 
string: �ˠ
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters 
in escape (%) pattern - For input string: �ˠ
at 
org.apache.wicket.protocol.http.WicketURLDecoder.decode(WicketURLDecoder.java:179)
at 
org.apache.wicket.protocol.http.WicketURLDecoder.decode(WicketURLDecoder.java:90)
at 
org.apache.wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy$DecodedUrlRequest.init(CryptedUrlWebRequestCodingStrategy.java:443)
at 
org.apache.wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy.decode(CryptedUrlWebRequestCodingStrategy.java:124)

at org.apache.wicket.Request.getRequestParameters(Request.java:183)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Thread.java:662)

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



Session values not stored using chrome

2011-06-07 Thread Patrick Petermair

Hi!

Our wicket application has the following scenario:

-) save myValue in the session
-) redirect the user to an external page (using 
getRequestCycle().setRequestTarget())
-) the external pages redirects back to our webapp after the user 
entered some data

-) read myValue from the session and do something based on myValue

It all works just fine in Firefox, but not in Chrome. Using Chrome 
myValue is null when the user returns to the our wicket page again. My 
first guess was that a new session must have been created or that 
myValue was never set. I debugged through the code and the session id is 
exactly the same ... myValue has also been set before the user got 
redirected.


I don't quite get how Chrome and Firefox would behave differently when 
it comes to saving values into the wicket session. Or how leaving the 
webpage and returning to it 1 minute later would suddenly result in a 
different kind of session.


Any hints?

Cheers,
Patrick


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



Provide the user with immediate feedback

2011-02-01 Thread Patrick Petermair

Hey!

In our wicket application we are using a lot of Ajax links/forms. 
Sometimes, those requests take a second or two. We now want to give the 
user some feedback, that his request is being processed (to avoid double 
clicking or the impression that the webapp is slow).


What would be the best way to execute custom javascript methods BEFORE 
the request gets sent to the webapp? Those javascript methods would then 
show a progress bar, a message like Your request is being processed.. etc.


For example: The user clicks an AjaxLink to delete an entry from the 
table and before the request gets sent to the server, some javascript 
method adds a small progress bar at the top of the table. Once the ajax 
request is done, the progress bar disappears.


Another example would be how Facebook handles sending private messages. 
As soon as I click the send button, the text area gets disabled / 
greyed out immediately and after the Ajax request has gone through, I 
get access again to the text area.


Cheers,
Patrick

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



correct way to get css classes of component

2011-01-31 Thread Patrick Petermair

Hi!

I was trying to solve the problem of replacing a specific css class of a 
wicket component with another css class. Google pointed me to the 
following thread:


http://apache-wicket.1842946.n4.nabble.com/How-to-add-and-remove-css-classes-the-right-way-td1868408.html

The nice and simple solution was something like this:

String oldCss = String.valueOf(this.getMarkupAttributes().get(class));
String newCss = oldCss.replaceFirst(old, new);
new SimpleAttributeModifier(class, newCss);

I've used it and it works just fine.
Unfortunately - as I've just found out - the method 
getMarkupAttributes() has the following javadoc:


THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.

If I'm not supposed to use getMarkupAttributes(), what would be the 
correct way then to get the current css classes of a wicket component?


Cheers,
Patrick

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



wicket:message inside html title

2011-01-17 Thread Patrick Petermair

Hi!

We are using wicket:message for i18n of our html pages. It all works 
fine except for the html title. I have the following html:


head
  title
wicket:message key=page.titlemyTitle/wicket:message
  /title
/head

In the properties files I have page.title set to German Title and 
English Title for example.

The output from wicket to the browser is:

head
  title
wicket:message key=page.titleGerman Title/wicket:message
  /title
/head

The localization worked, but wicket leaves the wicket:message tag in 
the title which looks ugly and wrong.


Am I doing something wrong? What's the correct way of i18n html titles?

I could probably treat the page title as a simple label as shown in this 
blogpost:

http://th1rty7.blogspot.com/2009/08/page-title-in-wicket.html
But I would much rather do it with wicket:message since I don't have to 
touch any Java code this way.


Cheers,
Patrick



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



Re: wicket:message inside html title

2011-01-17 Thread Patrick Petermair

Thank you!

Works like a charm!!

Am 2011-01-17 12:10, schrieb Matthias Gasser:

Hello Patrick,

I guess the following will do the Job:

https://cwiki.apache.org/WICKET/how-to-remove-wicket-markup-from-output.html




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



Re: Preventing user input script-injection attacks

2010-11-25 Thread Patrick Petermair

Am 2010-11-25 16:15, schrieb Ian Marshall:


If a user has entered some HTML in a TextField or TextAreaString  when I do
not want HTML to be entered, what is a good way to prevent this?


In our project we are using OWASP Antisamy to prevent XSS attacks. It is 
easy to use, has a couple templates (slashdot, ebay,..) and works like a 
charm.


http://www.owasp.org/index.php/Category:OWASP_AntiSamy_Project
http://code.google.com/p/owaspantisamy/

Regards,
Patrick

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



Edit whole ListItem via Ajax

2010-11-12 Thread Patrick Petermair

Hey list!

I have a ListView and each ListItem has multiple labels. I want to add 
an edit button at the end of each line so that the user can switch 
into an edit mode, edit every label and then save them all at once.


So far, I've used AjaxEditableLabel for a single label and it works 
great. Is there something similar for a whole ListItem so that multiple 
labels can be changed into TextFields?


If there are no existing components with this feature, what would be the 
best way to implement it myself?


Thanks  Cheers,
Patrick

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



FeedbackPanel for each ListItem in ListView

2010-10-15 Thread Patrick Petermair

Hey!

I have ListView and every ListItem has multiple AjaxEditableLabels and 
one FeedbackPanel added to it. Each FeedbackPanel should only show 
messages that were reported within the same listitem.


I tried the following but it didn't work:

protected void populateItem(final ListItem item) {

[...]
item.add(new FeedbackPanel(someId, new
ContainerFeedbackMessageFilter(item)));
}

Somehow when the AjaxEditablelabel submits, the list items get created 
from scratch, which screws up object references and therefore 
container.contains(message.getReporter(), true) of the 
ContainerFeedbackMessageFilter never returns true.


Am I doing something wrong here? What would be the proper way to check 
if a feedback message was created within a listitem?


Cheers,
Patrick

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



Re: autocomplete for AjaxEditableLabel

2010-08-30 Thread Patrick Petermair


Is there a way to enable autocomplete for AjaxEditableLabel (just like 
AutoCompleteTextField)? I was going through AutoCompleteTextField as a 
reference and wrote my own behavior for autocompletion. The new behavior 
works perfectly for a TextField, but not for AjaxEditableLabel.


Answering my own question (in case someone is looking for the same 
functionality through a google search).


AjaxEditableLabel is a panel with a label and textfield component which 
is why adding the autocomplete behavior to it didn't work. I solved it 
by overriding the newEditor() method and adding my behavior to the 
editor in the AjaxEditableLabel panel like so:


AjaxEditableLabelString label = new AjaxEditableLabelString(foo) {

@Override
protected FormComponentString newEditor(final MarkupContainer
  parent, final String componentId, final IModelString model) {

final FormComponent form = super.newEditor(parent, componentId,
   model);
form.add(new MyAutoCompleteBehavior());
return form;
 }
};

Patrick

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



autocomplete for AjaxEditableLabel

2010-08-27 Thread Patrick Petermair

Hi!

Is there a way to enable autocomplete for AjaxEditableLabel (just like 
AutoCompleteTextField)? I was going through AutoCompleteTextField as a 
reference and wrote my own behavior for autocompletion. The new behavior 
works perfectly for a TextField, but not for AjaxEditableLabel.


Any help? What would be the correct way to do it?

Cheers,
Patrick

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



Re: Best practice for component interaction

2010-08-25 Thread Patrick Petermair

Igor Vaynberg schrieb:

onclick(final AjaxRequestTarget target) {
   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
IVisitorCaresAboutMyAjaxEvent () {
Object visit(CaresAboutMyAjaxEent object) {
   object.onMyAjaxEvent(target);
 }}}



Interesting.
A colleague also found the following blogpost:
http://techblog.molindo.at/2008/09/wicket-loose-coupling-of-componens-for-ajax-updates.html

Cheers,
Patrick



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



Best practice for component interaction

2010-08-24 Thread Patrick Petermair

Hi!

Let's say I have a page with 2 panels. CalendarPanel shows a simple 
calendar, FormPanel a basic form. Whenever the user clicks on a date in 
the calendar, the textfield of the form should show the selected date.


What is the best practice for this kind of interaction?
Right now we hold a reference to the FormPanel in CalendarPanel and 
attach our custom CalendarAjaxBehavior to it. Whenever the 
CalendarAjaxBehavior gets a request / click, it updates the FormPanel's 
model directly.


I don't really know if this is some ugly hack or if there is a better 
way of different panels to update / communicate with each other - other 
than holding references to one another...


Cheers,
Patrick

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



AutoCompleteTextField

2010-08-19 Thread Patrick Petermair

Hi!

Is it possible to get the AutoCompleteTextField to return a list of all 
available choices when the user presses the downward key?


I tried to return an iterator for the full list when the input of 
getChoices(String input) is empty, but this only works when the user 
presses the space key. When the user presses the downward key, nothing 
happpens.


Thanks,
Patrick

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



Re: AutoCompleteTextField

2010-08-19 Thread Patrick Petermair

armandoxxx schrieb:

You need to be able to select multiple items from autocomplete dropdown list
with just DOWN key ??? 


No, I want to select a single item - but out of a list of all the items.
Take the example at:
www.wicket-library.com/wicket-examples/ajax/autocomplete

The user starts typing a and the AutoCompleteTextField suggests the 
values Algeria, Austria, Australia, etc.
In my usecase, the user wants to press the down key and be presented 
with a list of all the countries so that he can navigate through them 
with the up  down keys.


Let's say a user has 100 possible choices .. then it makes sense to type 
in the first few letters until he is down to probably 5 choices or so. 
But another user may have only 3 possible choices. For him it would be 
better to just use the down key right away and select the value he wants 
instead of having him type a letter first..


Cheers,
Patrick

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



Re: AutoCompleteTextField

2010-08-19 Thread Patrick Petermair

Matthias Keller schrieb:


Use:
AutoCompleteSettings settings = new AutoCompleteSettings();
settings.setShowListOnEmptyInput(true);
settings.setShowListOnFocusGain(true);
// and possibly other settings as needed

And then specify those settings in the constructor..


Thanks!

Works like a charm.
I didn't even think about using AutoCompleteSettings...

Patrick


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