Re: Exception redirecting to source page

2008-02-17 Thread Cristiano Kliemann

Yes, it works, at least when the exception is thrown in Button.onSubmit. I
haven't tried with Link.onClick.


igor.vaynberg wrote:
 
 have you tried it and does it work?
 
 -igor
 
 
 On Feb 15, 2008 1:17 PM, Cristiano Kliemann [EMAIL PROTECTED] wrote:

 Hi!

 I have some business runtime exceptions that I want to be automatically
 catched and its message rendered in the same page that threw it instead
 of
 redirecting to an error page.

 Is there a safe way to do that?

 These 'business exceptions' are usually thrown in some specific methods
 like
 onSubmit and onClick. Extending the specific components is not an option
 for
 me.

 I did something I think it dangerous. Something like:

 public Page onRuntimeException(Page page, RuntimeException e) {

 Throwable current = e;
 while (current != null  !(current instanceof MyBusinessException))
 {
 current = current.getCause();
 }
 if (current != null) {
 // MyBusinessException detected
 page.error(Error:  + current.getMessage());
 return page;
 } else {
 return super.onRuntimeException(page, e);
 }
 }

 When as exception is thrown, all the execution flow breaks, making some
 things not happen. The question is: is the above code safe assuming that
 MyException could be thrown only by methods like onSubmit and onClick?
 --
 View this message in context:
 http://www.nabble.com/Exception-redirecting-to-source-page-tp15510198p15510198.html
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Exception-redirecting-to-source-page-tp15510198p15528633.html
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: wicket-security Custom Access Denied Page

2008-02-17 Thread Maurice Marrink
Just finished testing your classes using my 1.3.1 development code and
both your way and my way work, as it should.
I don't get why using the permission instead of the permission name
does not work for you.

I did however just think of 1 caveat in using the permission name
instead of the permission.
This might not be relevant for you (since you have a very small policy
file), but if anybody else is following this thread it might be
relevant to them.
If your policy file contains a principal foo with action render
for principal p1 and a permission foo with action enable for
principal p2
your hive will return both principals p1 and p2 eventhough you did
hive.getPrincipals(new ...Permission(foo,enable).
In this scenario it should only return p2 and not p1.

Maurice

On Feb 16, 2008 1:53 PM, Maurice Marrink [EMAIL PROTECTED] wrote:
 On Feb 15, 2008 6:38 PM, Warren [EMAIL PROTECTED] wrote:
  Maurice,
 
  Here is my SimpleCachingHive and my Principal. I did not extend Permissin, I
  didn't think I had to. I pretty much based my implementation on you tabs
  example minus the tabs. Should I extend Permission and override hashCode()
  and equals(Object obj). And if I do, how do I force my hive to use my
  extended Permission?

 No you don't have to extend permission, it is optional. You could for
 example create a ResourcePermission to check for permissions on file
 uploads or downloads. For example:
 permission org.ResourcePermission /*.*, read, write; //enables
 write permission on the root and every subdir
 Your hive would not have to have explicit knowledge of this new
 permission, it is sufficient if you declare it in your policy file and
 in an ISecurityCheck do something like SwarmStrategy.hasPermission(new
 ResourcePermission(/somefile.file));

 Anyway moving away from this theoretical exercise and to your problem.
 Your principal looks fine, if i have some time I'll try and run it myself.
 One small difference i noticed (which should have no impact at all) is
 you also use the class to generate the hash and in my simpleprincipal
 i don't. But like i said this should not matter at all.

 Maurice


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



HybridUrlCodingStrategy ( and IndexedHybridUrlCodingStrategy ) bug

2008-02-17 Thread demirr

I created a JIRA issue but it seems that nobody have seen it. So i'm posting
it here. 
Jonathan or Eelco can you have a look at it please ?


https://issues.apache.org/jira/browse/WICKET-1343
-- 
View this message in context: 
http://www.nabble.com/HybridUrlCodingStrategy-%28-and-IndexedHybridUrlCodingStrategy-%29-bug-tp15530576p15530576.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



A subproject for Just Model State

2008-02-17 Thread demirr

Hi, i'm on a project which consists mostly of stateless pages but sometimes i
need to save some ( little ) state from which i can recover the page so i
have decided to start a subproject of my own to help the developer just save
the models of some componenents to session.

Can you give me an advice where to start from ? I mean should i work on
models and create sth like SessionPersistentModel  or should i override or
change the component api ? 

I think that the model approach is sufficient but i'm not sure how and when
to attach and detach the model to session and how to dirty it for
clustering.


-- 
View this message in context: 
http://www.nabble.com/A-subproject-for-Just-Model-State-tp15530579p15530579.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



[Announcement] Wicket Security 1.3.0 final has been released

2008-02-17 Thread Maurice Marrink
Version 1.3.0 has been made available on sourceforge and the
wicketstuff maven repository.

For those who cannot wait to get there hands on this release here are
instruction on how to obtain your copy
Maven users update your pom to version 1.3.0 (wasp, swarm and the examples)
Also make sure your wicket-stuff repository is set to download releases as well:
repositories
   repository
   idwicket-snaps/id
   urlhttp://wicketstuff.org/maven/repository/url
   snapshots
   enabledtrue/enabled
   /snapshots
   releases
   enabledtrue/enabled   important
   /releases
   /repository
   /repositories

Or you can download all the files from sourceforge
http://sourceforge.net/project/showfiles.php?group_id=134391

Changes
-A couple of bugs were found and fixed
-We made sure everything runs on wicket1.3.0 as well as 1.3.1

Maurice

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



RE: wicket-security Custom Access Denied Page

2008-02-17 Thread Warren
Maurice,

Can you show me your code? I would rather do it your way than mine. My
policy file will be much more complicated than the one I am testing with.

 -Original Message-
 From: Maurice Marrink [mailto:[EMAIL PROTECTED]
 Sent: Sunday, February 17, 2008 6:27 AM
 To: users@wicket.apache.org
 Subject: Re: wicket-security Custom Access Denied Page


 Just finished testing your classes using my 1.3.1 development code and
 both your way and my way work, as it should.
 I don't get why using the permission instead of the permission name
 does not work for you.

 I did however just think of 1 caveat in using the permission name
 instead of the permission.
 This might not be relevant for you (since you have a very small policy
 file), but if anybody else is following this thread it might be
 relevant to them.
 If your policy file contains a principal foo with action render
 for principal p1 and a permission foo with action enable for
 principal p2
 your hive will return both principals p1 and p2 eventhough you did
 hive.getPrincipals(new ...Permission(foo,enable).
 In this scenario it should only return p2 and not p1.

 Maurice

 On Feb 16, 2008 1:53 PM, Maurice Marrink [EMAIL PROTECTED] wrote:
  On Feb 15, 2008 6:38 PM, Warren [EMAIL PROTECTED] wrote:
   Maurice,
  
   Here is my SimpleCachingHive and my Principal. I did not
 extend Permissin, I
   didn't think I had to. I pretty much based my implementation
 on you tabs
   example minus the tabs. Should I extend Permission and
 override hashCode()
   and equals(Object obj). And if I do, how do I force my hive to use my
   extended Permission?
 
  No you don't have to extend permission, it is optional. You could for
  example create a ResourcePermission to check for permissions on file
  uploads or downloads. For example:
  permission org.ResourcePermission /*.*, read, write; //enables
  write permission on the root and every subdir
  Your hive would not have to have explicit knowledge of this new
  permission, it is sufficient if you declare it in your policy file and
  in an ISecurityCheck do something like SwarmStrategy.hasPermission(new
  ResourcePermission(/somefile.file));
 
  Anyway moving away from this theoretical exercise and to your problem.
  Your principal looks fine, if i have some time I'll try and run
 it myself.
  One small difference i noticed (which should have no impact at all) is
  you also use the class to generate the hash and in my simpleprincipal
  i don't. But like i said this should not matter at all.
 
  Maurice
 

 -
 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: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing

Neither the constructor of CustomSession nor the constructor of WebSession is
called. The error occurs much earlier, as you can see in the stack trace
posted in my first post.

I think I will drop overriding the default session and work with
setAttribute()/getAttribute() instead. Seems to save me a lot of trouble...
-- 
View this message in context: 
http://www.nabble.com/org.apache.wicket.protocol.http.WebSession-cannot-be-cast-to-my.CustomSession-tp15480791p15539346.html
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: [Announcement] Wicket Security 1.3.0 final has been released

2008-02-17 Thread Sergey Podatelev
Sweet (:

On Feb 17, 2008 7:20 PM, Maurice Marrink [EMAIL PROTECTED] wrote:

 Version 1.3.0 has been made available on sourceforge and the
 wicketstuff maven repository.


-- 
sp


Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing

Yes, with a normal Wicket-Application it works just perfect.

I'm using the SpringWebApplication cause of createSpringBeanProxy() and the
automatic init of the configured ApplicationContext
(http://cwiki.apache.org/WICKET/spring.html).

Manually initializing would be a huge tradeoff for working tests. :)
-- 
View this message in context: 
http://www.nabble.com/org.apache.wicket.protocol.http.WebSession-cannot-be-cast-to-my.CustomSession-tp15480791p15539854.html
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: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing

I'm referring to both.
The CCE occurs if I construct the WicketTester without my application as an
argument. If I do, I get the illegal state exception. 
Problem with this seems to be, that the ServletContext created at
MockWebApplication:130 does not contain the required WebApplicationContext
(SpringWebApplication:77) because it has never been set.


Martin Funk-3 wrote:
 
 So what are you referring to? The ClassCast or the IllegalState exception?
 For the later I'd say its a sign, that your SpringWebApplication didn't
 get
 initialized, aka it didn't find its 'ApplicationContext.xml'
 
 I'd say have a look at the wicket-examples esp.:
 http://svn.apache.org/repos/asf/wicket/trunk/jdk-1.5/wicket-examples/src/main/webapp/WEB-INF/web.xml
 
 mf
 
 2008/2/18, Sven Schliesing [EMAIL PROTECTED]:


 Neither the constructor of CustomSession nor the constructor of
 WebSession
 is
 called. The error occurs much earlier, as you can see in the stack trace
 posted in my first post.

 I think I will drop overriding the default session and work with
 setAttribute()/getAttribute() instead. Seems to save me a lot of
 trouble...
 --
 View this message in context:
 http://www.nabble.com/org.apache.wicket.protocol.http.WebSession-cannot-be-cast-to-my.CustomSession-tp15480791p15539346.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


 
 

-- 
View this message in context: 
http://www.nabble.com/org.apache.wicket.protocol.http.WebSession-cannot-be-cast-to-my.CustomSession-tp15480791p15540021.html
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: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Timo Rantalaiho
On Sun, 17 Feb 2008, Sven Schliesing wrote:
 I'm using the SpringWebApplication cause of createSpringBeanProxy() and the
 automatic init of the configured ApplicationContext
 (http://cwiki.apache.org/WICKET/spring.html).
 
 Manually initializing would be a huge tradeoff for working tests. :)

Hmm, I'm not sure I really see the added value of making
your Application extends SpringWebApplication, maybe just
because I never did it. Maybe you should considering just
ripping the relevant bits out to your own Application class. 

You can also just set your fake ApplicationContext to your 
Application before starting WicketTester, that way your code 
works too.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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