Session problem - object stays in after invalidate()

2012-09-27 Thread Ondrej Zizka
Hi,

i am trying to implement a simple authentization.

I've basically copied what's in the auth example #2 in wicket examples,
and have a Logout button:

add( new Link(logoutLink) {
@Override public void onClick() {
sess.invalidateNow();
setResponsePage( HomePage.class );
}
}
.add( new Label(label, Logout  +
sess.getUser().getName()) )

Which, when clicked, is performed, but in the second request, the User
object, which set to null in my overriden signOut(), is back in my
session object. Not sure if the same obj, but the same values.

What could be wrong?

Thanks,
Ondra 


Re: Found IExceptionMapper // Re: Redirecting on Exception - some ExceptionMapper? Also for exceptions outside app's code

2012-09-27 Thread Martin Grigorov
Hi,

See 
https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5

On Thu, Sep 27, 2012 at 4:13 AM, Ondrej Zizka ozi...@redhat.com wrote:
 Aah, just found in the referenced wiki:

 https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Exceptionhandling

 or override org.apache.wicket.Application.getExceptionMapperProvider() -
 the IExceptionMapper is used if none of the configured
 IRequestCycleListeners doesn't know how to handle the exception.
 For information on how the request cycle handles exceptions see
 RequestCycle in Wicket 1.5 for more information

 So I would use BookmarkablePageRequestHandler or such.
 Nice... Wicket is like having Christmas all year :)

 But still:
 I only get the exception. Ok, it has a stacktrace. But for convenience,
 is it possible that I could get the component it came from?

No
But what would you do if you know that SomePanel did it ?





 On Thu, 2012-09-27 at 02:42 +0200, Ondrej Zizka wrote:

 Sorry, adding a subject...


 On Thu, 2012-09-27 at 02:40 +0200, Ondrej Zizka wrote:

  Hi all,
 
  pls is there a way to react to certain type of exceptions and redirect
  the request to a page?
  I think I saw somathing, but I can't find it.
 
  I can't wrap it in RestartResponseAtInterceptPageException as  in my
  case it's thrown from within Wicket's code.
 
  So, I'm looking for something like
 
getApplicationSettings.setExceptionMapper( new ExceptionMapper()
 // Type,
  Destination
 .add(  Exception.class,
  ExceptionPage.class )
 // Component of origin,  Type,
  Destination
 .add( LoginPage.class, Exception.class,  ExceptionPage.class
  )
   );
 
  Or maybe just  some exception handler with onException(),  like
  http://blog.wizche.ch/2011/12/wicket-15custom-exception-page.html  - is
  that the way? Not that convenient but usable.
 
  Thanks,
  Ondra







-- 
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: Small Wicket 6 Auth Example

2012-09-27 Thread Martin Grigorov
Hi,

On Wed, Sep 26, 2012 at 11:39 PM, Anton Bessonov exe...@googlemail.com wrote:
 Hello Wicketeers,

 now same example for Wicket 6 and Jetty 8:

 https://github.com/Bessonov/wicket-6-example

 Best regards,

 Anton

 On 08/12/2012 08:53 PM, Anton Bessonov wrote:

 Hello wicketeers,

 I've updated my old small Wicket example to 1.5.7 and pushed it to github
 [1]. It's available under cc-by license (also for commercial use,
 redistributing and so on). Maybe helpful for someone.

 Example include:
 - i18n
 - Hibernate (hsqldb is default and mysql example config is included)
 - Authentication (Register/Login/Logout, persistent)
 - Simple Authorization (is_user, is_anonymous roles)
 - Spring DI
 - Standalone application packaging (with Jetty and maven-shade-plugin)
 - Good test coverage

 Following dependencies are declared:
 wicket.version1.5.7/wicket.version
 jetty.version6.1.25/jetty.version
 slf4j.version1.6.6/slf4j.version
 log4j.version1.2.14/log4j.version
 hibernate-core-version4.1.5.Final/hibernate-core-version
 javassist.version3.9.0.GA/javassist.version
 spring.version3.1.2.RELEASE/spring.version
 wicket-spring-annot.version1.3.7/wicket-spring-annot.version

^^ This is not really needed.

 junit.version4.8.1/junit.version
 commons-codec.version1.4/commons-codec.version
 c3p0.version0.9.1.2/c3p0.version
 mysql.version5.1.6/mysql.version
 hsqldb.version2.2.8/hsqldb.version

 Improvements, comments, forks and pull requests are welcome.

 [1] https://github.com/Bessonov/wicket-example

 Best regards

 Anton


 --
 Oracle Certified Expert, Enterprise JavaBeans Developer
 Oracle Certified Professional, Java SE 6 Programmer
 Professional Scrum Master I  II

 Now that's a test of the character of an organization.
 Of the organizations that are attempting to implement
 Scrum probably, 30% - 35% will successfully implement it.
 - Ken Schwaber




-- 
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: Exception handling and testing

2012-09-27 Thread Martin Grigorov
Make the TabbedPanel stateless by using BookmarkablePageLink.

P.S. Please start a new thread when you have new questions.

On Wed, Sep 26, 2012 at 10:56 PM, Alec Swan alecs...@gmail.com wrote:
 Thanks, that worked as advertised. Now I am wondering if it's possible
 to get this to work when the user click on a tab in TabbedPanel?
 RenderPageRequestHandler(new PageProvider(HomePage.class),
 ALWAYS_REDIRECT) seems to lose the knowledge of the tab selected by
 the user and redirects the user to the default tab after he logs in on
 HomePage.

 Thoughts?

 Thanks,

 Alec

 On Wed, Sep 26, 2012 at 12:52 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 You have to return a IRequestHandler. See RenderPageRequestHandler

 On Wed, Sep 26, 2012 at 1:45 AM, Alec Swan alecs...@gmail.com wrote:
 I am trying to implement Martin's @SubSite annotation approach to
 redirect the user to the sub-site's home page when
 AuthenticationException is thrown in Wicket 1.5. However, apparently I
 cannot throw a 
 RestartResponseAtInterceptPageException(annotation.homePage())
 from AbstractRequestCycleListener#onException. How else can I redirect
 the user to the sub-site login page?

 The following RCH causes a 500 HTTP error page to be shown in the
 browser when AuthenticationException is thrown.

 public class AuthenticationExceptionRequestCycleHandler extends
 AbstractRequestCycleListener
 {
 @Override
 public IRequestHandler onException(RequestCycle cycle, Exception ex) {
 if (ex instanceof WicketRuntimeException 
 ex.getCause().getCause() instanceof AuthenticationException) {
 IPageRequestHandler lastHandler =
 PageRequestHandlerTracker.getLastHandler(cycle);
 Class? extends IRequestablePage pageClass = lastHandler
 == null ? null : lastHandler.getPageClass();
 if (pageClass != null) {
 SubSite annotation = pageClass.getAnnotation(SubSite.class);
 if (annotation != null  annotation.homePage() != null) {
 throw new
 RestartResponseAtInterceptPageException(annotation.homePage());
 }
 }
 }
 return super.onException(cycle, ex);
 }
 }

 Thanks,

 Alec

 On Fri, Jun 8, 2012 at 2:54 PM, Alec Swan alecs...@gmail.com wrote:
 I also use this approach, but with authentication exceptions thrown by
 Wicket it's hard to tell if the user was redirected to Login page
 because of authentication or some other exceptions.

 On Fri, Jun 8, 2012 at 1:15 PM, Michal Margiel michal.marg...@gmail.com 
 wrote:
 2012/6/8 Alec Swan alecs...@gmail.com

 That's clever. I will give it a try.

 What is the recommendation on verifying that an exception was thrown
 during page rendering using Wicket tester? I am not talking just about
 authentication here, but exceptions in general.


 Hello,
 Why you want to verify that exception was thrown in WicketTester? IMHO it
 is not proper place to check that.
 In my code I am verifying expcetions in services tests using
 catch-exception library [1].

 And then while testing Page I am mocking my service to throw exception and
 I am verifying behaviour on exception (e.g. redirecting to login page,
 showing error message etc...)

 That makes not only clearer code but also simplify testing.
 you can see example of services tests in [2] and page tests in [3]

 [1] http://code.google.com/p/catch-exception/
 [2]
 https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/services/UserServiceImplShould.java
 [3]
 https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/pages/admin/login/LoginPageShould.java
 --
 Pozdrawiam/Best regards
 Michał Margiel

 http://www.confitura.pl (dawniej Javarsovia)
 http://www.linkedin.com/in/MichalMargiel
 http://www.margiel.eu

 -
 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


 -
 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: AjaxEditableLabel Issue (Application in Production Mode)

2012-09-27 Thread Martin Grigorov
Hi,

Something else breaks the behavior.
Create a quickstart app and you will see that AjaxEditableLabel works
fine in Production mode.

On Wed, Sep 26, 2012 at 6:58 PM, Corbin, James jcor...@iqnavigator.com wrote:
 Hi Martin,

 Thanks for the feedback.  What is a bit confusing to me is how the
 behavior changes when running wicket in Production Mode (doesn't work) vs.
 Development Mode (works).  I don't see why the wicket application mode
 would cause this behavior to change.

 In our situation the AjaxEditableLabel component is nested in a table cell
 and the table itself is parented by a Form.

 I will look for JS errors as you suggest.

 Thanks,
 J.D.







 On 9/26/12 12:59 AM, Martin Grigorov mgrigo...@apache.org wrote:

Hi,

It sounds like a JavaScript related problem.
It could be that there is blocked Ajax channel and the click cannot
make it to the server. Or something similar happened once, this leaded
to different state at the server and the client and since then it
cannot re-synchronizes the states.

Reload the page and look for JavaScript errors.
In Firebug do: Wicket.Log.error = function(text) {console.log(text);}

On Tue, Sep 25, 2012 at 9:25 PM, Corbin, James jcor...@iqnavigator.com
wrote:
 I have an interesting issue that crept up in the use of the
AjaxEditableLabel component in Wicket 1.4.13 (I know, ancient).

 The component stopped processing the click event that is supposed to
cause the editor to render.  I was seeing different behavior depending
upon the mode of the Wicket Application and wondered if anyone might
have a  clue as to what was going on.

 With the exact same source code, when the Wicket Application was
configured to run in Production Mode, the AjaxEditableLabel would not,
when clicked, render the editor, but when in Development mode, it worked
as expected.

 In the server log there is a warning that the component is either not
visible or not enabled, which I know isn't true because it works
perfectly fine when the Wicket Application is in Development Mode.

 The only behavior that is being overridden on the AjaxEditableLabel
instance is the onSubmit.

 I searched the forums and google and could not find anything that would
explain the different behavior of this component when the application
mode was changed from development to production.

 Interesting enough, the AjaxEditableLabel does work fine in Production
mode in other areas of the application when no behaviors are overridden.
 Not sure if that has anything whatsoever to do with this issue.

 Ideas?

 J.D.



--
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





 -
 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: Session problem - object stays in after invalidate()

2012-09-27 Thread manuelbarzi
 Which, when clicked, is performed, but in the second request, the User
 object, which set to null in my overriden signOut(), is back in my

when are you exactly calling signOut? cant be deduced from your
snippet and comment. Session.invalidateNow won't remove your custom
session properties by itself, but only the Wicket components.

 session object. Not sure if the same obj, but the same values.

may you debug and verify hashCode to validate same object or not

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



Re: Session problem - object stays in after invalidate()

2012-09-27 Thread Martin Grigorov
Hi,

You need to use Session#invalidate() actually.

#invalidate() schedules a call to #invalidateNow() at the end of the
request cycle.

By using #invalidateNow() you invalidate the current http session and
right after this your app creates a new Session because it needs to
finish the request cycle and the new one is what you see later. You
can print the hashcodes to see whether I'm right.

On Thu, Sep 27, 2012 at 9:04 AM, Ondrej Zizka ozi...@redhat.com wrote:
 Hi,

 i am trying to implement a simple authentization.

 I've basically copied what's in the auth example #2 in wicket examples,
 and have a Logout button:

 add( new Link(logoutLink) {
 @Override public void onClick() {
 sess.invalidateNow();
 setResponsePage( HomePage.class );
 }
 }
 .add( new Label(label, Logout  +
 sess.getUser().getName()) )

 Which, when clicked, is performed, but in the second request, the User
 object, which set to null in my overriden signOut(), is back in my
 session object. Not sure if the same obj, but the same values.

 What could be wrong?

 Thanks,
 Ondra



-- 
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: Wicket 6 - add AjaxCallListener to existing component

2012-09-27 Thread Martin Grigorov
Hi,

class MyComponent extends SomeAjaxComponent {

   @Override
   protected void updateAjaxAttributes(attrs) {
 super.updateAjaxAttributes(attrs);

 attrs.getAjaxCallListeners().add(getListener());
   }

   protected abstract IAjaxCallListener getListener();
}

On Thu, Sep 27, 2012 at 10:34 AM, Marieke Vandamme
marieke.vanda...@tvh.be wrote:
 Hi,

 Is there a way to add a AjaxCallListener to an exiting component?
 The only way I know off is to override updateAjaxAttributes, but that is
 only possible when constructing the component.
 Is there something like component.getAjaxRequestAttributes() ?

 Thanks ! Kind regards, Marieke



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404.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: Wicket 6 - add AjaxCallListener to existing component

2012-09-27 Thread Marieke Vandamme
Hi, 

I have a component that I use to do my own feedback an stuff. 
This component contains a LabeledWebMarkupContainer, which is passed inside
the constructor. 
This LabeledWebMarkupContainer can be a TextField, DropDownChoice, Radio,
...

The constructor is like this: 

public MyFeedBackComponent(LabeledWebMarkupContainer component){
// here i want to add behavior for all kind of components 
component.getAjaxRequestAttributes().add(new AjaxCallListener());
}

So the implementation you suggest isn't applicable in my situation I guess..



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404p4652408.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 6 - add AjaxCallListener to existing component

2012-09-27 Thread Martin Grigorov
You don't need to have access to AjaxRequestAttributes all the time.
Just keep the reference to the listener and later add it in
#updateAjaxAttaributes().

On Thu, Sep 27, 2012 at 10:50 AM, Marieke Vandamme
marieke.vanda...@tvh.be wrote:
 Hi,

 I have a component that I use to do my own feedback an stuff.
 This component contains a LabeledWebMarkupContainer, which is passed inside
 the constructor.
 This LabeledWebMarkupContainer can be a TextField, DropDownChoice, Radio,
 ...

 The constructor is like this:

 public MyFeedBackComponent(LabeledWebMarkupContainer component){
 // here i want to add behavior for all kind of components
 component.getAjaxRequestAttributes().add(new AjaxCallListener());
 }

 So the implementation you suggest isn't applicable in my situation I guess..



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404p4652408.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: Wicket 6 - add AjaxCallListener to existing component

2012-09-27 Thread Marieke Vandamme
Sorry, I don't get it...
When I don't want to change all the constructors of my components, 
how can I use the function updateAjaxAttributes on an already existing
component ?
I thought this function is only overriddable when you are constructing the
component.

So when you want to add the same AjaxCallListener to all components on a
panel:
this.visitChildren(new IVisitorComponent, Void() {
public void component(Component component, IVisitVoid visit) {
//here I want to add the AjaxCallListener to the
component. I can't use updateAjaxAttributes here.. The components are all of
different Classes, TextField, TextArea, DropDownChoice, ...
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404p4652411.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 6 - add AjaxCallListener to existing component

2012-09-27 Thread Marieke Vandamme
In wicket 1.5 I could do:
this.visitChildren(new IVisitorComponent, Void() { 
public void component(Component component, IVisitVoid visit) { 
component.add(new AjaxEventBehavior()); 
} 
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404p4652412.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 6 - add AjaxCallListener to existing component

2012-09-27 Thread Martin Grigorov
On Thu, Sep 27, 2012 at 11:05 AM, Marieke Vandamme
marieke.vanda...@tvh.be wrote:
 In wicket 1.5 I could do:
 this.visitChildren(new IVisitorComponent, Void() {
 public void component(Component component, IVisitVoid visit) {
 component.add(new AjaxEventBehavior());

Wicket 6.0 is the same in this respect. You can still add Ajax
*Behavior*s this way.
IAjaxCallListener is IAjaxCallDecorator from Wicket 1.5. You weren't
able to add decorators without extending the behavior.

 }
 }



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-6-add-AjaxCallListener-to-existing-component-tp4652404p4652412.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



sicket 6 beta3 - wicket 6

2012-09-27 Thread Douglas Ferguson
I just tried to upgrade from beta3 to wicket 6 and one of my main pages blows 
up with a vengeance.

It's the typical error indicating that something is in the code but now the 
markup and it lists out almost every field!
You guys have any idea what might cause this? 

Works fine under beta3...

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



Re: sicket 6 beta3 - wicket 6

2012-09-27 Thread Thomas Götz
Please show us some code or create a Quickstart that demonstrates the problem, 
else it will be very hard to help you.


On 27.09.2012, at 14:23, Douglas Ferguson the...@gmail.com wrote:

 I just tried to upgrade from beta3 to wicket 6 and one of my main pages blows 
 up with a vengeance.
 
 It's the typical error indicating that something is in the code but now the 
 markup and it lists out almost every field!
 You guys have any idea what might cause this? 
 
 Works fine under beta3...
 
 Douglas



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



Re: Wicket 1.5 - Generic JSON Response

2012-09-27 Thread oggie
Ahijah wrote
 
 Martin Grigorov-4 wrote
 On Thu, Apr 12, 2012 at 7:38 AM, Ahijah lt;

 darren.greer@

 gt; wrote:
 
 mountResource(/Feed2, new MyResourceReference());
 
 class MyResourceReference extends ResourceReference {
   public IResource getResource() { return new MyResource(); }
 }
 Thanks Martin!  For everyone else's reference, the final code that is
 working looks like this:
 
 --Feed.class
 public class Feed extends AbstractResource {
   
   private static final long serialVersionUID = 1L;
   
   protected ResourceResponse newResourceResponse(Attributes a) { 
   ResourceResponse r = new ResourceResponse(); 
   r.setContentType(application/json);
   r.setWriteCallback(new WriteCallback() { 
   public void writeData(Attributes a) { 
   
 a.getResponse().write([{\id\:111,\title\:\MainEvent\,\start\:\2012-04-10T07:00:00\,\end\:\2012-04-10T09:30:00\,\url\:\?EventID=111\,\allDay\:false}]);
 } 
   }); 
   return r; 
   } 
 
 }
 ---End Feed.class--
 
 --Application.class
   @Override
   protected void init() {
   super.init();   
   mountResource(/Feed, new FeedReference());
   }
 
   public class FeedReference extends ResourceReference { 
   public FeedReference() {
   super(FeedReference.class, feed);
   }
   public IResource getResource() { return new Feed(); } 
   } 
 ---End Application.class-

Is there any way to tie this to the standard wicket security model? Right
now, our web pages are all annotated with @AuthorizeInstantiation(admin),
so how would we be able to apply it to this scenario?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652432.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: sicket 6 beta3 - wicket 6

2012-09-27 Thread Douglas Ferguson
That may take some time, there are some layers..

I just was curious if there are any known issues from beta3 to the stable 
release.

Douglas

On Sep 27, 2012, at 7:36 AM, Thomas Götz t...@decoded.de wrote:

 Please show us some code or create a Quickstart that demonstrates the 
 problem, else it will be very hard to help you.
 
 
 On 27.09.2012, at 14:23, Douglas Ferguson the...@gmail.com wrote:
 
 I just tried to upgrade from beta3 to wicket 6 and one of my main pages 
 blows up with a vengeance.
 
 It's the typical error indicating that something is in the code but now the 
 markup and it lists out almost every field!
 You guys have any idea what might cause this? 
 
 Works fine under beta3...
 
 Douglas
 
 
 
 -
 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



Modify markup of inherited page - merge title tags

2012-09-27 Thread rza
Hi there guys,

I have several inheriting pages within my application in the following
style:

BasePage:


SomePage (inherits BasePage):



I'm struggling to combine these titles (Application + Site), so that in the
result the title of SomePage would be titleSite :: Application/title.

The combination itself is not a problem, the main question is how, when and
where to handle the title tags.

Currently, I tried to register an /AbstractMarkupFilter /to flag all found
title tags and then register an /IComponentResolver /to resolve all title
tags to /Label/s which use the same model - so that only the first title
shows up (and shows the merged content of all titles).
That does work - but not good (it isn't even threadsafe the way I
implemented it) and it doesn't seem to be the right way to achieve what I
like to achieve.

So yesterday I searched for a better option and found that it would be a
good solution to override /MarkupFactory.getMarkup(MarkupContainer,
boolean)/ and to search the whole parsed markup for title tags - and remove
all but the last which itself would be rewritten to contain the merged
title.
But that does not work either - the method
/MarkupFactory.getMarkup(MarkupContainer, boolean)/ is final. :(

You may ask: Why don't you just register your own /IMarkupLoader/? The
problem with this is the page inheritance which is resolved kinda recursive
- and my MarkupLoader would not know whether he has the complete markup or
just one inheritance step.

So, what would be the recommended way to merge all the titles to one?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modify-markup-of-inherited-page-merge-title-tags-tp4652439.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: Modify markup of inherited page - merge title tags

2012-09-27 Thread Martin Grigorov
Hi,

I'd recommend you to use .java (e.g. a Label) to set the title instead
of wicket:head.


On Thu, Sep 27, 2012 at 3:57 PM, rza r...@adclear.net wrote:
 Hi there guys,

 I have several inheriting pages within my application in the following
 style:

 BasePage:


 SomePage (inherits BasePage):



 I'm struggling to combine these titles (Application + Site), so that in the
 result the title of SomePage would be titleSite :: Application/title.

 The combination itself is not a problem, the main question is how, when and
 where to handle the title tags.

 Currently, I tried to register an /AbstractMarkupFilter /to flag all found
 title tags and then register an /IComponentResolver /to resolve all title
 tags to /Label/s which use the same model - so that only the first title
 shows up (and shows the merged content of all titles).
 That does work - but not good (it isn't even threadsafe the way I
 implemented it) and it doesn't seem to be the right way to achieve what I
 like to achieve.

 So yesterday I searched for a better option and found that it would be a
 good solution to override /MarkupFactory.getMarkup(MarkupContainer,
 boolean)/ and to search the whole parsed markup for title tags - and remove
 all but the last which itself would be rewritten to contain the merged
 title.
 But that does not work either - the method
 /MarkupFactory.getMarkup(MarkupContainer, boolean)/ is final. :(

 You may ask: Why don't you just register your own /IMarkupLoader/? The
 problem with this is the page inheritance which is resolved kinda recursive
 - and my MarkupLoader would not know whether he has the complete markup or
 just one inheritance step.

 So, what would be the recommended way to merge all the titles to one?



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Modify-markup-of-inherited-page-merge-title-tags-tp4652439.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: Wicket 1.5 - Generic JSON Response

2012-09-27 Thread Martin Grigorov
IAuthorizationStrategy is not used for IResource at the moment.
You need to roll something yours for this check.

On Thu, Sep 27, 2012 at 3:37 PM, oggie gog...@gmail.com wrote:
 Ahijah wrote

 Martin Grigorov-4 wrote
 On Thu, Apr 12, 2012 at 7:38 AM, Ahijah lt;

 darren.greer@

 gt; wrote:

 mountResource(/Feed2, new MyResourceReference());

 class MyResourceReference extends ResourceReference {
   public IResource getResource() { return new MyResource(); }
 }
 Thanks Martin!  For everyone else's reference, the final code that is
 working looks like this:

 --Feed.class
 public class Feed extends AbstractResource {

   private static final long serialVersionUID = 1L;

   protected ResourceResponse newResourceResponse(Attributes a) {
   ResourceResponse r = new ResourceResponse();
   r.setContentType(application/json);
   r.setWriteCallback(new WriteCallback() {
   public void writeData(Attributes a) {

 a.getResponse().write([{\id\:111,\title\:\MainEvent\,\start\:\2012-04-10T07:00:00\,\end\:\2012-04-10T09:30:00\,\url\:\?EventID=111\,\allDay\:false}]);
 }
   });
   return r;
   }

 }
 ---End Feed.class--

 --Application.class
   @Override
   protected void init() {
   super.init();
   mountResource(/Feed, new FeedReference());
   }

   public class FeedReference extends ResourceReference {
   public FeedReference() {
   super(FeedReference.class, feed);
   }
   public IResource getResource() { return new Feed(); }
   }
 ---End Application.class-

 Is there any way to tie this to the standard wicket security model? Right
 now, our web pages are all annotated with @AuthorizeInstantiation(admin),
 so how would we be able to apply it to this scenario?



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652432.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: Wicket 1.5 - Generic JSON Response

2012-09-27 Thread oggie
Any suggestions on how I might roll my own? I tried a few things like
injecting the Feed class and annotating it, but I suspect it's too late at
that point.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652442.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 - Generic JSON Response

2012-09-27 Thread Martin Grigorov
There is no code in Wicket that will check for this annotation in
non-Component classes.

On Thu, Sep 27, 2012 at 4:17 PM, oggie gog...@gmail.com wrote:
 Any suggestions on how I might roll my own? I tried a few things like
 injecting the Feed class and annotating it, but I suspect it's too late at
 that point.




 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652442.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: sicket 6 beta3 - wicket 6

2012-09-27 Thread Jesse Long

WebSession#authenticate() disappeared after 6.0.0-beta3. Affected me...

Cheers,
Jesse

On 27/09/2012 14:41, Douglas Ferguson wrote:

That may take some time, there are some layers..

I just was curious if there are any known issues from beta3 to the stable 
release.

Douglas

On Sep 27, 2012, at 7:36 AM, Thomas Götz t...@decoded.de wrote:


Please show us some code or create a Quickstart that demonstrates the problem, 
else it will be very hard to help you.


On 27.09.2012, at 14:23, Douglas Ferguson the...@gmail.com wrote:


I just tried to upgrade from beta3 to wicket 6 and one of my main pages blows 
up with a vengeance.

It's the typical error indicating that something is in the code but now the 
markup and it lists out almost every field!
You guys have any idea what might cause this?

Works fine under beta3...

Douglas



-
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



Solved // Re: Session problem - object stays in after invalidate()

2012-09-27 Thread Ondrej Zizka
Solved.
I was writing an original reply, using I think I have something
conceptually wrong, when it hit my mind:

One of the components (the login/logout box) has this:

final EsscAuthSession sess = (EsscAuthSession)getSession();

and the onClick() was like

add( new Link(logoutLink) {
@Override public void onClick() {
sess.invalidate();
}
}

I.e. using the old request's session in onClick()'s request.
It's a bit leaky abstraction, as I got used not to think much about
requests, but in this case I had to realize.
So now it's

add( new Link(logoutLink) {
@Override public void onClick() {
getSession().invalidate();
}
}

Maybe it should be stressed in the wicket examples to call getSession()
to warn beginners.

Thanks for replies.
Ondra





On Thu, 2012-09-27 at 10:34 +0300, Martin Grigorov wrote:

 Hi,
 
 You need to use Session#invalidate() actually.
 
 #invalidate() schedules a call to #invalidateNow() at the end of the
 request cycle.
 
 By using #invalidateNow() you invalidate the current http session and
 right after this your app creates a new Session because it needs to
 finish the request cycle and the new one is what you see later. You
 can print the hashcodes to see whether I'm right.
 
 On Thu, Sep 27, 2012 at 9:04 AM, Ondrej Zizka ozi...@redhat.com wrote:
  Hi,
 
  i am trying to implement a simple authentization.
 
  I've basically copied what's in the auth example #2 in wicket examples,
  and have a Logout button:
 
  add( new Link(logoutLink) {
  @Override public void onClick() {
  sess.invalidateNow();
  setResponsePage( HomePage.class );
  }
  }
  .add( new Label(label, Logout  +
  sess.getUser().getName()) )
 
  Which, when clicked, is performed, but in the second request, the User
  object, which set to null in my overriden signOut(), is back in my
  session object. Not sure if the same obj, but the same values.
 
  What could be wrong?
 
  Thanks,
  Ondra
 
 
 




Re: Modify markup of inherited page - merge title tags

2012-09-27 Thread rza
Sorry, but this is not an option. I need to have the title in my markup.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modify-markup-of-inherited-page-merge-title-tags-tp4652439p4652449.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: sicket 6 beta3 - wicket 6

2012-09-27 Thread Douglas Ferguson
Thanks.. I'll check it out. I don't think that would cause these problems. :)

It's as if the wicket can't see any of the wicket:ids..

Did anything change with regards to enclosures? Or child  extend?

Douglas

On Sep 27, 2012, at 9:24 AM, Jesse Long j...@unknown.za.net wrote:

 WebSession#authenticate() disappeared after 6.0.0-beta3. Affected me...
 
 Cheers,
 Jesse
 
 On 27/09/2012 14:41, Douglas Ferguson wrote:
 That may take some time, there are some layers..
 
 I just was curious if there are any known issues from beta3 to the stable 
 release.
 
 Douglas
 
 On Sep 27, 2012, at 7:36 AM, Thomas Götz t...@decoded.de wrote:
 
 Please show us some code or create a Quickstart that demonstrates the 
 problem, else it will be very hard to help you.
 
 
 On 27.09.2012, at 14:23, Douglas Ferguson the...@gmail.com wrote:
 
 I just tried to upgrade from beta3 to wicket 6 and one of my main pages 
 blows up with a vengeance.
 
 It's the typical error indicating that something is in the code but now 
 the markup and it lists out almost every field!
 You guys have any idea what might cause this?
 
 Works fine under beta3...
 
 Douglas
 
 
 -
 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: Exception handling and testing

2012-09-27 Thread Alec Swan
Thanks, works great.

I just needed to convert IRequestParameters to PageParameters in
RequestHandler#onException() in order to remember the tab selection
made by the user throughout login. Is there a convenience method
somewhere in wicket to convert between IRequestParameters and
PageParameters?

Thanks,

Ale

On Thu, Sep 27, 2012 at 1:18 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Make the TabbedPanel stateless by using BookmarkablePageLink.

 P.S. Please start a new thread when you have new questions.

 On Wed, Sep 26, 2012 at 10:56 PM, Alec Swan alecs...@gmail.com wrote:
 Thanks, that worked as advertised. Now I am wondering if it's possible
 to get this to work when the user click on a tab in TabbedPanel?
 RenderPageRequestHandler(new PageProvider(HomePage.class),
 ALWAYS_REDIRECT) seems to lose the knowledge of the tab selected by
 the user and redirects the user to the default tab after he logs in on
 HomePage.

 Thoughts?

 Thanks,

 Alec

 On Wed, Sep 26, 2012 at 12:52 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 You have to return a IRequestHandler. See RenderPageRequestHandler

 On Wed, Sep 26, 2012 at 1:45 AM, Alec Swan alecs...@gmail.com wrote:
 I am trying to implement Martin's @SubSite annotation approach to
 redirect the user to the sub-site's home page when
 AuthenticationException is thrown in Wicket 1.5. However, apparently I
 cannot throw a 
 RestartResponseAtInterceptPageException(annotation.homePage())
 from AbstractRequestCycleListener#onException. How else can I redirect
 the user to the sub-site login page?

 The following RCH causes a 500 HTTP error page to be shown in the
 browser when AuthenticationException is thrown.

 public class AuthenticationExceptionRequestCycleHandler extends
 AbstractRequestCycleListener
 {
 @Override
 public IRequestHandler onException(RequestCycle cycle, Exception ex) {
 if (ex instanceof WicketRuntimeException 
 ex.getCause().getCause() instanceof AuthenticationException) {
 IPageRequestHandler lastHandler =
 PageRequestHandlerTracker.getLastHandler(cycle);
 Class? extends IRequestablePage pageClass = lastHandler
 == null ? null : lastHandler.getPageClass();
 if (pageClass != null) {
 SubSite annotation = 
 pageClass.getAnnotation(SubSite.class);
 if (annotation != null  annotation.homePage() != null) {
 throw new
 RestartResponseAtInterceptPageException(annotation.homePage());
 }
 }
 }
 return super.onException(cycle, ex);
 }
 }

 Thanks,

 Alec

 On Fri, Jun 8, 2012 at 2:54 PM, Alec Swan alecs...@gmail.com wrote:
 I also use this approach, but with authentication exceptions thrown by
 Wicket it's hard to tell if the user was redirected to Login page
 because of authentication or some other exceptions.

 On Fri, Jun 8, 2012 at 1:15 PM, Michal Margiel michal.marg...@gmail.com 
 wrote:
 2012/6/8 Alec Swan alecs...@gmail.com

 That's clever. I will give it a try.

 What is the recommendation on verifying that an exception was thrown
 during page rendering using Wicket tester? I am not talking just about
 authentication here, but exceptions in general.


 Hello,
 Why you want to verify that exception was thrown in WicketTester? IMHO it
 is not proper place to check that.
 In my code I am verifying expcetions in services tests using
 catch-exception library [1].

 And then while testing Page I am mocking my service to throw exception 
 and
 I am verifying behaviour on exception (e.g. redirecting to login page,
 showing error message etc...)

 That makes not only clearer code but also simplify testing.
 you can see example of services tests in [2] and page tests in [3]

 [1] http://code.google.com/p/catch-exception/
 [2]
 https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/services/UserServiceImplShould.java
 [3]
 https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/pages/admin/login/LoginPageShould.java
 --
 Pozdrawiam/Best regards
 Michał Margiel

 http://www.confitura.pl (dawniej Javarsovia)
 http://www.linkedin.com/in/MichalMargiel
 http://www.margiel.eu

 -
 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


 -
 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

 

Re: Small Wicket 6 Auth Example

2012-09-27 Thread Anton Bessonov

Hello Martin,

I removed it from dependency, thank you!

Best regards,

Anton

On 09/27/2012 09:15 AM, Martin Grigorov wrote:

wicket-spring-annot.version1.3.7/wicket-spring-annot.version

^^ This is not really needed.


--
Oracle Certified Expert, Enterprise JavaBeans Developer
Oracle Certified Professional, Java SE 6 Programmer
Professional Scrum Master I  II

Now that's a test of the character of an organization.
Of the organizations that are attempting to implement
Scrum probably, 30% - 35% will successfully implement it.
- Ken Schwaber


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



Re: WicketTester with custom html placement

2012-09-27 Thread Martin Grigorov
Hi,

What is WebAppResourceStreamLocator ?
It is not part of Wicket.

You just need to point to a folder with the .html files.
In Wicket 6: getResourceSettings().getResourceFinders().add(new
Path(new Folder(src/main/webapp)))

On Thu, Sep 27, 2012 at 10:22 PM, rdev devstuff2...@gmail.com wrote:
 Hi there!

 I am running in circles with this one, maybe you guys can help me. This is
 the problem:
 Im trying to use WicketTester to run some unit tests on an existing
 application. It has overriden WebApplication's init() to load the html files
 from some folder at the root of the web content area, with a
 WebAppResourceStreamLocator.

 But i keep getting that message that it cant find the html markup. From
 that, i gather that its not looking for them at the web content folder. I´ve
 tried to pass an instance of my class that extends WebApplication to
 WicketTester contructor, but i keep getting the error: cant find the html
 markup.

 Is there a way to use WicketTester with a WebApplication thta uses custom
 html placement? (custom as in not in the same folder of the class file)



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/WicketTester-with-custom-html-placement-tp4652460.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



clickable calendar cells

2012-09-27 Thread grazia
My customer needs to have an overview of some data through a calendar; each
calendar cell would contain data for a specific day; the cells would be
clickable so that the user could be redirected to another screen with more
information pertaining to the selected day of the month. 
Any idea as to how to accomplish this in wicket ?
 
Thank you in advance for any suggestion. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/clickable-calendar-cells-tp4652474.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 with arbitrary number of fields

2012-09-27 Thread Steve Swinsburg
Hi all,

I have a form that allows users to add an arbitrary number of fields, for 
example keywords for an item where there could be multiple.

Up until now I have been processing my form where the fields are known and map 
directly to a model. However I'm unsure as to how this mapping works, for 
example having two or more keywords for one item. Would the property in the 
backing model be a list for this item? Rather than a string for example?

Are there any examples of a similar dynamic form?

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