Re: HTTP Response Splitting issue when reaching Wicket through AJP

2011-11-04 Thread Gert-Jan Schouten

Done!

https://issues.apache.org/jira/browse/WICKET-4196

*Gert-Jan Schouten
Java Developer*


On 03/11/11 15:16, Igor Vaynberg wrote:

please create a jira issue.

-igor

On Thu, Nov 3, 2011 at 7:02 AM, Gert-Jan Schouten
gert-jan.schou...@roboreus.com  wrote:

Hello!

The problem is that a hacker can now post URL's that look like they're going
to your site on some forum or in an email. But when the user actually clicks
on the link, a custom header could redirect the user to a malicious site. In
the example, I used EvilHeader, but it could be any header, like an HTTP
301 redirect. Basically, the hacker can include any header he wants in the
response that the user is going to get when he clicks on the link.

For a more detailed description of HTTP Response Splitting (which is on the
OWASP list of security vulnerabilities), you can check:

https://www.owasp.org/index.php/HTTP_Response_Splitting
http://www.acunetix.com/vulnerabilities/CRLF-injectionHTTP-respon.htm
http://packetstormsecurity.org/papers/general/whitepaper_httpresponse.pdf
http://www.infosecwriters.com/text_resources/pdf/HTTP_Response.pdf

Cheers,

Gert-Jan



*Gert-Jan Schouten
Java Developer*



On 03/11/11 12:49, Martin Grigorov wrote:

Hi,

Can you describe what exactly is the problem with these custom headers ?

On Thu, Nov 3, 2011 at 2:04 PM, Gert-Jan Schouten
gert-jan.schou...@roboreus.comwrote:

Hello all,

When having a Wicket application installed on Tomcat and you call that
application through HTTP, Wicket is protected against HTTP Response
Splitting. However, when you call Tomcat through AJP (for example through
an
apache httpd proxy), HTTP Response Splitting becomes possible.

To demonstrate, I created a simple application and called it through an
AJP
proxy with the curl command:

curl --max-redirs 0 -Dfoo

'http:///myapp/home?wicket:bookmarkablePage=:org.apache.wicket.markup.html.pages.BrowserInfoPagecto=Foobar%3f%0d%0aEvilHeader:%20SPLIT%2f-%0d%0aAnotherEvilHeader:%20HEADER'

Note the '%0d%0a', a CRLF in the request. When calling Wicket through
Tomcat, these are replaced by spaces, but when calling Wicket through
AJP,
these are left intact, getting us the following response:

HTTP/1.1 302 Moved Temporarily
Date: Wed, 02 Nov 2011 14:34:32 GMT
Server: Apache
Set-Cookie: JSESSIONID=4F403B53D091B40F6C3FBC2321A2E348.pub-app04;
Path=/myapp; HttpOnly Location:

http://ip-address/myapp/Foobar;jsessionid=4F403B53D091B40F6C3FBC2321A2E348.pub-app04?
EvilHeader: SPLIT/-
AnotherEvilHeader: HEADER
Content-Length: 0
Connection: close
Content-Type: text/plain; charset=UTF-8

Here we have 2 Evil Headers, that could be inserted by hackers by adding
%0d%0a to the get-request.

Is there anything we can do about this? We use mod_jk 1.2.31 on our httpd
server.

Cheers!

Gert-Jan



--

*Gert-Jan Schouten
Java Developer*





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



Re: HTTP Response Splitting issue when reaching Wicket through AJP

2011-11-04 Thread Martin Grigorov
See the comments in the ticket

On Fri, Nov 4, 2011 at 11:57 AM, Gert-Jan Schouten
gert-jan.schou...@roboreus.com wrote:
 Done!

 https://issues.apache.org/jira/browse/WICKET-4196

 *Gert-Jan Schouten
 Java Developer*


 On 03/11/11 15:16, Igor Vaynberg wrote:

 please create a jira issue.

 -igor

 On Thu, Nov 3, 2011 at 7:02 AM, Gert-Jan Schouten
 gert-jan.schou...@roboreus.com  wrote:

 Hello!

 The problem is that a hacker can now post URL's that look like they're
 going
 to your site on some forum or in an email. But when the user actually
 clicks
 on the link, a custom header could redirect the user to a malicious site.
 In
 the example, I used EvilHeader, but it could be any header, like an
 HTTP
 301 redirect. Basically, the hacker can include any header he wants in
 the
 response that the user is going to get when he clicks on the link.

 For a more detailed description of HTTP Response Splitting (which is on
 the
 OWASP list of security vulnerabilities), you can check:

 https://www.owasp.org/index.php/HTTP_Response_Splitting
 http://www.acunetix.com/vulnerabilities/CRLF-injectionHTTP-respon.htm
 http://packetstormsecurity.org/papers/general/whitepaper_httpresponse.pdf
 http://www.infosecwriters.com/text_resources/pdf/HTTP_Response.pdf

 Cheers,

 Gert-Jan



 *Gert-Jan Schouten
 Java Developer*



 On 03/11/11 12:49, Martin Grigorov wrote:

 Hi,

 Can you describe what exactly is the problem with these custom headers ?

 On Thu, Nov 3, 2011 at 2:04 PM, Gert-Jan Schouten
 gert-jan.schou...@roboreus.com    wrote:

 Hello all,

 When having a Wicket application installed on Tomcat and you call that
 application through HTTP, Wicket is protected against HTTP Response
 Splitting. However, when you call Tomcat through AJP (for example
 through
 an
 apache httpd proxy), HTTP Response Splitting becomes possible.

 To demonstrate, I created a simple application and called it through an
 AJP
 proxy with the curl command:

 curl --max-redirs 0 -Dfoo


 'http:///myapp/home?wicket:bookmarkablePage=:org.apache.wicket.markup.html.pages.BrowserInfoPagecto=Foobar%3f%0d%0aEvilHeader:%20SPLIT%2f-%0d%0aAnotherEvilHeader:%20HEADER'

 Note the '%0d%0a', a CRLF in the request. When calling Wicket through
 Tomcat, these are replaced by spaces, but when calling Wicket through
 AJP,
 these are left intact, getting us the following response:

 HTTP/1.1 302 Moved Temporarily
 Date: Wed, 02 Nov 2011 14:34:32 GMT
 Server: Apache
 Set-Cookie: JSESSIONID=4F403B53D091B40F6C3FBC2321A2E348.pub-app04;
 Path=/myapp; HttpOnly Location:


 http://ip-address/myapp/Foobar;jsessionid=4F403B53D091B40F6C3FBC2321A2E348.pub-app04?
 EvilHeader: SPLIT/-
 AnotherEvilHeader: HEADER
 Content-Length: 0
 Connection: close
 Content-Type: text/plain; charset=UTF-8

 Here we have 2 Evil Headers, that could be inserted by hackers by
 adding
 %0d%0a to the get-request.

 Is there anything we can do about this? We use mod_jk 1.2.31 on our
 httpd
 server.

 Cheers!

 Gert-Jan



 --

 *Gert-Jan Schouten
 Java Developer*



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





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

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



RE: abort loading lazy components

2011-11-04 Thread Michal Wegrzyn
Thanks for an update Martin.

Unfortunately using IAjaxCallDecorator#decorateScript() prevents handling 
request (nothing happens).
If I append the stop script directly to ajax request target (before sending 
event), then request proceeds, but the first lazy component is not loaded.

Also, the stop script breaks ajax indicators (both from lazy components and 
indicating links). Exceptions still are present, but page isn't crashing.

So far the closest solution was using BookmarkablePageLink, but it is not ajax 
and it is just a workaround.

Isn't there a way to prevent Wicket from handling old ajax requests? I assume 
that's how it should work with DROP channel.

Best regards,
Michal Wegrzyn

 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: Thursday, November 03, 2011 17:54
 To: users@wicket.apache.org
 Subject: Re: abort loading lazy components
 
 Here is something that I didn't know so far:
 http://stackoverflow.com/questions/930237/javascript-cancel-stop-image-
 requests/1468452#1468452
 
 It seems there is a way to simulate browser's stop button with
 JavaScript.
 Try to use that code from IAjaxCallDecorator#decorateScript() for your
 AjaxLink.
 
 On Thu, Nov 3, 2011 at 3:00 PM, Michal Wegrzyn
 michal.wegr...@onior.com wrote:
  I've just debugged and indeed problem is that there is no component
 with id 29.
  So clearly Wicket looks for an lazy children component from
 outdated DataView component.
 
  Michal
 
  -Original Message-
  From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
  Sent: Wednesday, November 02, 2011 16:11
  To: users@wicket.apache.org
  Subject: RE: abort loading lazy components
 
  It is triggered when there is already new itemList (it extends
  DataView), so I suppose that
  PageAndComponentProvider looks for itemList:29, which does not
 exists
  anymore.
 
  Scenario:
 
  - Page is loaded but lazy components
  ('folders:listContainer:itemList:itemPanel:folder:children') are
 still
  loading
  - User triggers folder change (itemList is replaced)
  - Exception occurs
 
  If user triggers folder change when lazy components are completely
  loaded (or during loading the last one) there is no exception at
 all.
 
  Best Regards,
  Michal Wegrzyn
 
  -Original Message-
  From: Martin Grigorov [mailto:mgrigo...@apache.org]
  Sent: Wednesday, November 02, 2011 15:54
  To: users@wicket.apache.org
  Subject: Re: abort loading lazy components
 
  On Wed, Nov 2, 2011 at 4:49 PM, Michal Wegrzyn
  michal.wegr...@onior.com wrote:
   15:32:24.028 user [http--5] ERROR
  o.a.wicket.DefaultExceptionMapper - Unexpected error occurred
   org.apache.wicket.request.handler.ComponentNotFoundException:
 Could
  not find component
  'folders:listContainer:itemList:29:itemPanel:folder:children' on
 page
  'class package.MyPage
 
  Do you know how this is triggered ?
 
 
 
 
 
 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



Re: Orders of CSS files

2011-11-04 Thread Clint Checketts
You can manually add in the autocomplete's CSS file yourself, and wicket
won't re-add it in. That way you can add in your custom CSS after it.

-Clint

On Thu, Nov 3, 2011 at 9:43 AM, Илья Нарыжный phan...@ydn.ru wrote:

 Hello,

 Is there some way to specify final CSS file which will be used by
 browsers at the end - and that's why can rewrite some CSS rules?

 We have following case: we use wicketstuff tagit autocomplite component.
 This component contribute some CSS to the header. But we need to overwrite
 some css rules: the best solution for this to place some overwriting rules
 at the end of list of CSS files. But the problem is in that fact, that
 Wicket adds all contributed to the header things at the end of the HEAD
 file.

 Thanks,

 Ilia



jqwicket question

2011-11-04 Thread Decebal Suiu
Hello

I want to migrate from wiquery to jqwicket but I have a problem. In wiquery
I used 
add(new HeaderContributor(new CoreJavaScriptHeaderContributor())) in
BasePage to force adding jquery.js first before others js (my_application.js
or jquery plugins).
How can I do this with jqwicket?

Thanks,
Decebal

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/jqwicket-question-tp3989947p3989947.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



Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
hello,

I still find URL mapping to be far from easy. I can't get the following
mapping to work; all advice very much appreciated:

intented mapping is:

/  -- map to IndexPage.class
/b-- map to AnotherPage.class with pageparameter
param=b
/c-- map to AnotherPage.class with pageparameter
param=c

I tried creating a custom RootRequestMapper but I could not get it to work.
The closest I've come to achieving the above url mapping is with this in my
Application

 protected void init() {
  super.init();   
  mount(new MountedMapper(b, AnotherPage.class, new
CustomPageParametersEncoder(b)));
  mount(new MountedMapper(c, AnotherPage.class, new
CustomPageParametersEncoder(c)));
 }
 public Class getHomePage() {
  return IndexPage.class;
 }

where CustomPageParametersEncoder creates the pageparameter from the url in
method decodePageParameters(). 

What doesn't work here, is that requests to /b are turned into requests to
/c, with pageparameter c. 

So I end up, when requesting /b, with /c in my browser address bar, and the
page saying Hello, c, where I want to end up with /b in my address bar and
the page saying Hello, b.

Your advice is very much appreciated,
kind regards
Heikki Doeleman

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3989966.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: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
Hi,

Custom root request mapper should be able to do it.
Just check the request's URL - if it has no segments then return the
home page, if it has one segment then return new
RenderPageRequestHandler(AnotherPage.class, new
PageParameters().add(param, segmentValue))

On Fri, Nov 4, 2011 at 2:53 PM, heikki tropic...@gmail.com wrote:
 hello,

 I still find URL mapping to be far from easy. I can't get the following
 mapping to work; all advice very much appreciated:

 intented mapping is:

 /                      -- map to IndexPage.class
 /b                    -- map to AnotherPage.class with pageparameter
 param=b
 /c                    -- map to AnotherPage.class with pageparameter
 param=c

 I tried creating a custom RootRequestMapper but I could not get it to work.
 The closest I've come to achieving the above url mapping is with this in my
 Application

     protected void init() {
          super.init();
          mount(new MountedMapper(b, AnotherPage.class, new
 CustomPageParametersEncoder(b)));
          mount(new MountedMapper(c, AnotherPage.class, new
 CustomPageParametersEncoder(c)));
     }
     public Class getHomePage() {
          return IndexPage.class;
     }

 where CustomPageParametersEncoder creates the pageparameter from the url in
 method decodePageParameters().

 What doesn't work here, is that requests to /b are turned into requests to
 /c, with pageparameter c.

 So I end up, when requesting /b, with /c in my browser address bar, and the
 page saying Hello, c, where I want to end up with /b in my address bar and
 the page saying Hello, b.

 Your advice is very much appreciated,
 kind regards
 Heikki Doeleman

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3989966.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





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

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



Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren

The latter problem is logical: your mapping is focused on incoming requests.
When wicket renders a link to AnotherPage.class, which url should be 
generated?


My guess is that a request for /b comes in, wicket then checks if the 
url is valid for AnotherPage.class by generating a url for it, which is 
/c (*).


*) See WebPageRenderer#respond(RequestCycle).

Simply put: you need to properly handle url generation, too :-)

Op 4-11-2011 13:53, schreef heikki:

hello,

I still find URL mapping to be far from easy. I can't get the following
mapping to work; all advice very much appreciated:

intented mapping is:

/  --  map to IndexPage.class
/b--  map to AnotherPage.class with pageparameter
param=b
/c--  map to AnotherPage.class with pageparameter
param=c

I tried creating a custom RootRequestMapper but I could not get it to work.
The closest I've come to achieving the above url mapping is with this in my
Application

  protected void init() {
   super.init();
   mount(new MountedMapper(b, AnotherPage.class, new
CustomPageParametersEncoder(b)));
   mount(new MountedMapper(c, AnotherPage.class, new
CustomPageParametersEncoder(c)));
  }
  public Class getHomePage() {
   return IndexPage.class;
  }

where CustomPageParametersEncoder creates the pageparameter from the url in
method decodePageParameters().

What doesn't work here, is that requests to /b are turned into requests to
/c, with pageparameter c.

So I end up, when requesting /b, with /c in my browser address bar, and the
page saying Hello, c, where I want to end up with /b in my address bar and
the page saying Hello, b.

Your advice is very much appreciated,
kind regards
Heikki Doeleman

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3989966.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: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
On Fri, Nov 4, 2011 at 3:17 PM, Bas Gooren b...@iswd.nl wrote:
 The latter problem is logical: your mapping is focused on incoming requests.
 When wicket renders a link to AnotherPage.class, which url should be
 generated?

 My guess is that a request for /b comes in, wicket then checks if the url is
 valid for AnotherPage.class by generating a url for it, which is /c (*).

 *) See WebPageRenderer#respond(RequestCycle).

my eyes bleed when I look in this method :-)


 Simply put: you need to properly handle url generation, too :-)

 Op 4-11-2011 13:53, schreef heikki:

 hello,

 I still find URL mapping to be far from easy. I can't get the following
 mapping to work; all advice very much appreciated:

 intented mapping is:

 /                      --  map to IndexPage.class
 /b                    --  map to AnotherPage.class with pageparameter
 param=b
 /c                    --  map to AnotherPage.class with pageparameter
 param=c

 I tried creating a custom RootRequestMapper but I could not get it to
 work.
 The closest I've come to achieving the above url mapping is with this in
 my
 Application

      protected void init() {
           super.init();
           mount(new MountedMapper(b, AnotherPage.class, new
 CustomPageParametersEncoder(b)));
           mount(new MountedMapper(c, AnotherPage.class, new
 CustomPageParametersEncoder(c)));
      }
      public Class getHomePage() {
           return IndexPage.class;
      }

 where CustomPageParametersEncoder creates the pageparameter from the url
 in
 method decodePageParameters().

 What doesn't work here, is that requests to /b are turned into requests to
 /c, with pageparameter c.

 So I end up, when requesting /b, with /c in my browser address bar, and
 the
 page saying Hello, c, where I want to end up with /b in my address bar
 and
 the page saying Hello, b.

 Your advice is very much appreciated,
 kind regards
 Heikki Doeleman

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3989966.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





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

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



Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren

My eyes too :-)

I was working on absolute urls the other day, and then came along this 
pearl.
But since you are the one who reported/created WICKET-3347 you've 
enjoyed the sight of this method before :-)


But back on-topic:
The TS should create a single root mapper which maps AnotherPage.class 
and handles encoding/decoding of url properly before handing the request 
off to the rest of the mappers.


TS: Can you link to e.g. pastebin and put the RootMapper you built 
online there?


Op 4-11-2011 14:37, schreef Martin Grigorov:

On Fri, Nov 4, 2011 at 3:17 PM, Bas Goorenb...@iswd.nl  wrote:

The latter problem is logical: your mapping is focused on incoming requests.
When wicket renders a link to AnotherPage.class, which url should be
generated?

My guess is that a request for /b comes in, wicket then checks if the url is
valid for AnotherPage.class by generating a url for it, which is /c (*).

*) See WebPageRenderer#respond(RequestCycle).

my eyes bleed when I look in this method :-)


Simply put: you need to properly handle url generation, too :-)

Op 4-11-2011 13:53, schreef heikki:

hello,

I still find URL mapping to be far from easy. I can't get the following
mapping to work; all advice very much appreciated:

intented mapping is:

/  --map to IndexPage.class
/b--map to AnotherPage.class with pageparameter
param=b
/c--map to AnotherPage.class with pageparameter
param=c

I tried creating a custom RootRequestMapper but I could not get it to
work.
The closest I've come to achieving the above url mapping is with this in
my
Application

  protected void init() {
   super.init();
   mount(new MountedMapper(b, AnotherPage.class, new
CustomPageParametersEncoder(b)));
   mount(new MountedMapper(c, AnotherPage.class, new
CustomPageParametersEncoder(c)));
  }
  public Class getHomePage() {
   return IndexPage.class;
  }

where CustomPageParametersEncoder creates the pageparameter from the url
in
method decodePageParameters().

What doesn't work here, is that requests to /b are turned into requests to
/c, with pageparameter c.

So I end up, when requesting /b, with /c in my browser address bar, and
the
page saying Hello, c, where I want to end up with /b in my address bar
and
the page saying Hello, b.

Your advice is very much appreciated,
kind regards
Heikki Doeleman

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3989966.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






Form action from Form component

2011-11-04 Thread Brian Mulholland
How do I get the value wicket is going to write out in the form action
from the form component.  The links have a getURL method, but I
haven't seen an equivalent method for the form.

Brian Mulholland

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



Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
hi,

thanks for your hints, but still I didn't get it to work. I have a
RootRequestMapper that extends MountedMapper, and it overrides mapRequest()
like so

@Override
public IRequestHandler mapRequest(Request request) {
ListString segments = request.getUrl().getSegments();
if(CollectionUtils.isEmpty(segments)) {
System.out.println(mapRequest to Index page);
return new RenderPageRequestHandler(new
PageProvider(IndexPage.class));
}
else {
System.out.println(mapRequest to Another page);
return new RenderPageRequestHandler(new
PageProvider(AnotherPage.class, new PageParameters().add(param,
segments.get(0;
}
}

Now, with this in Application:

   mount(new RootRequestMapper(/, Index.class));
   mount(new RootRequestMapper(b, AnotherPage.class));
   mount(new RootRequestMapper(c, AnotherPage.class));

Result: / ends up correctly in IndexPage, but /b and /c end up serving an
empty HTML page (?!).

If I only put this in Application (without the root mapping)

   mount(new RootRequestMapper(b, AnotherPage.class));
   mount(new RootRequestMapper(c, AnotherPage.class));

Result: / serves an empty page, and /b does end up in AnotherPage, but
renders this in the address bar: /c?param=c (again, replacing b with c, and
now adding the param as a visible url parameter).

Then I tried using a 'wildcard' like this

mount(new RootRequestMapper(/, Index.class));
mount(new RootRequestMapper(/${param}, AnotherPage.class));

Result: / serves correctly the index page, /b serves an empty HTML page.

In all cases, the System.outs in my RootRequestMapper correctly say either
to Index page or to Another page -- even in those cases above where a
blank HTML page is served, though constructor of said pages is not invoked
then.

So I guess I'm missing some small but essential detail somewhere .. if you
would have any further advice, thanks very much, in advance.

Kind regards
Heikki Doeleman

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3990222.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: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
sorry, just saw your reply about pastebin after posting.

Here it is: http://pastebin.com/uRNyxZbV.

Thanks and kind regards
Heikki Doeleman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3990244.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: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
No need to extend MountedMapper.
Just implement IRequestMapper and then use
application.setRootRequestMapper(yourMapper)

See how CryptoMapper works.

On Fri, Nov 4, 2011 at 4:21 PM, heikki tropic...@gmail.com wrote:
 sorry, just saw your reply about pastebin after posting.

 Here it is: http://pastebin.com/uRNyxZbV.

 Thanks and kind regards
 Heikki Doeleman



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3990244.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





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

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



Re: Form action from Form component

2011-11-04 Thread Martin Grigorov
org.apache.wicket.markup.html.form.Form.getActionUrl()

it is protected

On Fri, Nov 4, 2011 at 4:06 PM, Brian Mulholland blmulholl...@gmail.com wrote:
 How do I get the value wicket is going to write out in the form action
 from the form component.  The links have a getURL method, but I
 haven't seen an equivalent method for the form.

 Brian Mulholland

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





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

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



Re: Form action from Form component

2011-11-04 Thread manuelbarzi
may you try extending  overriding your form :?

YourForm extends Form {
...
... onComponentTag(ComponentTag tag) {
... super.onComponentTag(tag);
String action = tag.getString(action);
...
}



On Fri, Nov 4, 2011 at 3:06 PM, Brian Mulholland blmulholl...@gmail.comwrote:

 How do I get the value wicket is going to write out in the form action
 from the form component.  The links have a getURL method, but I
 haven't seen an equivalent method for the form.

 Brian Mulholland

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




Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Igor Vaynberg
On Fri, Nov 4, 2011 at 6:37 AM, Martin Grigorov mgrigo...@apache.org wrote:
 On Fri, Nov 4, 2011 at 3:17 PM, Bas Gooren b...@iswd.nl wrote:
 The latter problem is logical: your mapping is focused on incoming requests.
 When wicket renders a link to AnotherPage.class, which url should be
 generated?

 My guess is that a request for /b comes in, wicket then checks if the url is
 valid for AnotherPage.class by generating a url for it, which is /c (*).

 *) See WebPageRenderer#respond(RequestCycle).

 my eyes bleed when I look in this method :-)


your eyes only bleed because you didnt have to debug/work with the
analog of this code in 1.4.x. this is a major improvement :)

-igor

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



Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren

Well, the simplest solution would be:

- set Index.class as your homepage (through the corresponding method in 
your application class)

- use mount(new MountedMapper(/${param}, AnotherPage.class));

that should at least get /b and /c working. Unfortunately (?) that 
will also allow /xyz and /abc to be routed to AnotherPage.class;


If you do not want the latter, you need to do what Martin suggested: 
build your own implementation of IRequestMapper. Return 1 (or 
Integer.MAX_VALUE) for getCompatibilityScore() when the first segment is 
b or c and 0 otherwise.
Mount this new request mapper as the root request mapper, and only do so 
once. There is no need to mount it more than once, since all requests 
are routed to the same page class.


Op 4-11-2011 15:15, schreef heikki:

hi,

thanks for your hints, but still I didn't get it to work. I have a
RootRequestMapper that extends MountedMapper, and it overrides mapRequest()
like so

 @Override
 public IRequestHandler mapRequest(Request request) {
 ListString  segments = request.getUrl().getSegments();
 if(CollectionUtils.isEmpty(segments)) {
 System.out.println(mapRequest to Index page);
 return new RenderPageRequestHandler(new
PageProvider(IndexPage.class));
 }
 else {
 System.out.println(mapRequest to Another page);
 return new RenderPageRequestHandler(new
PageProvider(AnotherPage.class, new PageParameters().add(param,
segments.get(0;
 }
 }

Now, with this in Application:

mount(new RootRequestMapper(/, Index.class));
mount(new RootRequestMapper(b, AnotherPage.class));
mount(new RootRequestMapper(c, AnotherPage.class));

Result: / ends up correctly in IndexPage, but /b and /c end up serving an
empty HTML page (?!).

If I only put this in Application (without the root mapping)

mount(new RootRequestMapper(b, AnotherPage.class));
mount(new RootRequestMapper(c, AnotherPage.class));

Result: / serves an empty page, and /b does end up in AnotherPage, but
renders this in the address bar: /c?param=c (again, replacing b with c, and
now adding the param as a visible url parameter).

Then I tried using a 'wildcard' like this

 mount(new RootRequestMapper(/, Index.class));
 mount(new RootRequestMapper(/${param}, AnotherPage.class));

Result: / serves correctly the index page, /b serves an empty HTML page.

In all cases, the System.outs in my RootRequestMapper correctly say either
to Index page or to Another page -- even in those cases above where a
blank HTML page is served, though constructor of said pages is not invoked
then.

So I guess I'm missing some small but essential detail somewhere .. if you
would have any further advice, thanks very much, in advance.

Kind regards
Heikki Doeleman

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3990222.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: Determine the latest page in multi tabbed browsing

2011-11-04 Thread robert.mcguinness
martin,

would be awesome if you could through up a github project of wicket + ajax +
history as an example of how to get all this to work.

rob

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Determine-the-latest-page-in-multi-tabbed-browsing-tp3947526p3991713.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



Forge tools?

2011-11-04 Thread nino martinez wael
Hi i was to a great presentation today on forge tools. They are lacking a
wicket plugin. So the question are if any of you have started work on a
plugin for wicket?

http://jboss.org/forge

Regards nino


Mounting and displaying correct URL's

2011-11-04 Thread anantasthana
I am mounting url's like

mountPage(ProductType/${Category},ProductTypePage.class)

and i read the Parameter Category and pull the info from the database

So if i am on the page for food the URL is /ProductType/Food

now inside my application im using redirects which redirect to these pages
by pasing the Object
Category food ;
So setResponsePage(new ProductTypesPage(food));

but when i do this the URL shows up as /ProductType

is there any way i can get the URL to show up correctly i know that
category.getName is the string I am passing as parameter so if i could show
the URL correctly so that users could bookmark it.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-and-displaying-correct-URL-s-tp3992126p3992126.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: Mounting and displaying correct URL's

2011-11-04 Thread Igor Vaynberg
use setResponsePage(ProductTypePage.class, new
PageParameters().put(Category, Food));

-igor

On Fri, Nov 4, 2011 at 5:11 PM, anantasthana anant.a...@gmail.com wrote:
 I am mounting url's like

 mountPage(ProductType/${Category},ProductTypePage.class)

 and i read the Parameter Category and pull the info from the database

 So if i am on the page for food the URL is /ProductType/Food

 now inside my application im using redirects which redirect to these pages
 by pasing the Object
 Category food ;
 So setResponsePage(new ProductTypesPage(food));

 but when i do this the URL shows up as /ProductType

 is there any way i can get the URL to show up correctly i know that
 category.getName is the string I am passing as parameter so if i could show
 the URL correctly so that users could bookmark it.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Mounting-and-displaying-correct-URL-s-tp3992126p3992126.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: Mounting and displaying correct URL's

2011-11-04 Thread anantasthana
Thanks for the Quick and extremely helpful reply.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-and-displaying-correct-URL-s-tp3992126p3992140.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: Using FileUpload.writeTo() in a background thread

2011-11-04 Thread ilovewicket
i have the same problem, any ideas?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-FileUpload-writeTo-in-a-background-thread-tp1845020p3991986.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



Wicket 1.5 - setResponsePage() - page still tries to render HTML before redirect

2011-11-04 Thread armhold
Hi,

Geoff Hayman raised this issue previously here:
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-td3819145.html

but apparently got no response (and Nabble won't let me reply to that for
some reason... conspiracy?)

I've run into the same issue- with 1.5, you can no longer short-circuit the
constructor of a page, as Wicket complains if all the components haven't
been added so as to match the HTML. I often use this for things like access
control- if some condition isn't met, set the response to another page
without rendering any components. If this is an improper use of the
framework, what is the correct pattern for dealing with this?

I can work around this by rendering dummy data to my components, but that's
rather ugly. 

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-tp3992321p3992321.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket 1.5 - setResponsePage() - page still tries to render HTML before redirect

2011-11-04 Thread bht
Hi,

To abort the construction of the page, you throw
ResetResponseException or subclasses.

Regards,

Bernard


On Fri, 4 Nov 2011 19:12:34 -0700 (PDT), you wrote:

Hi,

Geoff Hayman raised this issue previously here:
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-td3819145.html

but apparently got no response (and Nabble won't let me reply to that for
some reason... conspiracy?)

I've run into the same issue- with 1.5, you can no longer short-circuit the
constructor of a page, as Wicket complains if all the components haven't
been added so as to match the HTML. I often use this for things like access
control- if some condition isn't met, set the response to another page
without rendering any components. If this is an improper use of the
framework, what is the correct pattern for dealing with this?

I can work around this by rendering dummy data to my components, but that's
rather ugly. 

Thanks


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