Security handled at the proxy level

2010-02-22 Thread Andrea Aime

Hi,
I have developed an application with Wicket that has
its own built-in security and now a user needs to use
it in a way that security is managed by a proxy instead.

The way they can impose security is by url, and in theory
I could get away by using only bookmarkable pages that
contain a certain package name.

The issue is, when the page contents change (validation,
showing/hiding panels, ...)  the url changes and becomes
something generic like:

http://host/app/?wicket:interface=:3:1:::

Is there any way to force it to encode the url so that
it looks at least like:

http://host/app/secured?wicket:interface:3:1:::

when the page is recognized as a secure one? (in my
case those pages extend a certain base class that provides
security control... when that is enabled, that is, otherwise
it does nothing).

Cheers
Andrea

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



Re: Wicket based open source projects

2009-11-27 Thread Andrea Aime

Gatos ha scritto:

Hello,

Is there any wicket based Open Source projects?


See GeoServer 2.0 at http://geoserver.org

Cheers
Andrea


--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

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



Re: Ajax-y interactions inside a form

2009-07-22 Thread Andrea Aime

Linda van der Pal ha scritto:
Well I'm not too familiar with this area of Wicket, but there's also 
AjaxLink which is similar to Link, but sends a request using Ajax*. 
Which means it doesn't submit like AjaxSubmitLink does.


That's why I'm using an AjaxSubmitLink in my example (attached to the 
first mail).

Still, I'm looking for a less clunky (and more general) solution, having
to disable form processing in the link and then do manually some parts 
of the processing seems quite involved (and each time I have to guess

what's the right incantation, so at least having a set of steps,
even if long would be an improvement).

*quote from Wicket in Action (Which I heartily recommend if you haven't 
read it yet.)


Yep, read it.
Cheers
Andrea

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



Re: TextField and setConvertInputToNull

2009-06-27 Thread Andrea Aime

Andrea Aime ha scritto:
...

Also, the setConvertEmptyInputStringToNull does not mention the
interaction between that and the converters, so arguably there should
be none (or I'm just missing the documentation bits on this topic)


Should I open a issue on Jira and attach a reproducable test case?
Cheers
Andrea

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




TextField and setConvertInputToNull

2009-06-26 Thread Andrea Aime

Hi,
I'm having troubles with null conversion in an application
where we have setup some custom converter locators.

If I understand it properly, a TextField setup like this:

TextField tf = new TextField(id, ...);
tf.setType(String.class);
tf.setConvertEmptyInputStringToNull(true);

that is, without setting an explicit converter, should always
turn the emtpy string to a null, right? Unfortunately it does
not if you have a custom converter locator that does not
let the default CharacterConverter have its way.
However more tests seem to suggest even when one does
not setup a custom converter locator, the default behavior
works by accident: even in the case you don't have a custom converter 
locator, the following, in which the conversion to null is disabled, 
should break:


TextField tf = new TextField(id, ...);
tf.setType(String.class);
tf.setConvertEmptyInputStringToNull(false);

because the default converter is used and that turns
an empty string into nulls even if the setup asks for the opposite
(see CharacterConverter).

Imho it would be better if AbstractTextComponent would override the 
convertInput method and honored the convertEmptyInputStringToNull 
property before trying to use converters. Am I missing something?


Also, the setConvertEmptyInputStringToNull does not mention the
interaction between that and the converters, so arguably there should
be none (or I'm just missing the documentation bits on this topic)

Cheers
Andrea

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



Getting form component raw value on ajax action

2009-06-19 Thread Andrea Aime

Hi,
I have a form in which one of the fields represents a server
side path. The field has a validator to make sure the path is
valid and contains certain kind of files inside of it.

I also have a link on the side of it that opens in a modal
window a server side file system browser to be used as a
directory chooser.

The issue is, I would like to know what the user typed in
the field, use it in the chooser, and when I'm done with
the chooser, update the value in the field accordingly.

I've tried out three solutions, none of them seems to work:
- plain ajaxsubmitlink: validation triggers and onSubmit does
  not get called all the time. Not good
- ajajxsubmitlink + disable default form processing + grab
  the field input value - the chooser starts with whatever
  the user typed in, but when the chooser closes it
  would seem the field is not updated even if it's
  part of the ajax request target and its model has
  been updated
- ajaxlink: the opposite, that is the form field value
  cannot be read (it's not posted back to the server)
  but when the chooser closes the field value is updated
  with whatever the user chose (the code that does
  the field update is exactly the same)

Sigh... any way to have this thing work both ways?
I can provide sample code, but first I'd like to check if
there is any general reason why this would not work.

Cheers
Andrea

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



Re: Getting form component raw value on ajax action

2009-06-19 Thread Andrea Aime

Andrea Aime ha scritto:

Hi,
I have a form in which one of the fields represents a server
side path. The field has a validator to make sure the path is
valid and contains certain kind of files inside of it.

I also have a link on the side of it that opens in a modal
window a server side file system browser to be used as a
directory chooser.

The issue is, I would like to know what the user typed in
the field, use it in the chooser, and when I'm done with
the chooser, update the value in the field accordingly.

I've tried out three solutions, none of them seems to work:
- plain ajaxsubmitlink: validation triggers and onSubmit does
  not get called all the time. Not good
- ajajxsubmitlink + disable default form processing + grab
  the field input value - the chooser starts with whatever
  the user typed in, but when the chooser closes it
  would seem the field is not updated even if it's
  part of the ajax request target and its model has
  been updated


Answering myself, the second option works provided that
the code calls field.clearInput() (besides setting the
new model value).

Cheers
Andrea

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



Re: 60% waste

2009-05-08 Thread Andrea Aime

Martin Makundi ha scritto:

Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right


I don't know if this is of any help, but I've written the attached
utility class that, given a component, can print its containment
structure, along with the eventual component classes and
model values (toString-ed).

I find it useful to quickly visualize the current component hierarchy
while writing tests and debugging.

Hope this helps

Cheers
Andrea




import java.io.PrintStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.regex.Pattern;

import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;

/**
 * Dumps a wicket component/page hierarchy to text, eventually writing 
down the class and the model

 * value as a string.
 * p
 * Each line in the dump follow the codecomponentId(class) 
'value'/code format.

 * /p
 * p
 * The class can be reused for multiple prints, but it's not thread safe
 * /p
 */
public class WicketHierarchyPrinter {
static final Pattern NEWLINE = Pattern.compile(\\n, 
Pattern.MULTILINE);


PrintStream out;

boolean valueDumpEnabled;

boolean classDumpEnabled;

/**
 * Utility method to dump a single component/page to standard output
 * @param c
 * @param dumpClass
 * @param dumpValue
 */
public static void print(Component c, boolean dumpClass, boolean 
dumpValue) {

WicketHierarchyPrinter printer = new WicketHierarchyPrinter();
printer.setClassDumpEnabled(dumpClass);
printer.setValueDumpEnabled(dumpValue);
if(c instanceof Page) {
printer.print((Page) c);
} else {
printer.print(c);
}
}

/**
 * Creates a printer that will dump to standard output
 */
public WicketHierarchyPrinter() {
out = System.out;
}

/**
 * Creates a printer that will dump to the specified print stream
 */
public WicketHierarchyPrinter(PrintStream out) {
this.out = out;
}

/**
 * Set to true if you want to see the model values in the dump
 *
 * @param valueDumpEnabled
 */
public void setValueDumpEnabled(boolean valueDumpEnabled) {
this.valueDumpEnabled = valueDumpEnabled;
}

/**
 * Set to true if you want to see the component classes in the dump
 *
 * @param classDumpEnabled
 */
public void setClassDumpEnabled(boolean classDumpEnabled) {
this.classDumpEnabled = classDumpEnabled;
}

/**
 * Prints the component containment hierarchy
 *
 * @param c
 */
public void print(Component c) {
walkHierarchy(c, 0);
}

/**
 * Walks down the containment hierarchy depth first and prints each 
component found

 */
private void walkHierarchy(Component c, int level) {
printComponent(c, level);
if (c instanceof MarkupContainer) {
MarkupContainer mc = (MarkupContainer) c;
for (Iterator it = mc.iterator(); it.hasNext();) {
walkHierarchy((Component) it.next(), level + 1);
}
}
}

/**
 * Prints a single component
 */
private void printComponent(Component c, int level) {
if(c instanceof Page)
out.print(tab(level) + PAGE_ROOT);
else
out.print(tab(level) + c.getId());

if (classDumpEnabled) {
String className;
if(c.getClass().isAnonymousClass()) {
className = c.getClass().getSuperclass().getName();
} else {
className = c.getClass().getName();
}

out.print(( + className + ));
}

if (valueDumpEnabled) {
try {
String value = 
NEWLINE.matcher(c.getModelObjectAsString()).replaceAll(n);

out.print( ' + value + ');
} catch(Exception e) {
out.print( 'ERROR_RETRIEVING_MODEL  + e.getMessage() 
+ ');

}
}
out.println();
}

/**
 * Generates three spaces per level
 */
String tab(int level) {
char[] spaces = new char[level * 3];
Arrays.fill(spaces, ' ');
return new String(spaces);
}

}

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



Re: 60% waste

2009-05-08 Thread Andrea Aime

Martin Makundi ha scritto:

I don't know if this is of any help, but I've written the attached
utility class that, given a component, can print its containment
structure, along with the eventual component classes and
model values (toString-ed).


Well... printDoc and wicket
getDebugSettings().setOutputComponentPath(true); does pretty much the
same thing.


Interesting. I googled for printDoc Wicket but did not find anything.
Where is that utility?

Cheers
Andrea

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



wicket:path and Ajax

2009-03-27 Thread Andrea Aime

Hi,
I've set my Wicket application to generate wicket:path attributes.
Yet, it seems what whatever new element added following an ajax
link does not have the wicket:path attribute set.
I'm seeing this in ajax tabbed panels and in other ajaxy
behavious, like adding a row in a ListView by following
an Ajax button.

Any known workaround?
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

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



Bingind a bean that has getters, but no setters

2009-03-24 Thread Andrea Aime

Hi,
I'm trying to make a component that edits the
corners of a rectangle. The model of this
component should be a JTS Envelope class:
http://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/Envelope.html?is-external=true

This class has getters for minX,minY,maxX,maxY,
but has no setters for them, you're supposed
to call init(x1,x2,y1,y2) instead.

Has anyone an idea of how to bind four text fields
so that the model of my Panel is the JTS Envelope,
the fields use the Envelope corners, but the
update takes place as a single shot instead
of a field by field basis (that I cannot do
given the lack of setters?)

Cheers
Andrea

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



Re: Bingind a bean that has getters, but no setters

2009-03-24 Thread Andrea Aime

James Carman ha scritto:

Or, you could provide a wrapper


A wrapper... how? In particular, how is the wrapper
notified that it's time to set all the properties back in the
envelope? (sorry, model rookie here).

Btw, Johan suggestion works, but bombs out in
the case the envelope is null which is another
case I have to handle, if the user did not enter
any values in the text fields, it should stay
null. How is this handled?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

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



Re: Bingind a bean that has getters, but no setters

2009-03-24 Thread Andrea Aime

nino martinez wael ha scritto:

Hi Andrea

Did you use the openlayers integration project?

just curious...


Nope, so far I did not. GeoServer has its own way
to generate a OL client preview page which uses
FreeMarker templates.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

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



Re: Bingind a bean that has getters, but no setters

2009-03-24 Thread Andrea Aime

Johan Compagner ha scritto:

hmm normally i think we try to create the object
by calling the default constructor
And i see it does have a default constructor

But is that Envelope object really your model object?


Well, it's actually a property of a larger object, which
I provide to my panel using another PropertyModel


Do you have a simple test case that i can add to the PropertyResolverTest ?


Not at the moment, I'm facing a number of errors that I cannot
sort out and which are probably related to my improper usage of
Wicket. I'll try to figure out what's going on and will let
you know

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

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