RE: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread Hielke Hoeve
Found it :) A silly bug... I squashed it and committed a fix and released a new 
snapshot version. Can you guys verify it is working now?

wiquery-core
1.5-SNAPSHOT

Hielke

-Original Message-
From: Hielke Hoeve [mailto:hielke.ho...@topicus.nl] 
Sent: woensdag 21 december 2011 8:06
To: users@wicket.apache.org
Subject: RE: Problem with wicket 1.5.3 and wiquery 1.5.3

Thats something that i would like to know once you stumble upon it. Adding 
dummy behaviors to fix things should not be necessary. I will try and fix the 
problem.

Hielke

-Original Message-
From: Chris Hawkins [mailto:ch...@chawkins.com]
Sent: dinsdag 20 december 2011 19:12
To: users@wicket.apache.org
Subject: Re: Problem with wicket 1.5.3 and wiquery 1.5.3

This sounds very similar to a problem that I had with WiQuery.  I found that if 
a page did not have any WiQuery components or behaviors on it I got errors with 
the Wicket ajax javascript due to the WiQueryDecoratingResponseHeader.  My 
solution was to force WiQuery to load jQuery by adding an empty WiQuery 
behavior to my base page.

/**
* This patch is intended to load jquery on every page because the 
WiQueryDecoratingHeaderResponse
* is rewriting every JS call regardless of if there is WiQuery code on the page
* @author chrish
*
*/
public class WiQueryJsPatch extends WiQueryAbstractBehavior {

private static final long serialVersionUID = 1L;

@Override
public JsStatement statement() {
return null;
}

}

On Dec 20, 2011, at 9:05 AM, dennisB wrote:

> hi Hielke
> 
> thanks for the fast reply.
> 
> I create a simple example to demonstrate my problem:
> 
> this is the scenario:
> 
> In my application i have wicket 1.5.3 and i am using AjaxLazyLoadPanel
> -
> 
> add(new AjaxLazyLoadPanel("testPanel") {
>@Override
>public Component getLazyLoadComponent(String markupId) {
>return new DataPanel(markupId);// simple panel which 
> includes only one Label
>}
> });
> 
> and it works fine...
> 
> when i add wiquery 1.5.3 you have this code
> 
> application.setHeaderResponseDecorator(new IHeaderResponseDecorator()
>   {
>   private static final long serialVersionUID = 1L;
> 
>   public IHeaderResponse decorate(IHeaderResponse 
> response)
>   {
>   return new 
> WiQueryDecoratingHeaderResponse(response);
>   }
>   });
> in  the WiQueryCoreInitializer class
> 
> now when i run this test it doesn't work correctly, and all 
> AjaxLazyLoadPanels in my application are not working. in ours real 
> application also other ajax events doesn't work correctly because of 
> wiquery .
> 
> Thanks.
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-a
> nd-wiquery-1-5-3-tp4217860p4218578.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


-
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: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread Hielke Hoeve
Thats something that i would like to know once you stumble upon it. Adding 
dummy behaviors to fix things should not be necessary. I will try and fix the 
problem.

Hielke

-Original Message-
From: Chris Hawkins [mailto:ch...@chawkins.com] 
Sent: dinsdag 20 december 2011 19:12
To: users@wicket.apache.org
Subject: Re: Problem with wicket 1.5.3 and wiquery 1.5.3

This sounds very similar to a problem that I had with WiQuery.  I found that if 
a page did not have any WiQuery components or behaviors on it I got errors with 
the Wicket ajax javascript due to the WiQueryDecoratingResponseHeader.  My 
solution was to force WiQuery to load jQuery by adding an empty WiQuery 
behavior to my base page.

/**
* This patch is intended to load jquery on every page because the 
WiQueryDecoratingHeaderResponse
* is rewriting every JS call regardless of if there is WiQuery code on the page
* @author chrish
*
*/
public class WiQueryJsPatch extends WiQueryAbstractBehavior {

private static final long serialVersionUID = 1L;

@Override
public JsStatement statement() {
return null;
}

}

On Dec 20, 2011, at 9:05 AM, dennisB wrote:

> hi Hielke
> 
> thanks for the fast reply.
> 
> I create a simple example to demonstrate my problem:
> 
> this is the scenario:
> 
> In my application i have wicket 1.5.3 and i am using AjaxLazyLoadPanel 
> -
> 
> add(new AjaxLazyLoadPanel("testPanel") {
>@Override
>public Component getLazyLoadComponent(String markupId) {
>return new DataPanel(markupId);// simple panel which 
> includes only one Label
>}
> });
> 
> and it works fine...
> 
> when i add wiquery 1.5.3 you have this code
> 
> application.setHeaderResponseDecorator(new IHeaderResponseDecorator()
>   {
>   private static final long serialVersionUID = 1L;
> 
>   public IHeaderResponse decorate(IHeaderResponse 
> response)
>   {
>   return new 
> WiQueryDecoratingHeaderResponse(response);
>   }
>   });
> in  the WiQueryCoreInitializer class
> 
> now when i run this test it doesn't work correctly, and all 
> AjaxLazyLoadPanels in my application are not working. in ours real 
> application also other ajax events doesn't work correctly because of 
> wiquery .
> 
> Thanks.
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-a
> nd-wiquery-1-5-3-tp4217860p4218578.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


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



Using custom ResourceBundle with Validators

2011-12-20 Thread mshaver
Hi all - 

I've got my own ResourceBundle for translations, something along the lines
of:

   ResourceBundle resourceBundle =
ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE_CLASS, Locale.getDefault());

   String myTranslation = resourceBundle.getString(myKey);

I'd like to use this same ResourceBundle with my Validators instead of
relying on the .properties file... but I haven't been able to figure out how
to do this.

I'm currently running wicket 1.4.18.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-custom-ResourceBundle-with-Validators-tp4219817p4219817.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



Unit Testing AjaxTabbedPanel

2011-12-20 Thread sudeivas
Hello All,
  I am using AjaxTabbedPanel in my application and I want to write
unit tests for that. But I couldn't find any example tests in Apache Wicket
- 1.5.3 code. 

Please share any sample code to write unit tests for AjaxTabbedPanel. 


Thanks,
Suresh

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unit-Testing-AjaxTabbedPanel-tp4219476p4219476.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: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread dennisB
hi Chris

your solution worked for my test project, i still need to check it on my
real project.

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-and-wiquery-1-5-3-tp4217860p4219254.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: Download file from ModalWindow problem

2011-12-20 Thread heapifyman
I have narrowed down the problem to Google Chrome (both 15.x and 17.x- 
dev version) now. In both Firefox and IE 9 the download is working and  
the ajax links keep working after the download finished.


I have created a quickstart application that demonstrates the thing.  
Are you still interested in that to see if it's a Chrome or a Wicket  
issue? If so, where should I put it?


Thanks


2011/12/9 Ernesto Reinaldo Barreiro 
Can you please create a quick-start application that we can test?

Ernesto

On Fri, Dec 9, 2011 at 1:38 AM, heapifyman  wrote:

> I did and I still don't seem to get it. I think I followed all the
> recommendations in javadoc:
>
> - put  in html file before  
the

> ajax button that opens the window
> - added another form around the **div>

> - changed sequence in ModalWindow's form's submit to
>download.initiate(target);
>ModalWindow.closeCurrent(**target);
>
> Still, after the window is closed and the download finished I  
cannot use

> any of the ajax links on my page until I reloaded the whole page.
>
> I don't understand what I might be doing wrong here.
>
>
> Am 08.12.2011 um 21:34 schrieb Martin Grigorov:
>
>
>  See ModalWindow's javadoc. It explains about the need of a form
>>
>> On Thu, Dec 8, 2011 at 8:24 PM, heapifyman   
wrote:

>>
>>> You mean putting an additional form around the modal window like  
below?

>>>
>>> 
>>> 
>>> <**span
>>> wicket:id="**downloadButtonLabel">
>>>   ... more buttons here ...
>>>   
>>>   
>>> 
>>>
>>> where dataPanel is:
>>> 
>>> 
>>> 
>>> 
>>>
>>>   
>>>
>>>   
>>>
>>> 
>>>
>>>
>>> 2011/12/8 Daniel Weidele >

>>> >
>>>
>>>  No, it's doesn't look nested, yet. You may nest forms in Wicket,  
where

 the
 modal windows markup is in between.

 This worked for me when I experienced a similar problem.

 Von meinem iPad gesendet

 Am 08.12.2011 um 14:12 schrieb heapifyman :

  I believe it already is. My markup looks like this:
>
> 
> 
> <**span
> wicket:id="**downloadButtonLabel">
>   ... more buttons here ...
>   
>   
> 
>
> where dataPanel is:
> 
> 
> 
> 
>   
> 
>
>
> 2011/12/8 Daniel Weidele >

> >
>
>  Have you tried to put modal itself inside of another form, too?
>>
>>
>> Am 08.12.2011 um 13:29 schrieb heapifyman  
:

>>
>>  Hello again.
>>>
>>> Here's some more information about my problem: in the  
ModalWindow's

>>> SubmitButton's onSubmit() I call at the end:
>>>
>>> ModalWindow.closeCurrent(**target);
>>> download.initiate(target);
>>>
>>> The AJAXDownload behaviour is added to the SubmitButton in the
>>>
>> ModalWindow.
>>
>>> Or do I have to add it to the button on my page that opens the
>>>
>> ModalWindow?
>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> 2011/12/7 heapifyman 
>>>
>>>  Hello all,

 I have a problem with a file download from a ModalWindow.
 The ModalWindow contains a form in which the user can  
specify some

 parameters. When clicking submit I generate a PDF based on the
 chosen
 parameters and offer it for download. The ModalWindow is  
closed

 then.
 I followed the approach described here


>>  https://cwiki.apache.org/**WICKET/ajax-update-and-file-**
 download-in-one-blow.htmland


> it actually works quite nice.

 My problem is that after the file is downloaded and the  
ModalWindow

 is
 closed all my Ajax stuff on the page from which the  
ModalWindow was


>>> opened
>>
>>> are not working anymore. Only when I reload the page, the  
Ajax stuff


>>> is

> working again.

 I would appreciate any hints as to what I might be doing  
wrong. Or


>>> maybe

> someone has another code example of how to download a file from a
 ModalWindow?

 Thanks in advance.




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

>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
 --**--**
 -
 To unsubscribe, e-mail: users-unsubscribe@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-unsubsc

Re: Getting response from a external URL

2011-12-20 Thread Igor Vaynberg
what is the stack trace look like now?

also, no need to extend a webpage, why not just impplement
IRequestHandler directly and mount it somewhere so you can construct
urls to it...

-igor

On Tue, Dec 20, 2011 at 11:24 AM, Pablo Díaz  wrote:
> I've done that, but I get the same result :(
>
> El 20/12/11 20:18, Igor Vaynberg escribió:
>
>> (httpservletresponse)getresponse().getcontainerresponse()
>>
>> -igor
>>
>> On Tue, Dec 20, 2011 at 10:58 AM, Pablo Díaz  wrote:
>>>
>>> Ok, but How I can get the httpservletresponse object to write in it? I'm
>>> extending the WebPage class ...
>>>
>>> El 20/12/11 19:26, Igor Vaynberg escribió:
>>>
 try writing directly into httpservletresponse instead of wicket's
 response. there is a bug fix for this in the upcoming release

 -igor

 On Tue, Dec 20, 2011 at 10:03 AM, Pablo Díaz
  wrote:
>
> Ok, thank you, I'm not getting the error if I use your code, but I'm
> not
> able to gets the response (I always get a blank image, when I must get
> a
> map).
>
> I mean, I only like getting the request done from someone and check if
> he
> has enough privileges to do some operation Then, I change some
> parameters
> depends on his role he can.
>
> My code is like this:
>
> public class ProxyAction extends WebPage {
>
> public ProxyAction(PageParameters parameters){
>        URL url = null;
>        Logger logger = Logger.getLogger(ProxyAction.class);
>        HttpURLConnection con = null;
>        Response response = getResponse();
>        ByteArrayBuffer bab = new ByteArrayBuffer();
>
>        try {
>            String mapserverUrl =
>
>
> "http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;
>            Iterator    it = claves.iterator();
>            while(it.hasNext()){
>                String clave = (String) it.next();
>                mapserverUrl= mapserverUrl + "&"+ clave+"=";
>                List    valores =
> parameters.getValues(clave);
>                for(int i=0; i                    mapserverUrl = mapserverUrl+valores.get(i)+" ";
>                }
>            }
>
>            url = new URL(mapserverUrl);
>            con = (HttpURLConnection) url.openConnection();
>
>            InputStream istream = con.getInputStream();
>            byte[] b = new byte[1];
>            for(;;){
>                if(istream.read(b) == -1)
>                    break;
>                bab.write(b);
>            }
>
>            response.write(bab.getRawData());
>            getRequestCycle().replaceAllRequestHandlers(new
> EmptyRequestHandler());
>
>        } catch (MalformedURLException e) {
>            logger.error(e.getMessage());
>        } catch (IOException e) {
>            logger.error(e.getMessage());
>        }
>        //this.getRequestCycle().setResponse(response);
>    }
> }
> El 20/12/11 18:17, Igor Vaynberg escribió:
>
>> in the future, start with the error :)
>>
>> you have to tell wicket that it should not render the page after you
>> have written the data out...
>>
>> output.write(data);
>> getrequestcycle().replaceallrequesthandlers(new
>> EmptyRequestHandler());
>>
>>
>> -igor
>>
>>
>>
>> On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz
>>  wrote:
>>>
>>> Because when I try to write to response I get's this error:
>>>
>>> ERROR - DefaultExceptionMapper     - Unexpected error occurred
>>> java.lang.IllegalStateException: Can't call write(CharSequence) after
>>> write(byte[]) has been called.
>>>    at
>>>
>>>
>>>
>>> org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
>>>    at
>>>
>>> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
>>>    at
>>>
>>> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>>>    at org.apache.wicket.Page.onRender(Page.java:904)
>>>    at
>>> org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
>>>    at org.apache.wicket.Component.internalRender(Component.java:2347)
>>>    at org.apache.wicket.Component.render(Component.java:2275)
>>>    at org.apache.wicket.Page.renderPage(Page.java:1035)
>>>    at
>>>
>>>
>>>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
>>>    at
>>>
>>>
>>>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
>>>    at
>>>
>>>
>>>
>>> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>>>    at
>>>
>>>
>>>

Re: Getting response from a external URL

2011-12-20 Thread Pablo Díaz

I've done that, but I get the same result :(

El 20/12/11 20:18, Igor Vaynberg escribió:

(httpservletresponse)getresponse().getcontainerresponse()

-igor

On Tue, Dec 20, 2011 at 10:58 AM, Pablo Díaz  wrote:

Ok, but How I can get the httpservletresponse object to write in it? I'm
extending the WebPage class ...

El 20/12/11 19:26, Igor Vaynberg escribió:


try writing directly into httpservletresponse instead of wicket's
response. there is a bug fix for this in the upcoming release

-igor

On Tue, Dec 20, 2011 at 10:03 AM, Pablo Díazwrote:

Ok, thank you, I'm not getting the error if I use your code, but I'm not
able to gets the response (I always get a blank image, when I must get a
map).

I mean, I only like getting the request done from someone and check if he
has enough privileges to do some operation Then, I change some parameters
depends on his role he can.

My code is like this:

public class ProxyAction extends WebPage {

public ProxyAction(PageParameters parameters){
URL url = null;
Logger logger = Logger.getLogger(ProxyAction.class);
HttpURLConnection con = null;
Response response = getResponse();
ByteArrayBuffer bab = new ByteArrayBuffer();

try {
String mapserverUrl =

"http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;
Iteratorit = claves.iterator();
while(it.hasNext()){
String clave = (String) it.next();
mapserverUrl= mapserverUrl + "&"+ clave+"=";
Listvalores = parameters.getValues(clave);
for(int i=0; i
in the future, start with the error :)

you have to tell wicket that it should not render the page after you
have written the data out...

output.write(data);
getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());


-igor



On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz
  wrote:

Because when I try to write to response I get's this error:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Can't call write(CharSequence) after
write(byte[]) has been called.
at


org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
at
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
at org.apache.wicket.Page.onRender(Page.java:904)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
at org.apache.wicket.Component.internalRender(Component.java:2347)
at org.apache.wicket.Component.render(Component.java:2275)
at org.apache.wicket.Page.renderPage(Page.java:1035)
at


org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at


org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at


org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at


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


org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at


org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at


org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at


org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at


org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at


org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at


org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at

org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at


org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at

org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at

org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at


org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at


org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at

org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at


org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at


org.mortbay.io.nio.SelectChannelEndPoint.run(

Re: Getting response from a external URL

2011-12-20 Thread Igor Vaynberg
(httpservletresponse)getresponse().getcontainerresponse()

-igor

On Tue, Dec 20, 2011 at 10:58 AM, Pablo Díaz  wrote:
> Ok, but How I can get the httpservletresponse object to write in it? I'm
> extending the WebPage class ...
>
> El 20/12/11 19:26, Igor Vaynberg escribió:
>
>> try writing directly into httpservletresponse instead of wicket's
>> response. there is a bug fix for this in the upcoming release
>>
>> -igor
>>
>> On Tue, Dec 20, 2011 at 10:03 AM, Pablo Díaz  wrote:
>>>
>>> Ok, thank you, I'm not getting the error if I use your code, but I'm not
>>> able to gets the response (I always get a blank image, when I must get a
>>> map).
>>>
>>> I mean, I only like getting the request done from someone and check if he
>>> has enough privileges to do some operation Then, I change some parameters
>>> depends on his role he can.
>>>
>>> My code is like this:
>>>
>>> public class ProxyAction extends WebPage {
>>>
>>> public ProxyAction(PageParameters parameters){
>>>        URL url = null;
>>>        Logger logger = Logger.getLogger(ProxyAction.class);
>>>        HttpURLConnection con = null;
>>>        Response response = getResponse();
>>>        ByteArrayBuffer bab = new ByteArrayBuffer();
>>>
>>>        try {
>>>            String mapserverUrl =
>>>
>>> "http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;
>>>            Iterator  it = claves.iterator();
>>>            while(it.hasNext()){
>>>                String clave = (String) it.next();
>>>                mapserverUrl= mapserverUrl + "&"+ clave+"=";
>>>                List  valores = parameters.getValues(clave);
>>>                for(int i=0; i>>                    mapserverUrl = mapserverUrl+valores.get(i)+" ";
>>>                }
>>>            }
>>>
>>>            url = new URL(mapserverUrl);
>>>            con = (HttpURLConnection) url.openConnection();
>>>
>>>            InputStream istream = con.getInputStream();
>>>            byte[] b = new byte[1];
>>>            for(;;){
>>>                if(istream.read(b) == -1)
>>>                    break;
>>>                bab.write(b);
>>>            }
>>>
>>>            response.write(bab.getRawData());
>>>            getRequestCycle().replaceAllRequestHandlers(new
>>> EmptyRequestHandler());
>>>
>>>        } catch (MalformedURLException e) {
>>>            logger.error(e.getMessage());
>>>        } catch (IOException e) {
>>>            logger.error(e.getMessage());
>>>        }
>>>        //this.getRequestCycle().setResponse(response);
>>>    }
>>> }
>>> El 20/12/11 18:17, Igor Vaynberg escribió:
>>>
 in the future, start with the error :)

 you have to tell wicket that it should not render the page after you
 have written the data out...

 output.write(data);
 getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());


 -igor



 On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz
  wrote:
>
> Because when I try to write to response I get's this error:
>
> ERROR - DefaultExceptionMapper     - Unexpected error occurred
> java.lang.IllegalStateException: Can't call write(CharSequence) after
> write(byte[]) has been called.
>    at
>
>
> org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
>    at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
>    at
> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>    at org.apache.wicket.Page.onRender(Page.java:904)
>    at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
>    at org.apache.wicket.Component.internalRender(Component.java:2347)
>    at org.apache.wicket.Component.render(Component.java:2275)
>    at org.apache.wicket.Page.renderPage(Page.java:1035)
>    at
>
>
> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
>    at
>
>
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
>    at
>
>
> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>    at
>
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>    at
>
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>    at
>
>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>    at
>
>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>    at
>
>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
>    at
>
>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
>    at
>
>
> org.apache.wic

Re: Getting response from a external URL

2011-12-20 Thread Pablo Díaz
Ok, but How I can get the httpservletresponse object to write in it? I'm 
extending the WebPage class ...


El 20/12/11 19:26, Igor Vaynberg escribió:

try writing directly into httpservletresponse instead of wicket's
response. there is a bug fix for this in the upcoming release

-igor

On Tue, Dec 20, 2011 at 10:03 AM, Pablo Díaz  wrote:

Ok, thank you, I'm not getting the error if I use your code, but I'm not
able to gets the response (I always get a blank image, when I must get a
map).

I mean, I only like getting the request done from someone and check if he
has enough privileges to do some operation Then, I change some parameters
depends on his role he can.

My code is like this:

public class ProxyAction extends WebPage {

public ProxyAction(PageParameters parameters){
URL url = null;
Logger logger = Logger.getLogger(ProxyAction.class);
HttpURLConnection con = null;
Response response = getResponse();
ByteArrayBuffer bab = new ByteArrayBuffer();

try {
String mapserverUrl =
"http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;
Iterator  it = claves.iterator();
while(it.hasNext()){
String clave = (String) it.next();
mapserverUrl= mapserverUrl + "&"+ clave+"=";
List  valores = parameters.getValues(clave);
for(int i=0; i
in the future, start with the error :)

you have to tell wicket that it should not render the page after you
have written the data out...

output.write(data);
getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());


-igor



On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díazwrote:

Because when I try to write to response I get's this error:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Can't call write(CharSequence) after
write(byte[]) has been called.
at

org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
at
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
at org.apache.wicket.Page.onRender(Page.java:904)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
at org.apache.wicket.Component.internalRender(Component.java:2347)
at org.apache.wicket.Component.render(Component.java:2275)
at org.apache.wicket.Page.renderPage(Page.java:1035)
at

org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at

org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at

org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at

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

org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at

org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at

org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at

org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at

org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at

org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at

org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at

org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at

org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at

org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at

org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at

org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at

org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

I tried to do this in serveral versions of wicket and always get the same
error.

El 20/12/11 17:15, Igor Vaynberg esc

Re: Getting response from a external URL

2011-12-20 Thread Igor Vaynberg
try writing directly into httpservletresponse instead of wicket's
response. there is a bug fix for this in the upcoming release

-igor

On Tue, Dec 20, 2011 at 10:03 AM, Pablo Díaz  wrote:
> Ok, thank you, I'm not getting the error if I use your code, but I'm not
> able to gets the response (I always get a blank image, when I must get a
> map).
>
> I mean, I only like getting the request done from someone and check if he
> has enough privileges to do some operation Then, I change some parameters
> depends on his role he can.
>
> My code is like this:
>
> public class ProxyAction extends WebPage {
>
> public ProxyAction(PageParameters parameters){
>        URL url = null;
>        Logger logger = Logger.getLogger(ProxyAction.class);
>        HttpURLConnection con = null;
>        Response response = getResponse();
>        ByteArrayBuffer bab = new ByteArrayBuffer();
>
>        try {
>            String mapserverUrl =
> "http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;
>            Iterator it = claves.iterator();
>            while(it.hasNext()){
>                String clave = (String) it.next();
>                mapserverUrl= mapserverUrl + "&"+ clave+"=";
>                List valores = parameters.getValues(clave);
>                for(int i=0; i                    mapserverUrl = mapserverUrl+valores.get(i)+" ";
>                }
>            }
>
>            url = new URL(mapserverUrl);
>            con = (HttpURLConnection) url.openConnection();
>
>            InputStream istream = con.getInputStream();
>            byte[] b = new byte[1];
>            for(;;){
>                if(istream.read(b) == -1)
>                    break;
>                bab.write(b);
>            }
>
>            response.write(bab.getRawData());
>            getRequestCycle().replaceAllRequestHandlers(new
> EmptyRequestHandler());
>
>        } catch (MalformedURLException e) {
>            logger.error(e.getMessage());
>        } catch (IOException e) {
>            logger.error(e.getMessage());
>        }
>        //this.getRequestCycle().setResponse(response);
>    }
> }
> El 20/12/11 18:17, Igor Vaynberg escribió:
>
>> in the future, start with the error :)
>>
>> you have to tell wicket that it should not render the page after you
>> have written the data out...
>>
>> output.write(data);
>> getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());
>>
>>
>> -igor
>>
>>
>>
>> On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz  wrote:
>>>
>>> Because when I try to write to response I get's this error:
>>>
>>> ERROR - DefaultExceptionMapper     - Unexpected error occurred
>>> java.lang.IllegalStateException: Can't call write(CharSequence) after
>>> write(byte[]) has been called.
>>>    at
>>>
>>> org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
>>>    at
>>> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
>>>    at
>>> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>>>    at org.apache.wicket.Page.onRender(Page.java:904)
>>>    at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
>>>    at org.apache.wicket.Component.internalRender(Component.java:2347)
>>>    at org.apache.wicket.Component.render(Component.java:2275)
>>>    at org.apache.wicket.Page.renderPage(Page.java:1035)
>>>    at
>>>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
>>>    at
>>>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
>>>    at
>>>
>>> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>>>    at
>>>
>>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>>>    at
>>>
>>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>    at
>>>
>>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>>>    at
>>>
>>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>>>    at
>>>
>>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
>>>    at
>>>
>>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
>>>    at
>>>
>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
>>>    at
>>>
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>>    at
>>>
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>    at
>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>    at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>>    at
>>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>> 

Re: any idea where this error comes from?

2011-12-20 Thread Gabriel Landon
I usually have this kind of error when the user use the browser's back button
and then reused the form.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/any-idea-where-this-error-comes-from-tp4217040p4218803.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: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread Chris Hawkins
This sounds very similar to a problem that I had with WiQuery.  I found that if 
a page did not have any WiQuery components or behaviors on it I got errors with 
the Wicket ajax javascript due to the WiQueryDecoratingResponseHeader.  My 
solution was to force WiQuery to load jQuery by adding an empty WiQuery 
behavior to my base page.

/**
* This patch is intended to load jquery on every page because the 
WiQueryDecoratingHeaderResponse
* is rewriting every JS call regardless of if there is WiQuery code on the page
* @author chrish
*
*/
public class WiQueryJsPatch extends WiQueryAbstractBehavior {

private static final long serialVersionUID = 1L;

@Override
public JsStatement statement() {
return null;
}

}

On Dec 20, 2011, at 9:05 AM, dennisB wrote:

> hi Hielke 
> 
> thanks for the fast reply.
> 
> I create a simple example to demonstrate my problem:
> 
> this is the scenario:
> 
> In my application i have wicket 1.5.3 and i am using AjaxLazyLoadPanel -
> 
> add(new AjaxLazyLoadPanel("testPanel") {
>@Override
>public Component getLazyLoadComponent(String markupId) {
>return new DataPanel(markupId);// simple panel which
> includes only one Label
>}
> });
> 
> and it works fine...
> 
> when i add wiquery 1.5.3 you have this code 
> 
> application.setHeaderResponseDecorator(new IHeaderResponseDecorator()
>   {
>   private static final long serialVersionUID = 1L;
> 
>   public IHeaderResponse decorate(IHeaderResponse 
> response)
>   {
>   return new 
> WiQueryDecoratingHeaderResponse(response);
>   }
>   });
> in  the WiQueryCoreInitializer class
> 
> now when i run this test it doesn't work correctly, and all
> AjaxLazyLoadPanels in my application are not working. in ours real
> application also other ajax events doesn't work correctly because of wiquery
> .
> 
> Thanks.
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-and-wiquery-1-5-3-tp4217860p4218578.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: Getting response from a external URL

2011-12-20 Thread Pablo Díaz
Ok, thank you, I'm not getting the error if I use your code, but I'm not 
able to gets the response (I always get a blank image, when I must get a 
map).


I mean, I only like getting the request done from someone and check if 
he has enough privileges to do some operation Then, I change some 
parameters depends on his role he can.


My code is like this:

public class ProxyAction extends WebPage {

public ProxyAction(PageParameters parameters){
URL url = null;
Logger logger = Logger.getLogger(ProxyAction.class);
HttpURLConnection con = null;
Response response = getResponse();
ByteArrayBuffer bab = new ByteArrayBuffer();

try {
String mapserverUrl = 
"http://localhost/cgi-bin/mapserv?mode=map&map=/var/local/mapserver/inveco/map/client_draw.map&layers=provincias";;

Iterator it = claves.iterator();
while(it.hasNext()){
String clave = (String) it.next();
mapserverUrl= mapserverUrl + "&"+ clave+"=";
List valores = parameters.getValues(clave);
for(int i=0; igetRequestCycle().replaceAllRequestHandlers(new 
EmptyRequestHandler());


} catch (MalformedURLException e) {
logger.error(e.getMessage());
} catch (IOException e) {
logger.error(e.getMessage());
}
//this.getRequestCycle().setResponse(response);
}
}
El 20/12/11 18:17, Igor Vaynberg escribió:

in the future, start with the error :)

you have to tell wicket that it should not render the page after you
have written the data out...

output.write(data);
getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());


-igor



On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz  wrote:

Because when I try to write to response I get's this error:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Can't call write(CharSequence) after
write(byte[]) has been called.
at
org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
at org.apache.wicket.Page.onRender(Page.java:904)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
at org.apache.wicket.Component.internalRender(Component.java:2347)
at org.apache.wicket.Component.render(Component.java:2275)
at org.apache.wicket.Page.renderPage(Page.java:1035)
at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

I tried to do this in serveral versions of wicket and always get the same
error.

El 20/12/11 17:15, Igor Vaynbe

Re: Getting response from a external URL

2011-12-20 Thread Igor Vaynberg
in the future, start with the error :)

you have to tell wicket that it should not render the page after you
have written the data out...

output.write(data);
getrequestcycle().replaceallrequesthandlers(new EmptyRequestHandler());


-igor



On Tue, Dec 20, 2011 at 8:54 AM, Pablo Díaz  wrote:
> Because when I try to write to response I get's this error:
>
> ERROR - DefaultExceptionMapper     - Unexpected error occurred
> java.lang.IllegalStateException: Can't call write(CharSequence) after
> write(byte[]) has been called.
>    at
> org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
>    at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
>    at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>    at org.apache.wicket.Page.onRender(Page.java:904)
>    at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
>    at org.apache.wicket.Component.internalRender(Component.java:2347)
>    at org.apache.wicket.Component.render(Component.java:2275)
>    at org.apache.wicket.Page.renderPage(Page.java:1035)
>    at
> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
>    at
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
>    at
> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>    at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>    at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>    at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>    at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>    at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
>    at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
>    at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
>    at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>    at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>    at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>    at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>    at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>    at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>    at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>    at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>    at org.mortbay.jetty.Server.handle(Server.java:324)
>    at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>    at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>    at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>    at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>
> I tried to do this in serveral versions of wicket and always get the same
> error.
>
> El 20/12/11 17:15, Igor Vaynberg escribió:
>
>> why doesnt that work in wicket?
>>
>> -igor
>>
>> On Tue, Dec 20, 2011 at 12:46 AM, Pablo Díaz  wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to do something like an internal proxy in my web-app to check
>>> permisions to connect from my portal to a mapserver server.
>>>
>>> So, I'm trying to get de request from an OpenLayers and redirect the
>>> connection throw my internal proxy (after check the roles) .
>>> I've done this before in Struts, but I don't know how do this in Wicket.
>>> In Struts is something similar to do this:
>>>
>>>        HttpClient client = new HttpClient();
>>>        GetMethod method = new GetMethod(mapserverURL);
>>>
>>>        method.getParams().setVersion(HttpVersion.HTTP_1_0);
>>>
>>>        // Provide custom retry handler is necessary
>>>        method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
>>>                new DefaultHttpMethodRetryHandler(3, false));
>>>
>>>  method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,
>>>                "ISO-8859-1");
>>>        method.getParams().setCredentialCharset("ISO-8859-1");
>>>
>>>        try {
>>>            // Execute the method.
>>>            int statusCode = client.executeMethod(method);
>>>
>>>            if (statusCode != HttpStatus.SC_OK) {
>>>                System.err.println("Method failed: " +
>>> method.getStatusLine());
>>>            

RE: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread dennisB
hi Hielke 

thanks for the fast reply.

I create a simple example to demonstrate my problem:

this is the scenario:

In my application i have wicket 1.5.3 and i am using AjaxLazyLoadPanel -

add(new AjaxLazyLoadPanel("testPanel") {
@Override
public Component getLazyLoadComponent(String markupId) {
return new DataPanel(markupId);// simple panel which
includes only one Label
}
 });

and it works fine...

when i add wiquery 1.5.3 you have this code 

application.setHeaderResponseDecorator(new IHeaderResponseDecorator()
{
private static final long serialVersionUID = 1L;

public IHeaderResponse decorate(IHeaderResponse 
response)
{
return new 
WiQueryDecoratingHeaderResponse(response);
}
});
in  the WiQueryCoreInitializer class

now when i run this test it doesn't work correctly, and all
AjaxLazyLoadPanels in my application are not working. in ours real
application also other ajax events doesn't work correctly because of wiquery
.

Thanks.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-and-wiquery-1-5-3-tp4217860p4218578.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: Getting response from a external URL

2011-12-20 Thread Pablo Díaz

Because when I try to write to response I get's this error:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Can't call write(CharSequence) after 
write(byte[]) has been called.
at 
org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:465)
at 
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1525)
at 
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)

at org.apache.wicket.Page.onRender(Page.java:904)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
at org.apache.wicket.Component.internalRender(Component.java:2347)
at org.apache.wicket.Component.render(Component.java:2275)
at org.apache.wicket.Page.renderPage(Page.java:1035)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at 
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.Server.handle(Server.java:324)
at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)


I tried to do this in serveral versions of wicket and always get the 
same error.


El 20/12/11 17:15, Igor Vaynberg escribió:

why doesnt that work in wicket?

-igor

On Tue, Dec 20, 2011 at 12:46 AM, Pablo Díaz  wrote:

Hi,

I'm trying to do something like an internal proxy in my web-app to check
permisions to connect from my portal to a mapserver server.

So, I'm trying to get de request from an OpenLayers and redirect the
connection throw my internal proxy (after check the roles) .
I've done this before in Struts, but I don't know how do this in Wicket.
In Struts is something similar to do this:

HttpClient client = new HttpClient();
GetMethod method = new GetMethod(mapserverURL);

method.getParams().setVersion(HttpVersion.HTTP_1_0);

// Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));

  method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,
"ISO-8859-1");
method.getParams().setCredentialCharset("ISO-8859-1");

try {
// Execute the method.
int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " +
method.getStatusLine());
}

InputStream input = method.getResponseBodyAsStream();
output = response.getOutputStream();

byte[] data = new byte[1];
for (;;) {

if ((input.read(data)) == -1) {
break;
}

output.write(data);

}
} catch (HttpException e) {
System.err.println("Fatal protocol violation: " +
e.getMessage());
e.printStackTrace();
   

Re: Getting response from a external URL

2011-12-20 Thread Igor Vaynberg
why doesnt that work in wicket?

-igor

On Tue, Dec 20, 2011 at 12:46 AM, Pablo Díaz  wrote:
> Hi,
>
> I'm trying to do something like an internal proxy in my web-app to check
> permisions to connect from my portal to a mapserver server.
>
> So, I'm trying to get de request from an OpenLayers and redirect the
> connection throw my internal proxy (after check the roles) .
> I've done this before in Struts, but I don't know how do this in Wicket.
> In Struts is something similar to do this:
>
>        HttpClient client = new HttpClient();
>        GetMethod method = new GetMethod(mapserverURL);
>
>        method.getParams().setVersion(HttpVersion.HTTP_1_0);
>
>        // Provide custom retry handler is necessary
>        method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
>                new DefaultHttpMethodRetryHandler(3, false));
>
>  method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,
>                "ISO-8859-1");
>        method.getParams().setCredentialCharset("ISO-8859-1");
>
>        try {
>            // Execute the method.
>            int statusCode = client.executeMethod(method);
>
>            if (statusCode != HttpStatus.SC_OK) {
>                System.err.println("Method failed: " +
> method.getStatusLine());
>            }
>
>            InputStream input = method.getResponseBodyAsStream();
>            output = response.getOutputStream();
>
>            byte[] data = new byte[1];
>            for (;;) {
>
>                if ((input.read(data)) == -1) {
>                    break;
>                }
>
>                output.write(data);
>
>            }
>        } catch (HttpException e) {
>            System.err.println("Fatal protocol violation: " +
> e.getMessage());
>            e.printStackTrace();
>            return null;
>        } catch (IOException e) {
>            System.err.println("Fatal transport error: " + e.getMessage());
>            e.printStackTrace();
>            return null;
>        } finally {
>            // Release the connection.
>            method.releaseConnection();
>        }
>    return null;
>
> Can anybody help me?
>
> -
> 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: Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread Hielke Hoeve
Hi Dennis,

Unfortunately this is the (only) way how WiQuery can work. If you provide some 
code we can help you fix this, otherwise we'll have to try and read minds which 
is bound to fail :)

Hielke

-Original Message-
From: dennisB [mailto:dennisbo...@gmail.com] 
Sent: dinsdag 20 december 2011 14:52
To: users@wicket.apache.org
Subject: Problem with wicket 1.5.3 and wiquery 1.5.3

Hi all

We are performing upgrade to wicket 1.5.3 and wiquery 1.5.3 and we got some 
problem with the Response, the problem is that all my Responses is wrapped now 
with WiQueryDecoratingHeaderResponse class and the Ajax events doesn't work 
properly 

Thanks .

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-and-wiquery-1-5-3-tp4217860p4217860.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



Problem with wicket 1.5.3 and wiquery 1.5.3

2011-12-20 Thread dennisB
Hi all

We are performing upgrade to wicket 1.5.3 and wiquery 1.5.3 and we got some
problem with
the Response, the problem is that all my Responses is wrapped now with
WiQueryDecoratingHeaderResponse class and the Ajax events doesn't work
properly 

Thanks .

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-wicket-1-5-3-and-wiquery-1-5-3-tp4217860p4217860.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



AW: AW: Problem with embedded jetty using AWT

2011-12-20 Thread Reiche, Andreas
OK, I'm a bit further now.
Just tried it with a windows Admin User and TaT.
Seems that our security policies deny something for a normal user which is 
needed when running embedded jetty.
I have to contact our sys admins.

Thanks so far,

Andreas 

-Ursprüngliche Nachricht-
Von: Reiche, Andreas [mailto:andreas.rei...@lgln.niedersachsen.de] 
Gesendet: Dienstag, 20. Dezember 2011 14:25
An: users@wicket.apache.org
Betreff: AW: AW: Problem with embedded jetty using AWT

Not sure how i can check this?
But i don't think so because i have a little test class which generates the 
picture through AWT.
When i ran this class as a java application from inside Eclipse, then the image 
is created fine.
Just when it runs in the context of the jetty server it fails.
By the way. The problematic method is the BufferedImage#createGraphics(). on 
this Method the jvm hangs.

Andreas

-Ursprüngliche Nachricht-
Von: Chantal Ackermann [mailto:chantal.ackerm...@btelligent.de] 
Gesendet: Dienstag, 20. Dezember 2011 13:58
An: users@wicket.apache.org
Betreff: Re: AW: Problem with embedded jetty using AWT


Just wondering - could SWT (Eclipse) cause that problem? Maybe it is
interfering with the AWT classpath.



On Tue, 2011-12-20 at 13:44 +0100, Reiche, Andreas wrote:
> Yep, this was the first i tried, but didn't help.
> 
> Andreas
>  
> 
> -Ursprüngliche Nachricht-
> Von: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] 
> Gesendet: Dienstag, 20. Dezember 2011 13:35
> An: users@wicket.apache.org
> Betreff: Re: Problem with embedded jetty using AWT
> 
> did you define -Djava.awt.headless=true as a jvm parameter?
> 
> Martijn
> 
> On Tue, Dec 20, 2011 at 12:52 PM, Reiche, Andreas
>  wrote:
> > Hi,
> > has anyone already recognized this behaviour.
> > I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
> > developing in Eclipse on a Win XP machine.
> > Up to now everything worked fine, but now i have the following problem:
> > I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit 
> > for that purpose.
> > As Wicket Model i use a RenderedDynamicImageResource which gives me a 
> > Graphics2D object to draw on.
> > If i try to debug or run the code in the embedded jetty which i use in my 
> > IDE then the JVM 'hangs' and the image is not rendered.
> >
> > If i deploy the app to a standalone jetty or a standalone tomcat everything 
> > goes fine.
> > This is exactly the problem which is described here:
> > http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636
> >
> > First i thought of a security issue, like mentioned in above thread, but 
> > even after i gave the embedded jetty a java.security.AllPermission
> > the prob still exits.
> >
> > Here is the code which creates and starts the jetty server.
> >
> > ...
> >public static void main(String[] args) throws Exception {
> >try {
> >Server server = startJettyServer(8080);
> >System.in.read();
> >System.out.println(">>> STOPPING EMBEDDED JETTY 
> > SERVER");
> >// while (System.in.available() == 0) {
> >// Thread.sleep(5000);
> >// }
> >server.stop();
> >server.join();
> >} catch (Exception e) {
> >e.printStackTrace();
> >System.exit(100);
> >}
> >}
> >
> >public static Server startJettyServer(int port) throws Exception {
> >Server server = new Server();
> >SocketConnector connector = new SocketConnector();
> >// Set some timeout options to make debugging easier.
> >connector.setMaxIdleTime(1000 * 60 * 60);
> >connector.setSoLingerTime(-1);
> >connector.setPort(port);
> >server.setConnectors(new Connector[] { connector });
> >
> >WebAppContext bb = new WebAppContext();
> >bb.setServer(server);
> >bb.setContextPath("/");
> >bb.setWar("src/main/webapp");
> >bb.setAttribute("serveIcon", false);
> >
> >Permission perm = new AllPermission();
> >PermissionCollection permissions = 
> > perm.newPermissionCollection();
> >permissions.add(perm);
> >
> >bb.setPermissions(permissions);
> >// START JMX SERVER
> >// MBeanServer mBeanServer =
> >// ManagementFactory.getPlatformMBeanServer();
> >// MBeanContainer mBeanContainer = new 
> > MBeanContainer(mBeanServer);
> >// server.getContainer().addEventListener(mBeanContainer);
> >// mBeanContainer.start();
> >
> >server.addHandler(bb);
> >
> >Sy

AW: AW: Problem with embedded jetty using AWT

2011-12-20 Thread Reiche, Andreas
Not sure how i can check this?
But i don't think so because i have a little test class which generates the 
picture through AWT.
When i ran this class as a java application from inside Eclipse, then the image 
is created fine.
Just when it runs in the context of the jetty server it fails.
By the way. The problematic method is the BufferedImage#createGraphics(). on 
this Method the jvm hangs.

Andreas

-Ursprüngliche Nachricht-
Von: Chantal Ackermann [mailto:chantal.ackerm...@btelligent.de] 
Gesendet: Dienstag, 20. Dezember 2011 13:58
An: users@wicket.apache.org
Betreff: Re: AW: Problem with embedded jetty using AWT


Just wondering - could SWT (Eclipse) cause that problem? Maybe it is
interfering with the AWT classpath.



On Tue, 2011-12-20 at 13:44 +0100, Reiche, Andreas wrote:
> Yep, this was the first i tried, but didn't help.
> 
> Andreas
>  
> 
> -Ursprüngliche Nachricht-
> Von: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] 
> Gesendet: Dienstag, 20. Dezember 2011 13:35
> An: users@wicket.apache.org
> Betreff: Re: Problem with embedded jetty using AWT
> 
> did you define -Djava.awt.headless=true as a jvm parameter?
> 
> Martijn
> 
> On Tue, Dec 20, 2011 at 12:52 PM, Reiche, Andreas
>  wrote:
> > Hi,
> > has anyone already recognized this behaviour.
> > I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
> > developing in Eclipse on a Win XP machine.
> > Up to now everything worked fine, but now i have the following problem:
> > I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit 
> > for that purpose.
> > As Wicket Model i use a RenderedDynamicImageResource which gives me a 
> > Graphics2D object to draw on.
> > If i try to debug or run the code in the embedded jetty which i use in my 
> > IDE then the JVM 'hangs' and the image is not rendered.
> >
> > If i deploy the app to a standalone jetty or a standalone tomcat everything 
> > goes fine.
> > This is exactly the problem which is described here:
> > http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636
> >
> > First i thought of a security issue, like mentioned in above thread, but 
> > even after i gave the embedded jetty a java.security.AllPermission
> > the prob still exits.
> >
> > Here is the code which creates and starts the jetty server.
> >
> > ...
> >public static void main(String[] args) throws Exception {
> >try {
> >Server server = startJettyServer(8080);
> >System.in.read();
> >System.out.println(">>> STOPPING EMBEDDED JETTY 
> > SERVER");
> >// while (System.in.available() == 0) {
> >// Thread.sleep(5000);
> >// }
> >server.stop();
> >server.join();
> >} catch (Exception e) {
> >e.printStackTrace();
> >System.exit(100);
> >}
> >}
> >
> >public static Server startJettyServer(int port) throws Exception {
> >Server server = new Server();
> >SocketConnector connector = new SocketConnector();
> >// Set some timeout options to make debugging easier.
> >connector.setMaxIdleTime(1000 * 60 * 60);
> >connector.setSoLingerTime(-1);
> >connector.setPort(port);
> >server.setConnectors(new Connector[] { connector });
> >
> >WebAppContext bb = new WebAppContext();
> >bb.setServer(server);
> >bb.setContextPath("/");
> >bb.setWar("src/main/webapp");
> >bb.setAttribute("serveIcon", false);
> >
> >Permission perm = new AllPermission();
> >PermissionCollection permissions = 
> > perm.newPermissionCollection();
> >permissions.add(perm);
> >
> >bb.setPermissions(permissions);
> >// START JMX SERVER
> >// MBeanServer mBeanServer =
> >// ManagementFactory.getPlatformMBeanServer();
> >// MBeanContainer mBeanContainer = new 
> > MBeanContainer(mBeanServer);
> >// server.getContainer().addEventListener(mBeanContainer);
> >// mBeanContainer.start();
> >
> >server.addHandler(bb);
> >
> >System.out.println(">>> STARTING EMBEDDED JETTY SERVER, 
> > PRESS ANY KEY TO STOP");
> >server.start();
> >return server;
> >}
> > ...
> >
> >
> > I alreasy searched the jetty doc, but could not found any hints.
> > Appreciate any input on that.
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.a

Re: StringValue.toOptionalLong incorrect behavior

2011-12-20 Thread Илья Нарыжный
OK:)
Please find it here:
https://issues.apache.org/jira/browse/WICKET-4309

Thank you!
Regards,
Ilia

2011/12/20 Martin Grigorov 

> Ticket please!
>
> 2011/12/20 Илья Нарыжный :
> > Hello,
> >
> > Up this topic. Are you planning to fix this functionality with
> > toOptionalString?
> >
> > Thanks,
> >
> > Ilis
> >
> > 2011/11/16 vineet semwal 
> >
> >>  yeah not needed for toOptionalString() but why not for
> >> toOptionalBoolean()?
> >>
> >> On Wed, Nov 16, 2011 at 3:39 PM, Martin Grigorov 
> >> wrote:
> >> > Hi,
> >> >
> >> > On Wed, Nov 16, 2011 at 11:50 AM, vineet semwal
> >> >  wrote:
> >> >> martin i too think tooptionalMethods in StringValue should behave the
> >> >> way llia is saying ie. they should return null if text is empty or
> >> >> null..
> >> >
> >> > Hm. Not quite convinced.
> >> > ?a=b&c=&e=f is a valid query string and 'c' has value "" while 'g' has
> >> null
> >> >
> >> > maybe just some of toOptionalXyz() methods should use
> Strings.isEmpty()
> >> > e.g. toOptionalString() and toOptionalBoolean() should not check for
> ""
> >> >
> >> >> for eg. currently  public final Long toOptionalLong() throws
> >> >> StringValueConversionException
> >> >>{
> >> >>return (text == null) ? null : toLongObject();
> >> >>}
> >> >>
> >> >> can be changed to
> >> >>  public final Long toOptionalLong() throws
> >> StringValueConversionException
> >> >>{
> >> >>return (Strings.isEmpty(text)) ? null :
> toLongObject();
> >> >>}
> >> >>
> >> >> On Wed, Nov 16, 2011 at 2:57 PM, Martin Grigorov <
> mgrigo...@apache.org>
> >> wrote:
> >> >>> Hi,
> >> >>>
> >> >>> At least this is what the javadoc says:
> >> >>> "Convert to object types, returning null if text is null."
> >> >>>
> >> >>> I think the more appropriate method for you is
> >> >>> org.apache.wicket.util.string.StringValue.toLong(long) but it also
> >> >>> throws exceptions if the provided value is empty string.
> >> >>>
> >> >>> On Wed, Nov 16, 2011 at 11:00 AM, Илья Нарыжный 
> >> wrote:
> >>  Hello,
> >> 
> >>  I have page mounted as @MountPath("/page/#{pageId}")
> >> 
> >>  Also I have following code:
> >> 
> >>  public ViewPagePage(PageParameters params)
> >> {
> >> this(getEntityPkFor(params, Page.class, 1)); //1 - is
> default
> >> ID if
> >>  PK in url was not found
> >> }
> >> 
> >>  and:
> >> 
> >>  protected static Long getEntityPkFor(PageParameters params, Class
> >> clazz,
> >>  Long defaultPk)
> >> {
> >> String pkFieldName =
> >> EntitiesDescriptor.get().getPkFieldName(clazz);
> >> Long ret=null;
> >> if(pkFieldName!=null)
> >> {
> >> ret = params.get(pkFieldName).toOptionalLong();
> >> }
> >> if(ret==null)
> >> {
> >> ret = params.get("id").toOptionalLong();
> >> }
> >> return ret==null?defaultPk:ret;
> >> }
> >> 
> >>  But(!!!) if ID was not put to the URL I have following Exception:
> >> 
> >>  Caused by:
> >> org.apache.wicket.util.string.StringValueConversionException:
> >>  Unable
> >>  to convert '' to a Long value
> >> at
> >> 
> org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
> >>  va:589)
> >> at
> >> 
> org.apache.wicket.util.string.StringValue.toOptionalLong(StringValue.
> >>  java:657)
> >> at
> ru.ydn.wicket.EntityPage.getEntityPkFor(EntityPage.java:57)
> >> at
> ru.ydn.wicket.web.ViewPagePage.(ViewPagePage.java:84)
> >> ... 37 more
> >>  Caused by: java.lang.NumberFormatException: For input string: ""
> >> at
> >> 
> java.lang.NumberFormatException.forInputString(NumberFormatException.
> >>  java:48)
> >> at java.lang.Long.parseLong(Long.java:431)
> >> at java.lang.Long.(Long.java:678)
> >> at
> >> 
> org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
> >>  va:585)
> >> 
> >>  The problem in following code:
> >> 
> >>  public final Long toOptionalLong() throws
> >> StringValueConversionException
> >> {
> >> return (text == null) ? null : toLongObject();
> >> }
> >> 
> >>  text should be checked for emptiness - not only null
> >> 
> >>  What do you think?
> >> 
> >>  Thanks,
> >> 
> >>  Ilia
> >> 
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> 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
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> thank you

Re: AW: Problem with embedded jetty using AWT

2011-12-20 Thread Chantal Ackermann

Just wondering - could SWT (Eclipse) cause that problem? Maybe it is
interfering with the AWT classpath.



On Tue, 2011-12-20 at 13:44 +0100, Reiche, Andreas wrote:
> Yep, this was the first i tried, but didn't help.
> 
> Andreas
>  
> 
> -Ursprüngliche Nachricht-
> Von: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] 
> Gesendet: Dienstag, 20. Dezember 2011 13:35
> An: users@wicket.apache.org
> Betreff: Re: Problem with embedded jetty using AWT
> 
> did you define -Djava.awt.headless=true as a jvm parameter?
> 
> Martijn
> 
> On Tue, Dec 20, 2011 at 12:52 PM, Reiche, Andreas
>  wrote:
> > Hi,
> > has anyone already recognized this behaviour.
> > I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
> > developing in Eclipse on a Win XP machine.
> > Up to now everything worked fine, but now i have the following problem:
> > I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit 
> > for that purpose.
> > As Wicket Model i use a RenderedDynamicImageResource which gives me a 
> > Graphics2D object to draw on.
> > If i try to debug or run the code in the embedded jetty which i use in my 
> > IDE then the JVM 'hangs' and the image is not rendered.
> >
> > If i deploy the app to a standalone jetty or a standalone tomcat everything 
> > goes fine.
> > This is exactly the problem which is described here:
> > http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636
> >
> > First i thought of a security issue, like mentioned in above thread, but 
> > even after i gave the embedded jetty a java.security.AllPermission
> > the prob still exits.
> >
> > Here is the code which creates and starts the jetty server.
> >
> > ...
> >public static void main(String[] args) throws Exception {
> >try {
> >Server server = startJettyServer(8080);
> >System.in.read();
> >System.out.println(">>> STOPPING EMBEDDED JETTY 
> > SERVER");
> >// while (System.in.available() == 0) {
> >// Thread.sleep(5000);
> >// }
> >server.stop();
> >server.join();
> >} catch (Exception e) {
> >e.printStackTrace();
> >System.exit(100);
> >}
> >}
> >
> >public static Server startJettyServer(int port) throws Exception {
> >Server server = new Server();
> >SocketConnector connector = new SocketConnector();
> >// Set some timeout options to make debugging easier.
> >connector.setMaxIdleTime(1000 * 60 * 60);
> >connector.setSoLingerTime(-1);
> >connector.setPort(port);
> >server.setConnectors(new Connector[] { connector });
> >
> >WebAppContext bb = new WebAppContext();
> >bb.setServer(server);
> >bb.setContextPath("/");
> >bb.setWar("src/main/webapp");
> >bb.setAttribute("serveIcon", false);
> >
> >Permission perm = new AllPermission();
> >PermissionCollection permissions = 
> > perm.newPermissionCollection();
> >permissions.add(perm);
> >
> >bb.setPermissions(permissions);
> >// START JMX SERVER
> >// MBeanServer mBeanServer =
> >// ManagementFactory.getPlatformMBeanServer();
> >// MBeanContainer mBeanContainer = new 
> > MBeanContainer(mBeanServer);
> >// server.getContainer().addEventListener(mBeanContainer);
> >// mBeanContainer.start();
> >
> >server.addHandler(bb);
> >
> >System.out.println(">>> STARTING EMBEDDED JETTY SERVER, 
> > PRESS ANY KEY TO STOP");
> >server.start();
> >return server;
> >}
> > ...
> >
> >
> > I alreasy searched the jetty doc, but could not found any hints.
> > Appreciate any input on that.
> >
> > -
> > 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



AW: Problem with embedded jetty using AWT

2011-12-20 Thread Reiche, Andreas
Yep, this was the first i tried, but didn't help.

Andreas
 

-Ursprüngliche Nachricht-
Von: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] 
Gesendet: Dienstag, 20. Dezember 2011 13:35
An: users@wicket.apache.org
Betreff: Re: Problem with embedded jetty using AWT

did you define -Djava.awt.headless=true as a jvm parameter?

Martijn

On Tue, Dec 20, 2011 at 12:52 PM, Reiche, Andreas
 wrote:
> Hi,
> has anyone already recognized this behaviour.
> I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
> developing in Eclipse on a Win XP machine.
> Up to now everything worked fine, but now i have the following problem:
> I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit for 
> that purpose.
> As Wicket Model i use a RenderedDynamicImageResource which gives me a 
> Graphics2D object to draw on.
> If i try to debug or run the code in the embedded jetty which i use in my IDE 
> then the JVM 'hangs' and the image is not rendered.
>
> If i deploy the app to a standalone jetty or a standalone tomcat everything 
> goes fine.
> This is exactly the problem which is described here:
> http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636
>
> First i thought of a security issue, like mentioned in above thread, but even 
> after i gave the embedded jetty a java.security.AllPermission
> the prob still exits.
>
> Here is the code which creates and starts the jetty server.
>
> ...
>        public static void main(String[] args) throws Exception {
>                try {
>                        Server server = startJettyServer(8080);
>                        System.in.read();
>                        System.out.println(">>> STOPPING EMBEDDED JETTY 
> SERVER");
>                        // while (System.in.available() == 0) {
>                        // Thread.sleep(5000);
>                        // }
>                        server.stop();
>                        server.join();
>                } catch (Exception e) {
>                        e.printStackTrace();
>                        System.exit(100);
>                }
>        }
>
>        public static Server startJettyServer(int port) throws Exception {
>                Server server = new Server();
>                SocketConnector connector = new SocketConnector();
>                // Set some timeout options to make debugging easier.
>                connector.setMaxIdleTime(1000 * 60 * 60);
>                connector.setSoLingerTime(-1);
>                connector.setPort(port);
>                server.setConnectors(new Connector[] { connector });
>
>                WebAppContext bb = new WebAppContext();
>                bb.setServer(server);
>                bb.setContextPath("/");
>                bb.setWar("src/main/webapp");
>                bb.setAttribute("serveIcon", false);
>
>                Permission perm = new AllPermission();
>                PermissionCollection permissions = 
> perm.newPermissionCollection();
>                permissions.add(perm);
>
>                bb.setPermissions(permissions);
>                // START JMX SERVER
>                // MBeanServer mBeanServer =
>                // ManagementFactory.getPlatformMBeanServer();
>                // MBeanContainer mBeanContainer = new 
> MBeanContainer(mBeanServer);
>                // server.getContainer().addEventListener(mBeanContainer);
>                // mBeanContainer.start();
>
>                server.addHandler(bb);
>
>                System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS 
> ANY KEY TO STOP");
>                server.start();
>                return server;
>        }
> ...
>
>
> I alreasy searched the jetty doc, but could not found any hints.
> Appreciate any input on that.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.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: Problem with embedded jetty using AWT

2011-12-20 Thread Martijn Dashorst
did you define -Djava.awt.headless=true as a jvm parameter?

Martijn

On Tue, Dec 20, 2011 at 12:52 PM, Reiche, Andreas
 wrote:
> Hi,
> has anyone already recognized this behaviour.
> I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
> developing in Eclipse on a Win XP machine.
> Up to now everything worked fine, but now i have the following problem:
> I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit for 
> that purpose.
> As Wicket Model i use a RenderedDynamicImageResource which gives me a 
> Graphics2D object to draw on.
> If i try to debug or run the code in the embedded jetty which i use in my IDE 
> then the JVM 'hangs' and the image is not rendered.
>
> If i deploy the app to a standalone jetty or a standalone tomcat everything 
> goes fine.
> This is exactly the problem which is described here:
> http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636
>
> First i thought of a security issue, like mentioned in above thread, but even 
> after i gave the embedded jetty a java.security.AllPermission
> the prob still exits.
>
> Here is the code which creates and starts the jetty server.
>
> ...
>        public static void main(String[] args) throws Exception {
>                try {
>                        Server server = startJettyServer(8080);
>                        System.in.read();
>                        System.out.println(">>> STOPPING EMBEDDED JETTY 
> SERVER");
>                        // while (System.in.available() == 0) {
>                        // Thread.sleep(5000);
>                        // }
>                        server.stop();
>                        server.join();
>                } catch (Exception e) {
>                        e.printStackTrace();
>                        System.exit(100);
>                }
>        }
>
>        public static Server startJettyServer(int port) throws Exception {
>                Server server = new Server();
>                SocketConnector connector = new SocketConnector();
>                // Set some timeout options to make debugging easier.
>                connector.setMaxIdleTime(1000 * 60 * 60);
>                connector.setSoLingerTime(-1);
>                connector.setPort(port);
>                server.setConnectors(new Connector[] { connector });
>
>                WebAppContext bb = new WebAppContext();
>                bb.setServer(server);
>                bb.setContextPath("/");
>                bb.setWar("src/main/webapp");
>                bb.setAttribute("serveIcon", false);
>
>                Permission perm = new AllPermission();
>                PermissionCollection permissions = 
> perm.newPermissionCollection();
>                permissions.add(perm);
>
>                bb.setPermissions(permissions);
>                // START JMX SERVER
>                // MBeanServer mBeanServer =
>                // ManagementFactory.getPlatformMBeanServer();
>                // MBeanContainer mBeanContainer = new 
> MBeanContainer(mBeanServer);
>                // server.getContainer().addEventListener(mBeanContainer);
>                // mBeanContainer.start();
>
>                server.addHandler(bb);
>
>                System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS 
> ANY KEY TO STOP");
>                server.start();
>                return server;
>        }
> ...
>
>
> I alreasy searched the jetty doc, but could not found any hints.
> Appreciate any input on that.
>
> Mit freundlichen Grüßen
> Andreas Reiche
>
> Landesamt für Geoinformation und Landentwicklung Niedersachsen (LGLN)
> - Landesvermessung und Geobasisinformation -
> Fachgebiet 423 - Wertermittlungsinformation, Geschäftsnachweise, KLR
> Podbielskistraße 331, 30659 Hannover
> Tel.:    0511 64609-443
> Fax:     0511 64609-128
> mailto:andreas.rei...@lgln.niedersachsen.de
> www.lgln.niedersachsen.de
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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



Re: StringValue.toOptionalLong incorrect behavior

2011-12-20 Thread Martin Grigorov
Ticket please!

2011/12/20 Илья Нарыжный :
> Hello,
>
> Up this topic. Are you planning to fix this functionality with
> toOptionalString?
>
> Thanks,
>
> Ilis
>
> 2011/11/16 vineet semwal 
>
>>  yeah not needed for toOptionalString() but why not for
>> toOptionalBoolean()?
>>
>> On Wed, Nov 16, 2011 at 3:39 PM, Martin Grigorov 
>> wrote:
>> > Hi,
>> >
>> > On Wed, Nov 16, 2011 at 11:50 AM, vineet semwal
>> >  wrote:
>> >> martin i too think tooptionalMethods in StringValue should behave the
>> >> way llia is saying ie. they should return null if text is empty or
>> >> null..
>> >
>> > Hm. Not quite convinced.
>> > ?a=b&c=&e=f is a valid query string and 'c' has value "" while 'g' has
>> null
>> >
>> > maybe just some of toOptionalXyz() methods should use Strings.isEmpty()
>> > e.g. toOptionalString() and toOptionalBoolean() should not check for ""
>> >
>> >> for eg. currently  public final Long toOptionalLong() throws
>> >> StringValueConversionException
>> >>        {
>> >>                return (text == null) ? null : toLongObject();
>> >>        }
>> >>
>> >> can be changed to
>> >>  public final Long toOptionalLong() throws
>> StringValueConversionException
>> >>        {
>> >>                return (Strings.isEmpty(text)) ? null : toLongObject();
>> >>        }
>> >>
>> >> On Wed, Nov 16, 2011 at 2:57 PM, Martin Grigorov 
>> wrote:
>> >>> Hi,
>> >>>
>> >>> At least this is what the javadoc says:
>> >>> "Convert to object types, returning null if text is null."
>> >>>
>> >>> I think the more appropriate method for you is
>> >>> org.apache.wicket.util.string.StringValue.toLong(long) but it also
>> >>> throws exceptions if the provided value is empty string.
>> >>>
>> >>> On Wed, Nov 16, 2011 at 11:00 AM, Илья Нарыжный 
>> wrote:
>>  Hello,
>> 
>>  I have page mounted as @MountPath("/page/#{pageId}")
>> 
>>  Also I have following code:
>> 
>>  public ViewPagePage(PageParameters params)
>>     {
>>         this(getEntityPkFor(params, Page.class, 1)); //1 - is default
>> ID if
>>  PK in url was not found
>>     }
>> 
>>  and:
>> 
>>  protected static Long getEntityPkFor(PageParameters params, Class
>> clazz,
>>  Long defaultPk)
>>     {
>>         String pkFieldName =
>> EntitiesDescriptor.get().getPkFieldName(clazz);
>>         Long ret=null;
>>         if(pkFieldName!=null)
>>         {
>>             ret = params.get(pkFieldName).toOptionalLong();
>>         }
>>         if(ret==null)
>>         {
>>             ret = params.get("id").toOptionalLong();
>>         }
>>         return ret==null?defaultPk:ret;
>>     }
>> 
>>  But(!!!) if ID was not put to the URL I have following Exception:
>> 
>>  Caused by:
>> org.apache.wicket.util.string.StringValueConversionException:
>>  Unable
>>  to convert '' to a Long value
>>         at
>>  org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
>>  va:589)
>>         at
>>  org.apache.wicket.util.string.StringValue.toOptionalLong(StringValue.
>>  java:657)
>>         at ru.ydn.wicket.EntityPage.getEntityPkFor(EntityPage.java:57)
>>         at ru.ydn.wicket.web.ViewPagePage.(ViewPagePage.java:84)
>>         ... 37 more
>>  Caused by: java.lang.NumberFormatException: For input string: ""
>>         at
>>  java.lang.NumberFormatException.forInputString(NumberFormatException.
>>  java:48)
>>         at java.lang.Long.parseLong(Long.java:431)
>>         at java.lang.Long.(Long.java:678)
>>         at
>>  org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
>>  va:585)
>> 
>>  The problem in following code:
>> 
>>  public final Long toOptionalLong() throws
>> StringValueConversionException
>>     {
>>         return (text == null) ? null : toLongObject();
>>     }
>> 
>>  text should be checked for emptiness - not only null
>> 
>>  What do you think?
>> 
>>  Thanks,
>> 
>>  Ilia
>> 
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> 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
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> thank you,
>> >>
>> >> regards,
>> >> Vineet Semwal
>> >>
>> >> -
>> >> 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 uns

Re: StringValue.toOptionalLong incorrect behavior

2011-12-20 Thread Илья Нарыжный
Hello,

Up this topic. Are you planning to fix this functionality with
toOptionalString?

Thanks,

Ilis

2011/11/16 vineet semwal 

>  yeah not needed for toOptionalString() but why not for
> toOptionalBoolean()?
>
> On Wed, Nov 16, 2011 at 3:39 PM, Martin Grigorov 
> wrote:
> > Hi,
> >
> > On Wed, Nov 16, 2011 at 11:50 AM, vineet semwal
> >  wrote:
> >> martin i too think tooptionalMethods in StringValue should behave the
> >> way llia is saying ie. they should return null if text is empty or
> >> null..
> >
> > Hm. Not quite convinced.
> > ?a=b&c=&e=f is a valid query string and 'c' has value "" while 'g' has
> null
> >
> > maybe just some of toOptionalXyz() methods should use Strings.isEmpty()
> > e.g. toOptionalString() and toOptionalBoolean() should not check for ""
> >
> >> for eg. currently  public final Long toOptionalLong() throws
> >> StringValueConversionException
> >>{
> >>return (text == null) ? null : toLongObject();
> >>}
> >>
> >> can be changed to
> >>  public final Long toOptionalLong() throws
> StringValueConversionException
> >>{
> >>return (Strings.isEmpty(text)) ? null : toLongObject();
> >>}
> >>
> >> On Wed, Nov 16, 2011 at 2:57 PM, Martin Grigorov 
> wrote:
> >>> Hi,
> >>>
> >>> At least this is what the javadoc says:
> >>> "Convert to object types, returning null if text is null."
> >>>
> >>> I think the more appropriate method for you is
> >>> org.apache.wicket.util.string.StringValue.toLong(long) but it also
> >>> throws exceptions if the provided value is empty string.
> >>>
> >>> On Wed, Nov 16, 2011 at 11:00 AM, Илья Нарыжный 
> wrote:
>  Hello,
> 
>  I have page mounted as @MountPath("/page/#{pageId}")
> 
>  Also I have following code:
> 
>  public ViewPagePage(PageParameters params)
> {
> this(getEntityPkFor(params, Page.class, 1)); //1 - is default
> ID if
>  PK in url was not found
> }
> 
>  and:
> 
>  protected static Long getEntityPkFor(PageParameters params, Class
> clazz,
>  Long defaultPk)
> {
> String pkFieldName =
> EntitiesDescriptor.get().getPkFieldName(clazz);
> Long ret=null;
> if(pkFieldName!=null)
> {
> ret = params.get(pkFieldName).toOptionalLong();
> }
> if(ret==null)
> {
> ret = params.get("id").toOptionalLong();
> }
> return ret==null?defaultPk:ret;
> }
> 
>  But(!!!) if ID was not put to the URL I have following Exception:
> 
>  Caused by:
> org.apache.wicket.util.string.StringValueConversionException:
>  Unable
>  to convert '' to a Long value
> at
>  org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
>  va:589)
> at
>  org.apache.wicket.util.string.StringValue.toOptionalLong(StringValue.
>  java:657)
> at ru.ydn.wicket.EntityPage.getEntityPkFor(EntityPage.java:57)
> at ru.ydn.wicket.web.ViewPagePage.(ViewPagePage.java:84)
> ... 37 more
>  Caused by: java.lang.NumberFormatException: For input string: ""
> at
>  java.lang.NumberFormatException.forInputString(NumberFormatException.
>  java:48)
> at java.lang.Long.parseLong(Long.java:431)
> at java.lang.Long.(Long.java:678)
> at
>  org.apache.wicket.util.string.StringValue.toLongObject(StringValue.ja
>  va:585)
> 
>  The problem in following code:
> 
>  public final Long toOptionalLong() throws
> StringValueConversionException
> {
> return (text == null) ? null : toLongObject();
> }
> 
>  text should be checked for emptiness - not only null
> 
>  What do you think?
> 
>  Thanks,
> 
>  Ilia
> 
> >>>
> >>>
> >>>
> >>> --
> >>> 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
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> thank you,
> >>
> >> regards,
> >> Vineet Semwal
> >>
> >> -
> >> 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
> >
> >
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> --

Problem with embedded jetty using AWT

2011-12-20 Thread Reiche, Andreas
Hi,
has anyone already recognized this behaviour.
I have a Wicket (1.4.18) project build from the Wicket archetype. I'm 
developing in Eclipse on a Win XP machine.
Up to now everything worked fine, but now i have the following problem:
I need to inherit a dynamic Image in a wicket page. I use the AWT toolkit for 
that purpose.
As Wicket Model i use a RenderedDynamicImageResource which gives me a 
Graphics2D object to draw on.
If i try to debug or run the code in the embedded jetty which i use in my IDE 
then the JVM 'hangs' and the image is not rendered.

If i deploy the app to a standalone jetty or a standalone tomcat everything 
goes fine.
This is exactly the problem which is described here:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1290008946#N1290102636

First i thought of a security issue, like mentioned in above thread, but even 
after i gave the embedded jetty a java.security.AllPermission
the prob still exits.

Here is the code which creates and starts the jetty server.

...
public static void main(String[] args) throws Exception {
try {
Server server = startJettyServer(8080);
System.in.read();
System.out.println(">>> STOPPING EMBEDDED JETTY 
SERVER");
// while (System.in.available() == 0) {
// Thread.sleep(5000);
// }
server.stop();
server.join();
} catch (Exception e) {
e.printStackTrace();
System.exit(100);
}
}

public static Server startJettyServer(int port) throws Exception {
Server server = new Server();
SocketConnector connector = new SocketConnector();
// Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
connector.setPort(port);
server.setConnectors(new Connector[] { connector });

WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/main/webapp");
bb.setAttribute("serveIcon", false);

Permission perm = new AllPermission();
PermissionCollection permissions = 
perm.newPermissionCollection();
permissions.add(perm);

bb.setPermissions(permissions);
// START JMX SERVER
// MBeanServer mBeanServer =
// ManagementFactory.getPlatformMBeanServer();
// MBeanContainer mBeanContainer = new 
MBeanContainer(mBeanServer);
// server.getContainer().addEventListener(mBeanContainer);
// mBeanContainer.start();

server.addHandler(bb);

System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS 
ANY KEY TO STOP");
server.start();
return server;
}
...


I alreasy searched the jetty doc, but could not found any hints.
Appreciate any input on that. 

Mit freundlichen Grüßen
Andreas Reiche

Landesamt für Geoinformation und Landentwicklung Niedersachsen (LGLN)
- Landesvermessung und Geobasisinformation -
Fachgebiet 423 - Wertermittlungsinformation, Geschäftsnachweise, KLR
Podbielskistraße 331, 30659 Hannover
Tel.:0511 64609-443
Fax: 0511 64609-128
mailto:andreas.rei...@lgln.niedersachsen.de
www.lgln.niedersachsen.de

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



Re: Add items and then submit a form

2011-12-20 Thread Tito
Great!!
It works ok!

Thank you very much.

On Tue, Dec 20, 2011 at 6:21 AM, Andrea Del Bene wrote:

> This should not be a big deal. Wicket lets you put form submitting button
> outside form itself. All you have to do to make it work is to pass the form
> to component's constructor.
>
>
> HTML code:
>
>
> 
>
> 
>
> 
> 
>
> 
>
> 
>
>
> Java code:
>
>
>
> add(form1 = new Form("form1"){
>   @Override
>protected void onSubmit() {
>super.onSubmit();
>System.out.println("form1");
>}
>   });
>
>add(new SubmitLink("submit1", form1));
>
>Form form2;
>
>add(form2 =new Form("form2"){
>@Override
>protected void onSubmit() {
>super.onSubmit();
>System.out.println("form2");
>}
>   });
>
>form2.add(new SubmitLink("submit2"));
>
>
>
> Button "submit1" is outside its form and you have two separated form.
>
>
>
>  I think you are right.
>> Using an AjaxButton it works a litle more like I want.
>>
>> Nevertheless I still have a problem, because outer form submits inner
>> form.
>>
>> In my case I think that I need two separated forms, but the problem is how
>> to put add button y save button in the correct place. I mean, the layout
>> is
>> what you mentioned but the behavior is more like two separated forms.
>> Thank you!
>>
>> On Mon, Dec 19, 2011 at 2:04 PM, Andrea Del Bene**
>> wrote:
>>
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: freezing applications

2011-12-20 Thread danisevsky
You are right! Thank you very much!


2011/12/19 Tito :
> Do you have a security filter?
> I think may be you have the session expired and ajax requests don't get
> wicket filter.
>
>
> On Mon, Dec 19, 2011 at 3:33 PM, danisevsky  wrote:
>
>> Hello, our application is one page and everything is done by ajax. And
>> tester says that when he comes from lunch all buttons are dead.
>> Nothing happen when he clicks on links or buttons. I can't reproduce
>> this behavior because on my machine I always get pageExpiredException
>> (what is required). Is it possible to have dead wicket ajax components
>> when server is running? We are running on Wicket 1.4.18.
>>
>> 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: any idea where this error comes from?

2011-12-20 Thread cosmindumy
Yes, definitely. 
But this is not the cause, as this error doesn't occur each time I hide/show
this container. Actually I couldn't reproduce on my dev machine. I don't
know when this error occurs in order to find the cause. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/any-idea-where-this-error-comes-from-tp4217040p4217192.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: any idea where this error comes from?

2011-12-20 Thread Andrea Del Bene

On 20/12/11 09:38, cosmindumy wrote:

Hi,
I've got an error on production server and I cannot reproduce on my
development machine. The error says :
woUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible
org.apache.wicket.WicketRuntimeException: Submit Button
stepTwoUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible

Which can be the cause? The submit button is never hidden, but the container
that holds it.


But if you hide container  you hide also its children components, right?



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



Re: Add items and then submit a form

2011-12-20 Thread Andrea Del Bene
This should not be a big deal. Wicket lets you put form submitting 
button outside form itself. All you have to do to make it work is to 
pass the form to component's constructor.


HTML code:













Java code:


add(form1 = new Form("form1"){
   @Override
protected void onSubmit() {
super.onSubmit();
System.out.println("form1");
}
   });

add(new SubmitLink("submit1", form1));

Form form2;
add(form2 =new Form("form2"){
@Override
protected void onSubmit() {
super.onSubmit();
System.out.println("form2");
}
   });

form2.add(new SubmitLink("submit2"));



Button "submit1" is outside its form and you have two separated form.



I think you are right.
Using an AjaxButton it works a litle more like I want.

Nevertheless I still have a problem, because outer form submits inner form.

In my case I think that I need two separated forms, but the problem is how
to put add button y save button in the correct place. I mean, the layout is
what you mentioned but the behavior is more like two separated forms.
Thank you!

On Mon, Dec 19, 2011 at 2:04 PM, Andrea Del Benewrote:



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



Getting response from a external URL

2011-12-20 Thread Pablo Díaz

Hi,

I'm trying to do something like an internal proxy in my web-app to check 
permisions to connect from my portal to a mapserver server.


So, I'm trying to get de request from an OpenLayers and redirect the 
connection throw my internal proxy (after check the roles) .

I've done this before in Struts, but I don't know how do this in Wicket.
In Struts is something similar to do this:

HttpClient client = new HttpClient();
GetMethod method = new GetMethod(mapserverURL);

method.getParams().setVersion(HttpVersion.HTTP_1_0);

// Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));

method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,

"ISO-8859-1");
method.getParams().setCredentialCharset("ISO-8859-1");

try {
// Execute the method.
int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + 
method.getStatusLine());

}

InputStream input = method.getResponseBodyAsStream();
output = response.getOutputStream();

byte[] data = new byte[1];
for (;;) {

if ((input.read(data)) == -1) {
break;
}

output.write(data);

}
} catch (HttpException e) {
System.err.println("Fatal protocol violation: " + 
e.getMessage());

e.printStackTrace();
return null;
} catch (IOException e) {
System.err.println("Fatal transport error: " + 
e.getMessage());

e.printStackTrace();
return null;
} finally {
// Release the connection.
method.releaseConnection();
}
return null;

Can anybody help me?

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



any idea where this error comes from?

2011-12-20 Thread cosmindumy
Hi,
I've got an error on production server and I cannot reproduce on my
development machine. The error says :
woUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible
org.apache.wicket.WicketRuntimeException: Submit Button
stepTwoUploadFilesContainer:calculateButton
(path=inputForm:stepTwoUploadFilesContainer:calculateButton) is not visible

Which can be the cause? The submit button is never hidden, but the container
that holds it.
Here is the button code:
calculateButton = new CalculateButton("calculateButton",
"/wos/stepTwoUploadFiles/calculate");
calculateButton.setDefaultFormProcessing(false);
add(calculateButton);

I suppose that this is the code where it enters from Form class from wicket
sources :
if (!component.isVisibleInHierarchy())
{
throw new
WicketRuntimeException("Submit Button " +
   
submittingComponent.getInputName() + " (path=" +
   
component.getPageRelativePath() + ") is not visible");
}

Has anyone any idea? 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/any-idea-where-this-error-comes-from-tp4217040p4217040.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