Re: howto JSON Wicket works?

2007-11-25 Thread Johan Compagner
Again, why do you try to generate a json object in the browser??
Why not create a normal wicket form that you post to the server and
then in the form submit method you create the json object

On 11/24/07, Pen [EMAIL PROTECTED] wrote:


 I don't know how to get the postdata from the request object in wicket. I do
 see the request being sent. As you see from the example I am struck there, I
 don't know how to proceed further.
 This is just a basic example of round trip using Json, AJax and wicket
 through form submit. You get the Json data modify it update back the form.
 There will be more complicated of this like grid update.
 Also there can be normal form submit of Json object. In either case I don't
 know how to handle on the server in wicket. I have done lot using JSP, it
 looks bit different here. And no good documentation.
 If you can provide some coding example or some pointer it would be great.

 ~Pen





 Johan Compagner wrote:
 
  Which part goes wrong?
  Do you see the request being send?
  Why do this though json? If you need json objects on the server why
  not using  a normal form post and create the json object on the
  server?
 
  2007/11/24, Pen [EMAIL PROTECTED]:
 
  Greetings,
 
  I want to know how to handle the Jquery, JSon data in the wicket. What is
  the best way to do it.
  I have created simple form which sends the json data across to server and
  replies back to the form.
  I am not sure how to handle the request and response in wicket. I am
  using
  Json-lib 2.1 for jdk1.5
  Can anybody analyze the below program and suggest me what is wrong.
 
  demo.html
  head
 script src=scripts/jquery-1.2.1.js type=text/javascript
  charset=utf-8/script  
 script type=text/javascript charset=utf-8
 $(document).ready(function() {
 $(#testForm).submit(sendForm);
 });
 
 function sendForm(e) {
 e.preventDefault();
 var data = {
 field1: $(#field1).val(),
 field2: $(#field2).val(),
 field3: $(#field3).val(),
 };
 
 $(#sent .content).html(data.toSource());
 $.post(demo, message=[ + data.toSource() + ];, 
  receiveForm,
  json);
 };  
 
  function receiveForm(data) {
 $(#field1).val(data.field1);
 $(#field2).val(data.field2);
 $(#field3).val(data.field3);
 
 $(#received .content).html(data.toSource());
 };
 /script
 
  /head
  body
 
  form wicket:id=testForm  
 h1 id=formForm/h1
 
 label for=field1Field One:/label
 input type=text id=field1 /
 
 label for=field2Field Two:/label
 input type=text id=field2 /
 
 label for=field3Field Three:/label
 input type=text id=field3 /
 
 input type=submit id=submitter value=Post the data /
  /form
 
  div id=sent class=readout
 h1 id=sent_data:Sent Data:/h1
 div class=content
 
 /div
  /div
  div id=received class=readout
 
 h1 id=received_dataReceived Data:/h1
 div class=content
 
 /div
  /div
  /body
  /html
 
  Here is the wicket program to handle this
 
  demo.java
  public class Demo extends BasePage {
 public Demo() {
 
 Form form = new Form(testForm,new 
  CompoundPropertyModel(this));
 add(form);
 form.add(new AjaxFormSubmitBehavior(form,onsubmit){
 private static final long serialVersionUID = 1L;
  
 
 protected void onSubmit(AjaxRequestTarget target) {
 Request request = getRequest();
 String data = request.getParameter(data); 
  
 try {
 JSONObject jsonData = new JSONObject();
 JSONObject selectedNode = 
  jsonData.getJSONObject(data); 
 } catch (Exception e) {
 throw new RuntimeException(Failed to 
  parse selected node from
  reply: 
  + data);
 }
 //target.addComponent(received)// Add to the 
  response data
 }
 });
 }
  }
 
 
  ~Pen
  --
  View this message in context:
  http://www.nabble.com/howto-JSON-Wicket-works--tf4865188.html#a13922782
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  

Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread Johan Compagner
Can we then make something where we ask some setting first for the
host part? If not found we generate from the current request, which i
think for many many production environments will not  really work
because who doesnt virtualhost or puts apache in front of it?

On 11/25/07, Al Maw [EMAIL PROTECTED] wrote:
 Oliver Lieven wrote:
  is there a way to determine the complete, absolute URL to a mounted page
  (including protocol, host, port, application, filter and destination
 page)?
  I need this to be able to send a link to a Registration-Confirmation page
 to
  a user via email.

 Ah, yes, I've been meaning to get around to fixing that since forever,
 sorry. :-(

 See http://issues.apache.org/jira/browse/WICKET-609

 That's pretty apalling in terms of timescales. Apologies to all
 involved. Will have a look before RC2, promise. ;-)

 In the meantime, you can go:
 String url = http://yourserver.com/; +
 RequestCycle.get().urlFor([...]).replaceAll(\\.\\./, );

 Regards,

 Al

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Regression in 1.3.0-beta3(?)

2007-11-25 Thread Johannes Schneider
https://issues.apache.org/jira/browse/WICKET-1185

Johan Compagner wrote:
 please make a jira issue for this
 
 On Nov 22, 2007 9:49 PM, Johannes Schneider [EMAIL PROTECTED]
 wrote:
 
 I have the same problem with 1.3.0-rc1...

 I have tried to create a minimal example, but did not work...
 The problem occurres within this project:
 http://cedarsoft.org/wicket/yaml-integration/index.html


 Regards,

 Johannes Schneider

 Igor Vaynberg wrote:
 have you tried it with trunk?

 -igor


 On 8/31/07, Johannes Schneider [EMAIL PROTECTED] wrote:
 I don't use any AjaxFAllbackOrderByBorder or anything else in my code.
 So I think there must be another trigger for the bug, too.


 Johannes Schneider

 Jonas-21 wrote:
 I've been able to reproduce the problem with a these few classes:
 http://www.nabble.com/file/p12409279/Expected_close_tag.zip
 Expected_close_tag.zip

 It seems to be caused by the problem that BorderBodyResolver warns
 about:
 Unlike OrderByBorder, AjaxFallbackOrderByBorder doesn't add the
 BorderBodyContainer
 so it fits the markup.
 Now, if AjaxFallbackOrderByBorder is wrapped in another Border (as in
 my
 attached
 example), we don't get that nice log message, instead we get that
 'Expected
 close tag for ...'
 message.

 So, it seems https://issues.apache.org/jira/browse/WICKET-166
 actually IS relevant for wicket 1.3.0. (Of course the fix looks now
 different
 because of the api change)

 cheers,
 Jonas


 igor.vaynberg wrote:
 hmm, if you could create a quickstart for this it would be very
 helpful.
 -igor

 --
 Johannes Schneider
 Im Lindenwasen 15
 72810 Gomaringen

 Fon +49 7072 9229972
 Fax +49 7072 50
 Mobil +49 178 1364488

 [EMAIL PROTECTED]
 http://www.johannes-schneider.info


 --
  Johannes Schneider
 Im Lindenwasen 15
 72810 Gomaringen

 Fon +49 7072 9229972
 Fax +49 7072 50
 Mobil +49 178 1364488

 [EMAIL PROTECTED]
 http://www.johannes-schneider.info

 

-- 
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen

Fon +49 7072 9229972
Fax +49 7072 50
Mobil +49 178 1364488

[EMAIL PROTECTED]
http://www.johannes-schneider.info


smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread Johan Compagner
If you virtual host in apache on a server (local ip 10.0.0.1)

so

www.mydomain.com/

is virtual hosted by a tomcat server on a local network (10.0.0.2)

10.0.0.2:8080/myapp1context

and you do a request to apach
it will rewrite the url and give it to tomcat
Then the request url is really
http://10.0.0.2:8080/myapp1context/XX

this pdf also explains it a bit:
http://www.amitysolutions.com.au/documents/URLRewriting-technote.pdf

On Nov 25, 2007 7:32 PM, Jonathan Locke [EMAIL PROTECTED] wrote:



 sounds okay, but is it really necessary?  can you explain why?
 i always thought the browser would send the full request URL.
 in fact, i've had tomcat behind apache and this just works.


 Johan Compagner wrote:
 
  Can we then make something where we ask some setting first for the
  host part? If not found we generate from the current request, which i
  think for many many production environments will not  really work
  because who doesnt virtualhost or puts apache in front of it?
 
  On 11/25/07, Al Maw [EMAIL PROTECTED] wrote:
  Oliver Lieven wrote:
   is there a way to determine the complete, absolute URL to a mounted
  page
   (including protocol, host, port, application, filter and destination
  page)?
   I need this to be able to send a link to a Registration-Confirmation
  page
  to
   a user via email.
 
  Ah, yes, I've been meaning to get around to fixing that since forever,
  sorry. :-(
 
  See http://issues.apache.org/jira/browse/WICKET-609
 
  That's pretty apalling in terms of timescales. Apologies to all
  involved. Will have a look before RC2, promise. ;-)
 
  In the meantime, you can go:
  String url = http://yourserver.com/; +
  RequestCycle.get().urlFor([...]).replaceAll(\\.\\./, );
 
  Regards,
 
  Al
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-determine-absolute-URL-of-a-mounted-page--tf4864119.html#a13938331
 Sent from the Wicket - User mailing list archive at 
 Nabble.comhttp://nabble.com/
 .


 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread John Patterson


On 25 Nov 2007, at 13:01, Johan Compagner wrote:


If you virtual host in apache on a server (local ip 10.0.0.1)
it will rewrite the url and give it to tomcat
Then the request url is really
http://10.0.0.2:8080/myapp1context/XX


I use Apache as a proxy and have got past this issue by using this  
directive:


 ProxyPreserveHost On

Stops the host name being rewritten so redirects etc still work  
correctly.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Lightbox javascript

2007-11-25 Thread Igor Vaynberg
something like this would be nice in wicketstuff-minis ...

-igor


On Nov 25, 2007 5:15 AM, Uwe Schäfer [EMAIL PROTECTED] wrote:
 hi

 with significant help of the IRC, i did a Lightbox2-Panel-Component,
 that can be found here:

 http://www.codesmell.org/org.codesmell.wicket.lightbox

 thanks to the helping hands, comments appreciated.
 cu uwe

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread Johan Compagner
also the port?




On Nov 25, 2007 8:47 PM, John Patterson [EMAIL PROTECTED] wrote:


 On 25 Nov 2007, at 13:01, Johan Compagner wrote:

  If you virtual host in apache on a server (local ip 10.0.0.1)
  it will rewrite the url and give it to tomcat
  Then the request url is really
  http://10.0.0.2:8080/myapp1context/XX

 I use Apache as a proxy and have got past this issue by using this
 directive:

  ProxyPreserveHost On

 Stops the host name being rewritten so redirects etc still work
 correctly.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Lightbox javascript

2007-11-25 Thread Uwe Schäfer

Igor Vaynberg schrieb:

something like this would be nice in wicketstuff-minis ...
  


i´d be glad to contribute it into wicketstuff-minis, as soon as it is 
mature enough. currently it lacks some features i´d like to add. expect 
this to be done in a few weeks. promise.


cu uwe


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread John Patterson


On 25 Nov 2007, at 15:26, Johan Compagner wrote:


also the port?



Yes the port is also contained in the host header so it works fine -  
as if the proxy was not there at all.  I know that Jetty always  
respects the host header.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread Sebastiaan van Erk

Ryan Sonnek wrote:

I'm trying to accomplish the same thing and think that wicket should
provide such an API.  all of the issues mentioned are well known
issues and other web frameworks still provide an API and just
acknowledge the limitations.

This is pretty important for me as I can't necessarily hardcode the
url when the application runs in several different environments
(production vs development for example).  please vote for this JIRA
issue and hopefully we can get some kind of API added.
https://issues.apache.org/jira/browse/WICKET-609


I have production versus development as well; this does not preclude me 
from having different settings for each. There's a whole bunch of other 
settings which are prod/dev dependent anyhow, like database connection, 
admin email address (me on dev, the real application admin on prod), 
hibernate settings, etc... What's one more property?


Personally I'd rather put it in a config file and know it's right rather 
than have it break if someone decides to virtual host/firewall/proxy the 
webapp and forgets to tweak the settings just right, (e.g., forgets the 
ProxyPreserveHost directive).


Regards,
Sebastiaan



On Nov 23, 2007 7:03 PM, Oliver Lieven [EMAIL PROTECTED] wrote:

Hi Sebastiaan,

thanks for your answer. Excellent point on potential problems when using
clusters, firewalls and proxies (I run into those already).

I also thought on providing the URLs in a configuration file/spring config,
but feared there might be a simple and preferred Wicket way to determine
the URLs.

Thanks alot,
Oliver








Sebastiaan van Erk wrote:

What's wrong with putting this in a configuration file or just a
constant. Because in general this does not really work.

For example, your web server may be behind a proxy or firewall, it may
be clustered (and thus you have many machines instead of just one and
they can't all have the same hostname), they may be running on a port 
1024 because of security concerns, with the firewall redirecting traffic
on port 80 to the webserver.

Personally I use spring and generally put the hostname/port combination
in a properties file which spring uses to inject it into the application
class. I have different properties files for dev and production which
are activated by different maven profiles.

However if you really want to do this (which I don't advise) you can use
the HttpServletRequest to find your information using:

  getWebRequestCycle().getWebRequest().getHttpServletRequest()

Regards,
Sebastiaan

Oliver Lieven wrote:

Hi,

is there a way to determine the complete, absolute URL to a mounted page
(including protocol, host, port, application, filter and destination
page)?
I need this to be able to send a link to a Registration-Confirmation page
to
a user via email.

I searched the forum already, but didn't find a working solution. All I
found were messages saying that since Wicket 1.3 all URLs are relative.
Reading the JavaDoc I also found various urlFor() and
getRelativePath...()
methods, all returning relative paths.

What I would need is a method with a signature similar to

url = getAbsolutePath(Request request, Class pageClass,
PageParameters
parameters)

which returns an url like
http://localhost:8080/myapp/app/page-alias?...params...

Thanks for any hints on this,
Oliver





--
View this message in context: 
http://www.nabble.com/How-to-determine-absolute-URL-of-a-mounted-page--tf4864119.html#a13920421

Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to determine absolute URL of a mounted page?

2007-11-25 Thread Ryan Sonnek
 Personally I'd rather put it in a config file and know it's right rather
 than have it break if someone decides to virtual host/firewall/proxy the
 webapp and forgets to tweak the settings just right, (e.g., forgets the
 ProxyPreserveHost directive).

That's why you have automated tests to make sure that someone doesn't
break your configuration right?  =)

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Jasypt + ICrypt + ICryptFactory

2007-11-25 Thread Daniel Fernández Garrido


Thank you for your answers. As you can see, I have already done the release.

Let's hope this is useful for someone :-)

Regards,
Daniel.



Eelco Hillenius wrote:

But the question here is... what is the real use of the ICryptFactory today
(1.3.0-rc1) in wicket? Is it only encrypting URLs? (I see
PasswordTextFields are not encrypted anymore)



Yep, I think we removed the other uses. I don't know exactly from the
top of my head, but it is in the (recent) mail archives.

  

And if so, would it be of real use/need? Of course, It would increase much
(as much as Java can) the security of the URLs' encryption but, would you
see any other uses?



I can't really think of anything else besides that it is available as
a nice utility class.

  

If this is only used for encrypting URLs, and if I am not wrong, our
WebApplication class would also need something like this:


--(CODE WHICH WOULD GO INTO OUR WebApplication CLASS)--

  @Override
  protected IRequestCycleProcessor newRequestCycleProcessor() {

  return new WebRequestCycleProcessor() {
  @Override
  protected IRequestCodingStrategy newRequestCodingStrategy() {
  return new CryptedUrlWebRequestCodingStrategy(new
WebRequestCodingStrategy());
  }
  };

  }



Something like that yeah :-)


  

And more important: can I consider wicket's ICrypt and ICryptFactory
interfaces *stable*? (at least until a stable 1.3.0 release). Have you got
any short-term plans for changing anything in this encryption
infrastructure?



That's definitively a stable interface. I don't see us changing that
any time soon. Btw, now that we are in RC mode, we won't be changing
any of the API unless there are very pressing matters, in which case
we'll have a vote about it. The idea is to enable users to just drop
in new versions/ jars in RC/ finals without having to fix for API
changes.

  

So, JasyptCrypt will always throw an exception if this method is called.
Currently in wicket, setKey is only called from
org.apache.wicket.util.crypt.ClassCryptFactory, which jasypt does not
extend, so this would not pose any problems for the future, but... could it
make sense that that setKey method were called by the developer anywhere
else? this would render jasypt integration quite complicated...



I guess we'll hear if that is a problem for someone :-)

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



wicket + gwt

2007-11-25 Thread Jonathan Locke

i noticed daniel carleton was working on wicket gwt integration, but the wiki
page makes it look incomplete.  has anyone gone any further on this?
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-gwt-tf4872556.html#a13942831
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Stateless Form

2007-11-25 Thread Joshua Jackson
Dear all,

I've made a Page with the usual Form component. The use case is users
are able to enter data from this form more than once when they are
still on that page. But the problem is the state of the object from
that form is kept, so it looks like that user enters the same data.

So I tried using StatelessForm and it worked. But is there anything
I've sacrificed if I use StatelessForm? And is there any other way so
the state from the form is not kept other than using StatelessForm?

Thanks in advance.

-- 
What you want today, may not exist tommorrow

Blog: http://joshuajava.wordpress.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Stateless Form

2007-11-25 Thread Johan Compagner
If you use a stateless form then the complete page is recreated when
the user does a submit, the plus is then that you never have an
expired page and for you that you start fresh. But that starting fresh
is only because you page is fully stateless, if you had some other
none stateless thing on it (link, ajax behavior). Then you still had
the same problem, because the page is reused.

What you should do in that case is set the backing object/model to a
new object again in the submit method. so use a compound property
model on your form with a bean and set a new bean in the model

On 11/26/07, Joshua Jackson [EMAIL PROTECTED] wrote:
 Dear all,

 I've made a Page with the usual Form component. The use case is users
 are able to enter data from this form more than once when they are
 still on that page. But the problem is the state of the object from
 that form is kept, so it looks like that user enters the same data.

 So I tried using StatelessForm and it worked. But is there anything
 I've sacrificed if I use StatelessForm? And is there any other way so
 the state from the form is not kept other than using StatelessForm?

 Thanks in advance.

 --
 What you want today, may not exist tommorrow

 Blog: http://joshuajava.wordpress.com/

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]