Re: JavaScriptReference

2012-10-11 Thread Martin Grigorov
Hi,

On Wed, Oct 10, 2012 at 6:20 PM, Georg Buschbeck g...@thomas-daily.de wrote:
 Hi

 one addition, so i've seen you've fixed that issue (WICKET-4777) , but i
 think, there is a part missing, which i also didn't think of.

 on the delivered page the html code looks fine now (switched to
 6.2.0-SNAPSHOT).
 --snip--
 script type=text/javascript
 src=http://maps.googleapis.com/maps/api/js?sensor=falseclient-id=google-idcallback=initialize;/script
 --snap--
 when doing an ajax request whose response contains that rendered url it is
 represented the same way ..

 --snip--
 header-contribution encoding=wicket1 ![CDATA[head
 xmlns:wicket=http://wicket.apache.org;script type=text/javascript
 src=http://maps.googleapis.com/maps/api/js?sensor=falseclient-id=google-idcallback=initialize;/script
 --snap--


 which at this point leads to an javascript error:
 --snip--
 ERROR: Error in parsing: This page contains the following errors:error on
 line 1 at column 98: EntityRef: expecting ';'
 Below is a rendering of the page up to the first error.
 --snap--

 so i guess, it has to be escaped?

Can you please create a quickstart and attach it to the ticket.
Thanks!



 Thanks,

 Georg



 On 09/21/2012 01:00 PM, Georg Buschbeck wrote:

 okay, i filed a bug report ...



 On 09/21/2012 11:59 AM, Martin Grigorov wrote:

 Hi,

 Looks like a bug.

 On Fri, Sep 21, 2012 at 12:28 PM, Georg Buschbeck g...@thomas-daily.de
 wrote:

 hi

 while trying to integrate gmaps3 in our webapp i had issues with the
 wicketstuff-gmap3 stuff ( - we need a client-id for our request) ...

 so i have:

 public static final String GMAP_API_URL =
 %s://maps.google.com/maps/api/js?v=3sensor=%sclient-id=%s;

 response.render(JavaScriptHeaderItem.forUrl(String.format(GMAP_API_URL,
 schema, sensor, clientid)));


 the rendered result of this is:
 script type=text/javascript

 src=http://maps.google.com/maps/api/js?v=3amp;sensor=falseamp;client-id=;/script



 so the requestparameters are encoded

 which is happening in the JavaScriptUtils Helper:
 public static void writeJavaScriptUrl(final Response response, final
 CharSequence url, final String id, boolean defer, String charset)
 {
  response.write(script type=\text/javascript\ );
  if (id != null)
  {
  response.write(id=\ +
 Strings.escapeMarkup(id) +
 \ );
  }
  if (defer)
  {
  response.write(defer=\defer\ );
  }
  if (charset != null)
  {
  response.write(charset=\ +
 Strings.escapeMarkup(charset) + \ );
  }
  response.write(src=\);
  response.write(Strings.escapeMarkup(url));
  response.write(\/script);
  response.write(\n);
 }

 but ... is this right to escape the url?

 when i open the above mentioned script, google tells me i have no
 parameter
 sensor ... which i can understand as ther is only a parameter amp ...


 Any ideas?

 Thanks,

 Georg

 --
 Georg Buschbeck
 Information Technology

 THOMAS DAILY GmbH
 Adlerstraße 19
 79098 Freiburg
 Deutschland
 T  + 49 761 3 85 59 502
 F  + 49 761 3 85 59 550
 E  g...@thomas-daily.de
 www.thomas-daily.de

 Geschäftsführer/Managing Directors:
 Wendy Thomas, Susanne Larbig
 Handelsregister Freiburg i.Br., HRB 3947

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








 --
 Georg Buschbeck
 Information Technology

 THOMAS DAILY GmbH
 Adlerstraße 19
 79098 Freiburg
 Deutschland
 T  + 49 761 3 85 59 502
 F  + 49 761 3 85 59 550
 E  g...@thomas-daily.de
 www.thomas-daily.de

 Geschäftsführer/Managing Directors:
 Wendy Thomas, Susanne Larbig
 Handelsregister Freiburg i.Br., HRB 3947

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Manipulate Form Input After Validation

2012-10-11 Thread Francois Meillet
You should modify the css (color) for the input  for example, in place of 
changing the value, with an AttributeModifier.  
The value displayed in the text box comes from the model.

François


Le 10 oct. 2012 à 19:50, weslowsk weslo...@accesscomm.ca a écrit :

 Hi,
 
 I was wondering how I could manipulate some form input after validation. So,
 for example, if I have a text box that takes a value and I validate that
 that value is invalid, I'd like to upper case the entire value that was
 entered so that the value in the text box is updated but the model isn't
 updated.
 What's the proper way to do this in Wicket?
 
 Thanks...
 
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Manipulate-Form-Input-After-Validation-tp4652855.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



Re: How To Pass Objects through PageParameters in Wicket 1.5

2012-10-11 Thread Martin Grigorov
Hi,

On Wed, Oct 10, 2012 at 12:56 PM, venkat venkatesh.b...@gmail.com wrote:
 Hi ,

 I have a scenario, where from a Page link have to render a popup window and
 on submit of the popup window have to set the drop down selected value  of
 the parent window with the selected values from popup window.

 I have created the popup using BookMarkablePageLink and passing page
 parameters. Have passed the text fileds markupId as parameter and on submit
 of popup window have used

 window.parent.document.getElementById ( + this.parms.get(targetId) +

This should be 'window.opener', not 'window.parent'.

 ).value = 'test';
 window.close using appendJavaScript method. However it is not populating
 parent windows text filed.

 One of the crux in this case is my parent window is in side a tabbed panel,
 I doubt this might be forcing it to fail to set up.


 I would appreciate a quick response.

 Thanks in advance!



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-To-Pass-Objects-through-PageParameters-in-Wicket-1-5-tp4652830.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Wicket + Guice + unittests

2012-10-11 Thread Martin Grigorov
Hi,

https://github.com/apache/wicket/blob/master/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java
The code doesn't look very nice, IMO, but it should help you start your tests.

On Thu, Oct 11, 2012 at 3:10 AM, Dan Retzlaff dretzl...@gmail.com wrote:
 Daniel,

 What you're doing should work, but I think you're giving
 your GuiceComponentInjector a null Injector. Unit tests don't go through
 web.xml to set up its context listeners, so
 your GuiceServletContextListener never has a chance to construct and
 register an Injector with the ServletContext.

 Dan

 On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Hi,

 I've integrated Guice into Wicket successfully, but I'm struggling
 with the unittests. I'm not sure how to get the injector into my
 HomePage class. Here's my setup.

 I'm using GuiceFilter with a GuiceServletContextListener. That creates
 the injector and a ServletModule which defines the WicketApplication.
 I followed:
 http://code.google.com/p/google-guice/wiki/ServletModule

 Here's some of MyGuiceServletConfig extends GuiceServletContextListener

 @Override
 protected Injector getInjector() {
 return Guice.createInjector(createServletModule(), new
 MongoHoneybadgerModule());
 }

 private ServletModule createServletModule() {
 return new ServletModule() {
 ...

 In my WicketApplication extends WebApplication I have this init() method

 @Override
 public void init()
 {
 super.init();
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());
 getComponentInstantiationListeners().add(new
 GuiceComponentInjector(this, bootStrapInjector));
 }

 Now, in my HomePage.java class I have

 public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;
 @Inject private Injector injector;

 public HomePage(final PageParameters parameters) {
 super(parameters);
 SomeType myobj = injector.getInstance(SomeType.class);

 add(new Label(version, myobj.getValue()));
 }
 }

 This all runs great inside a web container as a servlet.

 The PROBLEM: I'm getting a NullPointerException on the line where I
 reference the injector:
 SomeType myobj = injector.getInstance(SomeType.class);

 My test class is what was generated by the wicket quickstart. I'm not
 sure how to make an injector available in setUp.

 @Before
 public void setUp() {
 tester = new WicketTester(new WicketApplication());
 }

 Any ideas?

 Thanks,
 Daniel

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Manipulate Form Input After Validation

2012-10-11 Thread Martin Grigorov
Hi,

You can do as Francois explained. See
http://www.w3schools.com/cssref/pr_text_text-transform.asp
Another way is to setup a IConverter (see textField#getConverter())
that converts to upper case in its #objectToString() method.

On Thu, Oct 11, 2012 at 9:56 AM, Francois Meillet
francois.meil...@gmail.com wrote:
 You should modify the css (color) for the input  for example, in place of 
 changing the value, with an AttributeModifier.
 The value displayed in the text box comes from the model.

 François


 Le 10 oct. 2012 à 19:50, weslowsk weslo...@accesscomm.ca a écrit :

 Hi,

 I was wondering how I could manipulate some form input after validation. So,
 for example, if I have a text box that takes a value and I validate that
 that value is invalid, I'd like to upper case the entire value that was
 entered so that the value in the text box is updated but the model isn't
 updated.
 What's the proper way to do this in Wicket?

 Thanks...



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Manipulate-Form-Input-After-Validation-tp4652855.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: How To Pass Objects through PageParameters in Wicket 1.5

2012-10-11 Thread venkat
Hi Martin,

Thanks for the response. However, I have window.opener as well and it did
not work. window.close is working as expected to close the form. however,
setting the dropdown value or text field is not working. I doubt since my
dropdown is inside a tabbed panel the  reference may not be accurate.

Thanks
Venkat



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-To-Pass-Objects-through-PageParameters-in-Wicket-1-5-tp4652830p4652870.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: JavaScriptReference

2012-10-11 Thread Georg Buschbeck

Hi,


i attached it https://issues.apache.org/jira/browse/WICKET-4777 .
you can see the problem by clicking the show/hide link.

Thanks,

Georg


On 10/11/2012 08:55 AM, Martin Grigorov wrote:

Hi,

On Wed, Oct 10, 2012 at 6:20 PM, Georg Buschbeck g...@thomas-daily.de wrote:

Hi

one addition, so i've seen you've fixed that issue (WICKET-4777) , but i
think, there is a part missing, which i also didn't think of.

on the delivered page the html code looks fine now (switched to
6.2.0-SNAPSHOT).
--snip--
script type=text/javascript
src=http://maps.googleapis.com/maps/api/js?sensor=falseclient-id=google-idcallback=initialize;/script
--snap--
when doing an ajax request whose response contains that rendered url it is
represented the same way ..

--snip--
header-contribution encoding=wicket1 ![CDATA[head
xmlns:wicket=http://wicket.apache.org;script type=text/javascript
src=http://maps.googleapis.com/maps/api/js?sensor=falseclient-id=google-idcallback=initialize;/script
--snap--


which at this point leads to an javascript error:
--snip--
ERROR: Error in parsing: This page contains the following errors:error on
line 1 at column 98: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.
--snap--

so i guess, it has to be escaped?


Can you please create a quickstart and attach it to the ticket.
Thanks!




Thanks,

Georg



On 09/21/2012 01:00 PM, Georg Buschbeck wrote:


okay, i filed a bug report ...



On 09/21/2012 11:59 AM, Martin Grigorov wrote:


Hi,

Looks like a bug.

On Fri, Sep 21, 2012 at 12:28 PM, Georg Buschbeck g...@thomas-daily.de
wrote:


hi

while trying to integrate gmaps3 in our webapp i had issues with the
wicketstuff-gmap3 stuff ( - we need a client-id for our request) ...

so i have:

public static final String GMAP_API_URL =
%s://maps.google.com/maps/api/js?v=3sensor=%sclient-id=%s;

response.render(JavaScriptHeaderItem.forUrl(String.format(GMAP_API_URL,
schema, sensor, clientid)));


the rendered result of this is:
script type=text/javascript

src=http://maps.google.com/maps/api/js?v=3amp;sensor=falseamp;client-id=;/script



so the requestparameters are encoded

which is happening in the JavaScriptUtils Helper:
public static void writeJavaScriptUrl(final Response response, final
CharSequence url, final String id, boolean defer, String charset)
{
  response.write(script type=\text/javascript\ );
  if (id != null)
  {
  response.write(id=\ +
Strings.escapeMarkup(id) +
\ );
  }
  if (defer)
  {
  response.write(defer=\defer\ );
  }
  if (charset != null)
  {
  response.write(charset=\ +
Strings.escapeMarkup(charset) + \ );
  }
  response.write(src=\);
  response.write(Strings.escapeMarkup(url));
  response.write(\/script);
  response.write(\n);
}

but ... is this right to escape the url?

when i open the above mentioned script, google tells me i have no
parameter
sensor ... which i can understand as ther is only a parameter amp ...


Any ideas?

Thanks,

Georg

--
Georg Buschbeck
Information Technology

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 502
F  + 49 761 3 85 59 550
E  g...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

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











--
Georg Buschbeck
Information Technology

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 502
F  + 49 761 3 85 59 550
E  g...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

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








--
Georg Buschbeck
Information Technology

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 502
F  + 49 761 3 85 59 550
E  g...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

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



download page

2012-10-11 Thread Douglas Ferguson
I've done downloads before in wicket by creating a resource stream, but this 
requires a user to click on a button or some other ajax.

I'd like to create a page that will stream content back to the user based on 
parameters.

This means I'd have bookmarkable urls for download and it would be secured 
based on my wicket authentication.

I assuming I can just get hold of the response from the RequestCycle to stream 
the bytes.
But I'm not sure the how to create a page without markup and also prevent 
wicket from trying to write to the response.

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



Re: download page

2012-10-11 Thread Martin Grigorov
Hi,

Better use IResource for this.
See WebApplication#mountResource() and
http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

On Thu, Oct 11, 2012 at 12:37 PM, Douglas Ferguson the...@gmail.com wrote:
 I've done downloads before in wicket by creating a resource stream, but this 
 requires a user to click on a button or some other ajax.

 I'd like to create a page that will stream content back to the user based on 
 parameters.

 This means I'd have bookmarkable urls for download and it would be secured 
 based on my wicket authentication.

 I assuming I can just get hold of the response from the RequestCycle to 
 stream the bytes.
 But I'm not sure the how to create a page without markup and also prevent 
 wicket from trying to write to the response.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: download page

2012-10-11 Thread Ernesto Reinaldo Barreiro
if your are using wicket  1.5.x maybe

RequestCycle.get().scheduleRequestHandlerAfterCurrent(handler);

will solve your problem.

On Thu, Oct 11, 2012 at 2:37 AM, Douglas Ferguson the...@gmail.com wrote:

 I've done downloads before in wicket by creating a resource stream, but
 this requires a user to click on a button or some other ajax.

 I'd like to create a page that will stream content back to the user based
 on parameters.

 This means I'd have bookmarkable urls for download and it would be secured
 based on my wicket authentication.

 I assuming I can just get hold of the response from the RequestCycle to
 stream the bytes.
 But I'm not sure the how to create a page without markup and also prevent
 wicket from trying to write to the response.

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




-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com


Re: BackButton support Browser Compatibility issue

2012-10-11 Thread Uwe Schäfer

On 10/04/2012 11:05 AM, Martin Grigorov wrote:

Hi Martin


Create a ticket with a quickstart please.


created as https://issues.apache.org/jira/browse/WICKET-4814

cu uwe

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



How to veto textfield inputChanged()?

2012-10-11 Thread l yeung
Hi,

How do I veto textfield inputChanged()?
I need to prevent this from happening inside
AjaxFormComponentUpdatingBehavior(onchange).

protected void onUpdate(AjaxRequestTarget target) {
String name = getModelObject().getName();
if (query(name) == null) {
// veto value change for this field.
} else {
// refresh form
}
}

I would like to prevent any value change propagated to my domain object
while inside ajax onchange.

Thanks in advance.

Cheers


Bug WICKET-4789 still in 6.1.1 ?

2012-10-11 Thread nemanjko

I'm not sure that the error I'm getting is related to the WICKET-4789 that
was in 6.0, 
but it looks like it.

After upgrading from 6.0.0 to 6.1.1, I am getting this error:

java.lang.NullPointerException

org.apache.wicket.protocol.http.servlet.ServletWebResponse.encodeURL(ServletWebResponse.java:181)

I use a piece of code to remove jsessionid from URL for search engines.
The line where it happens is where I use super.encodeURL(url):

public String encodeURL(CharSequence url) {
  final String agent = webRequest.getHeader(User-Agent);
  return isAgent(agent) ? url.toString() : super.encodeURL(url);
}

Is it still a bug? 
If not, is there some other way to remove jsessionid from URL?

Thanks, 
Nemanja





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Bug-WICKET-4789-still-in-6-1-1-tp4652883.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: Bug WICKET-4789 still in 6.1.1 ?

2012-10-11 Thread Martin Grigorov
Hi,

At line 181 in ServletWebResponse I see:
UrlRenderer urlRenderer = RequestCycle.get().getUrlRenderer();

I don't see how anything could be null here.
Can you debug what is null ?

On Thu, Oct 11, 2012 at 4:02 PM, nemanjko nemanja.kos...@gmail.com wrote:

 I'm not sure that the error I'm getting is related to the WICKET-4789 that
 was in 6.0,
 but it looks like it.

 After upgrading from 6.0.0 to 6.1.1, I am getting this error:

 java.lang.NullPointerException

 org.apache.wicket.protocol.http.servlet.ServletWebResponse.encodeURL(ServletWebResponse.java:181)

 I use a piece of code to remove jsessionid from URL for search engines.
 The line where it happens is where I use super.encodeURL(url):

 public String encodeURL(CharSequence url) {
   final String agent = webRequest.getHeader(User-Agent);
   return isAgent(agent) ? url.toString() : super.encodeURL(url);
 }

 Is it still a bug?
 If not, is there some other way to remove jsessionid from URL?

 Thanks,
 Nemanja





 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Bug-WICKET-4789-still-in-6-1-1-tp4652883.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: How to veto textfield inputChanged()?

2012-10-11 Thread Francois Meillet

you can use that yourFormComponent.setEnabled( false );

François

Le 11 oct. 2012 à 14:55, l yeung lenming.ye...@gmail.com a écrit :

 Hi,
 
 How do I veto textfield inputChanged()?
 I need to prevent this from happening inside
 AjaxFormComponentUpdatingBehavior(onchange).
 
 protected void onUpdate(AjaxRequestTarget target) {
String name = getModelObject().getName();
if (query(name) == null) {
// veto value change for this field.
} else {
// refresh form
}
 }
 
 I would like to prevent any value change propagated to my domain object
 while inside ajax onchange.
 
 Thanks in advance.
 
 Cheers


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



Re: Bug WICKET-4789 still in 6.1.1 ?

2012-10-11 Thread Carl-Eric Menzel
Do you have a complete stacktrace?

On Thu, 11 Oct 2012 06:02:33 -0700 (PDT)
nemanjko nemanja.kos...@gmail.com wrote:

 
 I'm not sure that the error I'm getting is related to the WICKET-4789
 that was in 6.0, 
 but it looks like it.
 
 After upgrading from 6.0.0 to 6.1.1, I am getting this error:
 
 java.lang.NullPointerException
 
 org.apache.wicket.protocol.http.servlet.ServletWebResponse.encodeURL(ServletWebResponse.java:181)
 
 I use a piece of code to remove jsessionid from URL for search
 engines. The line where it happens is where I use
 super.encodeURL(url):
 
 public String encodeURL(CharSequence url) {
   final String agent = webRequest.getHeader(User-Agent);
   return isAgent(agent) ? url.toString() :
 super.encodeURL(url); }
 
 Is it still a bug? 
 If not, is there some other way to remove jsessionid from URL?
 
 Thanks, 
 Nemanja
 
 
 
 
 
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Bug-WICKET-4789-still-in-6-1-1-tp4652883.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



Re: Bug WICKET-4789 still in 6.1.1 ?

2012-10-11 Thread nemanjko
Here is the full stack trace:

java.lang.NullPointerException

org.apache.wicket.protocol.http.servlet.ServletWebResponse.encodeURL(ServletWebResponse.java:181)
ch.yugosi.view.WicketApplication$1.encodeURL(WicketApplication.java:121)

ch.yugosi.view.WicketApplication$1.encodeRedirectURL(WicketApplication.java:125)
org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:212)
org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:394)
org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:582)
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:89)
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:198)
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)

And this is the code that produces the error:
// remove jsessionid for search engines
protected WebResponse newWebResponse(final WebRequest webRequest, final
HttpServletResponse httpServletResponse){ 
return new ServletWebResponse((ServletWebRequest)webRequest,
httpServletResponse) {
  @Override
  public String encodeURL(CharSequence url) {
  final String agent = webRequest.getHeader(User-Agent);
  return isAgent(agent) ? url.toString() : super.encodeURL(url);
  }
  @Override
  public String encodeRedirectURL(CharSequence url) {
  return encodeURL(url);
  }
};
}

To be honest, I have found this piece of code somewhere and just did
copypaste. 
It does look a bit suspicious especially encodeRedirectURL method which
calls encodeURL again. 

Nemanja

I can live without this so it's not a big deal. Weird thing is that Wicket
v6.0 didn't complaint but
v6.1.1 is producing the error above. 




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Bug-WICKET-4789-still-in-6-1-1-tp4652883p4652887.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: Bug WICKET-4789 still in 6.1.1 ?

2012-10-11 Thread Martin Grigorov
The strange thing is that at line 181
https://github.com/apache/wicket/blob/build/wicket-6.1.1/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebResponse.java#L181

it seems that RequestCycle.get() returns null.
But at WicketFilter.processRequest(WicketFilter.java:198) the
RequestCycle threal local must be still available.

On Thu, Oct 11, 2012 at 6:23 PM, nemanjko nemanja.kos...@gmail.com wrote:
 Here is the full stack trace:

 java.lang.NullPointerException

 org.apache.wicket.protocol.http.servlet.ServletWebResponse.encodeURL(ServletWebResponse.java:181)
 
 ch.yugosi.view.WicketApplication$1.encodeURL(WicketApplication.java:121)

 ch.yugosi.view.WicketApplication$1.encodeRedirectURL(WicketApplication.java:125)
 org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:212)
 org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:394)
 org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:582)
 org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:89)
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:198)
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)

 And this is the code that produces the error:
 // remove jsessionid for search engines
 protected WebResponse newWebResponse(final WebRequest webRequest, 
 final
 HttpServletResponse httpServletResponse){
 return new ServletWebResponse((ServletWebRequest)webRequest,
 httpServletResponse) {
   @Override
   public String encodeURL(CharSequence url) {
   final String agent = webRequest.getHeader(User-Agent);
   return isAgent(agent) ? url.toString() : 
 super.encodeURL(url);
   }
   @Override
   public String encodeRedirectURL(CharSequence url) {
   return encodeURL(url);
   }
 };
 }

 To be honest, I have found this piece of code somewhere and just did
 copypaste.
 It does look a bit suspicious especially encodeRedirectURL method which
 calls encodeURL again.

Yes, this seems like a bug.


 Nemanja

 I can live without this so it's not a big deal. Weird thing is that Wicket
 v6.0 didn't complaint but
 v6.1.1 is producing the error above.




 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Bug-WICKET-4789-still-in-6-1-1-tp4652883p4652887.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: How to veto textfield inputChanged()?

2012-10-11 Thread Sven Meier
Overwrite getUpdateModel() to return false.

Sven

l yeung lenming.ye...@gmail.com schrieb:

Hi,

How do I veto textfield inputChanged()?
I need to prevent this from happening inside
AjaxFormComponentUpdatingBehavior(onchange).

protected void onUpdate(AjaxRequestTarget target) {
String name = getModelObject().getName();
if (query(name) == null) {
// veto value change for this field.
} else {
// refresh form
}
}

I would like to prevent any value change propagated to my domain object
while inside ajax onchange.

Thanks in advance.

Cheers


Re: IResourceStream from ByteArrayResource ?

2012-10-11 Thread mlabs
I think my problem boils down to needing to do a synchronous ajax GET instead
of the default asynchronous one... my decorator's $.unblockUI() call gets
invoked too soon, because the Wicket.Ajax.Get is asynchronous.
Q: is there a way to switch the wicket ajax get call to synchronous mode on
the fly?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/IResourceStream-from-ByteArrayResource-tp4652776p4652893.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 veto textfield inputChanged()?

2012-10-11 Thread Martijn Dashorst
Why not create a validator that does your check? You can use the
converted input prior to the model update and if. The validation
reports an error, the model is not updated

On 11 okt. 2012, at 18:48, Sven Meier s...@meiers.net wrote:

 Overwrite getUpdateModel() to return false.

 Sven

 l yeung lenming.ye...@gmail.com schrieb:

 Hi,

 How do I veto textfield inputChanged()?
 I need to prevent this from happening inside
 AjaxFormComponentUpdatingBehavior(onchange).

 protected void onUpdate(AjaxRequestTarget target) {
   String name = getModelObject().getName();
   if (query(name) == null) {
   // veto value change for this field.
   } else {
   // refresh form
   }
 }

 I would like to prevent any value change propagated to my domain object
 while inside ajax onchange.

 Thanks in advance.

 Cheers
 B‹CB•È[œÝXœØÜšX™KK[XZ[ˆ\Ù\œË][œÝXœØÜšX™PÚXÚÙ]˜\XÚK›Ü™ÃB‘›ÜˆY][Û˜[ÛÛ[X[™ËK[XZ[ˆ\Ù\œËZ[ÚXÚÙ]˜\XÚK›Ü™ÃBƒ

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



Re: Wicket + Guice + unittests

2012-10-11 Thread Daniel Watrous
Dan,

I think you're right. Since in the WicketApplication init() function I
attempt to get the bootStrapInjector like this:
Injector bootStrapInjector = (Injector)
this.getServletContext().getAttribute(Injector.class.getName());

I just can't figure out how to get the injector into the
ServletContext before init() is run in my WicketApplication.

Daniel

On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 Daniel,

 What you're doing should work, but I think you're giving
 your GuiceComponentInjector a null Injector. Unit tests don't go through
 web.xml to set up its context listeners, so
 your GuiceServletContextListener never has a chance to construct and
 register an Injector with the ServletContext.

 Dan

 On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Hi,

 I've integrated Guice into Wicket successfully, but I'm struggling
 with the unittests. I'm not sure how to get the injector into my
 HomePage class. Here's my setup.

 I'm using GuiceFilter with a GuiceServletContextListener. That creates
 the injector and a ServletModule which defines the WicketApplication.
 I followed:
 http://code.google.com/p/google-guice/wiki/ServletModule

 Here's some of MyGuiceServletConfig extends GuiceServletContextListener

 @Override
 protected Injector getInjector() {
 return Guice.createInjector(createServletModule(), new
 MongoHoneybadgerModule());
 }

 private ServletModule createServletModule() {
 return new ServletModule() {
 ...

 In my WicketApplication extends WebApplication I have this init() method

 @Override
 public void init()
 {
 super.init();
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());
 getComponentInstantiationListeners().add(new
 GuiceComponentInjector(this, bootStrapInjector));
 }

 Now, in my HomePage.java class I have

 public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;
 @Inject private Injector injector;

 public HomePage(final PageParameters parameters) {
 super(parameters);
 SomeType myobj = injector.getInstance(SomeType.class);

 add(new Label(version, myobj.getValue()));
 }
 }

 This all runs great inside a web container as a servlet.

 The PROBLEM: I'm getting a NullPointerException on the line where I
 reference the injector:
 SomeType myobj = injector.getInstance(SomeType.class);

 My test class is what was generated by the wicket quickstart. I'm not
 sure how to make an injector available in setUp.

 @Before
 public void setUp() {
 tester = new WicketTester(new WicketApplication());
 }

 Any ideas?

 Thanks,
 Daniel

 -
 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: Wicket + Guice + unittests

2012-10-11 Thread Dan Retzlaff
For what it's worth, we instantiate our applications through Guice. Having
your application go get its Injector kind of violates the DI concept.

filter(/*).through(WicketFilter.class);
bind(WebApplication.class).to(CustomWebApplication.class);
bind(WicketFilter.class).to(CustomWicketFilter.class);

@Singleton
private static class CustomFilter extends WicketFilter {
@Inject private ProviderWebApplication webApplicationProvider;
 @Override
protected IWebApplicationFactory getApplicationFactory() {
return new IWebApplicationFactory() {
@Override
public WebApplication createApplication(WicketFilter filter) {
return webApplicationProvider.get();
}
@Override
public void destroy(WicketFilter filter) {
}
};
}
}

On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
daniel.watr...@gmail.comwrote:

 Dan,

 I think you're right. Since in the WicketApplication init() function I
 attempt to get the bootStrapInjector like this:
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());

 I just can't figure out how to get the injector into the
 ServletContext before init() is run in my WicketApplication.

 Daniel

 On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  Daniel,
 
  What you're doing should work, but I think you're giving
  your GuiceComponentInjector a null Injector. Unit tests don't go through
  web.xml to set up its context listeners, so
  your GuiceServletContextListener never has a chance to construct and
  register an Injector with the ServletContext.
 
  Dan
 
  On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Hi,
 
  I've integrated Guice into Wicket successfully, but I'm struggling
  with the unittests. I'm not sure how to get the injector into my
  HomePage class. Here's my setup.
 
  I'm using GuiceFilter with a GuiceServletContextListener. That creates
  the injector and a ServletModule which defines the WicketApplication.
  I followed:
  http://code.google.com/p/google-guice/wiki/ServletModule
 
  Here's some of MyGuiceServletConfig extends GuiceServletContextListener
 
  @Override
  protected Injector getInjector() {
  return Guice.createInjector(createServletModule(), new
  MongoHoneybadgerModule());
  }
 
  private ServletModule createServletModule() {
  return new ServletModule() {
  ...
 
  In my WicketApplication extends WebApplication I have this init() method
 
  @Override
  public void init()
  {
  super.init();
  Injector bootStrapInjector = (Injector)
  this.getServletContext().getAttribute(Injector.class.getName());
  getComponentInstantiationListeners().add(new
  GuiceComponentInjector(this, bootStrapInjector));
  }
 
  Now, in my HomePage.java class I have
 
  public class HomePage extends WebPage {
  private static final long serialVersionUID = 1L;
  @Inject private Injector injector;
 
  public HomePage(final PageParameters parameters) {
  super(parameters);
  SomeType myobj = injector.getInstance(SomeType.class);
 
  add(new Label(version, myobj.getValue()));
  }
  }
 
  This all runs great inside a web container as a servlet.
 
  The PROBLEM: I'm getting a NullPointerException on the line where I
  reference the injector:
  SomeType myobj = injector.getInstance(SomeType.class);
 
  My test class is what was generated by the wicket quickstart. I'm not
  sure how to make an injector available in setUp.
 
  @Before
  public void setUp() {
  tester = new WicketTester(new WicketApplication());
  }
 
  Any ideas?
 
  Thanks,
  Daniel
 
  -
  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: Twitter Bootstrap in Wicket

2012-10-11 Thread Jeremy Thomerson
On Thu, Oct 11, 2012 at 6:11 PM, Chris Colman
chr...@stepaheadsoftware.comwrote:

 Is it possible/feasible to 'selectively' use the Twitter bootstrap in a
 wicket app?

 Scenario: our app serves many different clients. Some will want the
 Twitter Bootstrap look and feel but others will be happy to use any
 number of existing CSS/JS templates that we have created for them over
 the years.

 Currently we use a combination of Wicket variations and conditional
 header injection to provide different look and feel for customers even
 though they all use the same Wicket page classes.

 Is it possible to use Twitter Bootstrap in the same way? i.e.
 conditionally use it when rendering a page for one customer but not
 using it when rendering that same page class for another customer?


It sounds like you already have the system for this built.  Bootstrap is
just HTML and CSS, so keep doing what you were with the variations and
different header contributions.  Is there something else that you need?

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


RE: Twitter Bootstrap in Wicket

2012-10-11 Thread Chris Colman
 Is it possible/feasible to 'selectively' use the Twitter bootstrap in
a
 wicket app?

 Scenario: our app serves many different clients. Some will want the
 Twitter Bootstrap look and feel but others will be happy to use any
 number of existing CSS/JS templates that we have created for them
over
 the years.

 Currently we use a combination of Wicket variations and conditional
 header injection to provide different look and feel for customers
even
 though they all use the same Wicket page classes.

 Is it possible to use Twitter Bootstrap in the same way? i.e.
 conditionally use it when rendering a page for one customer but not
 using it when rendering that same page class for another customer?


It sounds like you already have the system for this built.  Bootstrap
is
just HTML and CSS, so keep doing what you were with the variations and
different header contributions.  Is there something else that you need?

Probably not. I guess because it's purely HTML and CSS then it should
fit in nicely with our existing HTML/CSS selection code.


--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

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



Re: Twitter Bootstrap in Wicket

2012-10-11 Thread Bruno Borges
You have to remove though some of the CSS IE conditionals from Twitter
bootstrap.

They are still not correctly processed by Wicket. :-(


*Bruno Borges*
(11) 99564-9058
*www.brunoborges.com*



On Thu, Oct 11, 2012 at 11:08 PM, Chris Colman chr...@stepaheadsoftware.com
 wrote:

  Is it possible/feasible to 'selectively' use the Twitter bootstrap in
 a
  wicket app?
 
  Scenario: our app serves many different clients. Some will want the
  Twitter Bootstrap look and feel but others will be happy to use any
  number of existing CSS/JS templates that we have created for them
 over
  the years.
 
  Currently we use a combination of Wicket variations and conditional
  header injection to provide different look and feel for customers
 even
  though they all use the same Wicket page classes.
 
  Is it possible to use Twitter Bootstrap in the same way? i.e.
  conditionally use it when rendering a page for one customer but not
  using it when rendering that same page class for another customer?
 
 
 It sounds like you already have the system for this built.  Bootstrap
 is
 just HTML and CSS, so keep doing what you were with the variations and
 different header contributions.  Is there something else that you need?

 Probably not. I guess because it's purely HTML and CSS then it should
 fit in nicely with our existing HTML/CSS selection code.

 
 --
 Jeremy Thomerson
 http://wickettraining.com
 *Need a CMS for Wicket?  Use Brix! http://brixcms.org*

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




Re: Manipulate Form Input After Validation

2012-10-11 Thread weslowsk
Thanks for the suggestions...

What if I wanted to conditionally upper case the text field? Would a
converter work then?
For example, if the validation fails, upper case the string; otherwise,
leave the string as is.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Manipulate-Form-Input-After-Validation-tp4652855p4652901.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: Twitter Bootstrap in Wicket

2012-10-11 Thread Martin Grigorov
On Fri, Oct 12, 2012 at 5:14 AM, Bruno Borges bruno.bor...@gmail.com wrote:
 You have to remove though some of the CSS IE conditionals from Twitter
 bootstrap.

 They are still not correctly processed by Wicket. :-(

No one else had such complaints so far. Me included.




 *Bruno Borges*
 (11) 99564-9058
 *www.brunoborges.com*



 On Thu, Oct 11, 2012 at 11:08 PM, Chris Colman chr...@stepaheadsoftware.com
 wrote:

  Is it possible/feasible to 'selectively' use the Twitter bootstrap in
 a
  wicket app?
 
  Scenario: our app serves many different clients. Some will want the
  Twitter Bootstrap look and feel but others will be happy to use any
  number of existing CSS/JS templates that we have created for them
 over
  the years.
 
  Currently we use a combination of Wicket variations and conditional
  header injection to provide different look and feel for customers
 even
  though they all use the same Wicket page classes.
 
  Is it possible to use Twitter Bootstrap in the same way? i.e.
  conditionally use it when rendering a page for one customer but not
  using it when rendering that same page class for another customer?
 
 
 It sounds like you already have the system for this built.  Bootstrap
 is
 just HTML and CSS, so keep doing what you were with the variations and
 different header contributions.  Is there something else that you need?

 Probably not. I guess because it's purely HTML and CSS then it should
 fit in nicely with our existing HTML/CSS selection code.

 
 --
 Jeremy Thomerson
 http://wickettraining.com
 *Need a CMS for Wicket?  Use Brix! http://brixcms.org*

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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