Session Invalidate

2009-12-15 Thread Zak Johnson
All -
 I am trying to invalidate an authenticated session as a way of logging
a user out and am having some trouble doing so. I'm doing the following:

add(new Link(logout){
public void onClick(){
getSession().invalidate();
getRequestCycle().setRedirect(true);
setResponsePage(Logout.class);
}
});

The response page just informs the user that they are logged out and
provides a hard link back to the login page.
However, this solution doesn't seem to be killing the session. I am able to
go right back into the app and start using it without logging back in.
I'm a n00b when it comes to security, so I could be doing something wrong
outside of wicket.

For some more context: Wicket isn't really touching the authentication
process (which is why I wonder if this has anything to do with wicket). I'm
using declarative security through the deployment descriptor and web.xml to
handle the authentication and authorization (for now). The user logs in
through a static page with a form which posts to j_security_check and if
successful, redirects to the app.

Any ideas on what I could be doing wrong?

Thanks!

Zak


Re: Session Invalidate

2009-12-15 Thread Zak Johnson
Well shoot. I was hoping to avoid that for the time being, but I was afraid
I would have to do it for a real logoff to work. I could always throw in
some javascript to close the current browser and open a new one with the
login page ;)

Thanks Ed,

Zak

On Tue, Dec 15, 2009 at 8:37 PM, Edward Zarecor wic...@indeterminate.orgwrote:

 
  For some more context: Wicket isn't really touching the authentication
  process (which is why I wonder if this has anything to do with wicket).
 I'm
  using declarative security through the deployment descriptor and web.xml
 to
  handle the authentication and authorization (for now). The user logs in
  through a static page with a form which posts to j_security_check and if
  successful, redirects to the app.
 
  Any ideas on what I could be doing wrong?
 
  Thanks!
 
  Zak
 

 If your pages or application aren't enforcing authentication or
 authorization, invalidating the session as you do won't prevent your
 pages from rendering.

 Check out this example:
 http://www.wicket-library.com/wicket-examples/authorization/

 Ultimately, you'll probably want to role you own session and add
 methods to the your application to return the login page and the
 unauthorized page, etc.


 Ed.

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




Get stateful page url

2009-12-11 Thread Zak Johnson
I am trying to figure out a way to grab the url of a stateful page instance.
So for example, I want to click a link which creates a new page and before
redirecting to that page I want to grab the ?wicket:interface=:1 part of
the URL. I stumbled across a simple way to do this before, but I've lost
that code and can't remember how I did it. I know I can use the page map
properties to get the page id and version, then just insert them into a
string but I have to believe there is a better way. Also, it's important
that I NOT use bookmarkable pages. Any ideas?

Zak


Re: Get stateful page url

2009-12-11 Thread Zak Johnson
So the reason I need this is because I have a requirement to submit a form
which keeps the main page constant but opens the result page in a new
window. Also, it can't be a modal window. I need to be able to popup several
windows without taking control away from the main page, and without re-using
the same popup. Not my favorite design choice, but it's a requirement that I
can't get around. I had done this before by just feeding the new page
instance URL to a javascript function to popup the windows.I was planning on
getting the base URL from RequestUtils and just appending the unique page
url to the end. If someone knows of a better way to do this, I'm all ears.

Zak

On Fri, Dec 11, 2009 at 9:10 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Why do you need it? Maybe there is a better way around it?

 **
 Martin

 2009/12/11 Zak Johnson zakinte...@gmail.com:
  I am trying to figure out a way to grab the url of a stateful page
 instance.
  So for example, I want to click a link which creates a new page and
 before
  redirecting to that page I want to grab the ?wicket:interface=:1 part
 of
  the URL. I stumbled across a simple way to do this before, but I've lost
  that code and can't remember how I did it. I know I can use the page map
  properties to get the page id and version, then just insert them into a
  string but I have to believe there is a better way. Also, it's important
  that I NOT use bookmarkable pages. Any ideas?
 
  Zak
 

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




Re: Get stateful page url

2009-12-11 Thread Zak Johnson
Yes, your example is what I was doing in the past to execute the JS on the
form submit. My problem is getting the actual page url to feed into my JS
call. I know there is a way to get it because I've done it before, I just
can't remember how and I lost the original code.

Zak


On Fri, Dec 11, 2009 at 9:25 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Hi!

 It is a bit similar to my problem once:
 http://osdir.com/ml/users-wicket.apache.org/2009-07/msg00471.html

 The idea is that you do an ajax form submit, then you return an ajax
 response that opens the result popup window.

 **
 Martin

 2009/12/11 Zak Johnson zakinte...@gmail.com:
  So the reason I need this is because I have a requirement to submit a
 form
  which keeps the main page constant but opens the result page in a new
  window. Also, it can't be a modal window. I need to be able to popup
 several
  windows without taking control away from the main page, and without
 re-using
  the same popup. Not my favorite design choice, but it's a requirement
 that I
  can't get around. I had done this before by just feeding the new page
  instance URL to a javascript function to popup the windows.I was planning
 on
  getting the base URL from RequestUtils and just appending the unique page
  url to the end. If someone knows of a better way to do this, I'm all
 ears.
 
  Zak
 
  On Fri, Dec 11, 2009 at 9:10 AM, Martin Makundi 
  martin.maku...@koodaripalvelut.com wrote:
 
  Why do you need it? Maybe there is a better way around it?
 
  **
  Martin
 
  2009/12/11 Zak Johnson zakinte...@gmail.com:
   I am trying to figure out a way to grab the url of a stateful page
  instance.
   So for example, I want to click a link which creates a new page and
  before
   redirecting to that page I want to grab the ?wicket:interface=:1
 part
  of
   the URL. I stumbled across a simple way to do this before, but I've
 lost
   that code and can't remember how I did it. I know I can use the page
 map
   properties to get the page id and version, then just insert them into
 a
   string but I have to believe there is a better way. Also, it's
 important
   that I NOT use bookmarkable pages. Any ideas?
  
   Zak
  
 
  -
  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: Get stateful page url

2009-12-11 Thread Zak Johnson
Thanks Igor, that lead me in the right direction. Here is what I did:

page.getRequestCycle().urlFor(page);
That gave me the specific page url I was looking for.
Seems kinda roundabout, so if there is a better way, let me know.

Thanks!

Zak

On Fri, Dec 11, 2009 at 10:49 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 urlfor(page)

 -igor

 On Fri, Dec 11, 2009 at 7:36 AM, Zak Johnson zakinte...@gmail.com wrote:
  Yes, your example is what I was doing in the past to execute the JS on
 the
  form submit. My problem is getting the actual page url to feed into my JS
  call. I know there is a way to get it because I've done it before, I just
  can't remember how and I lost the original code.
 
  Zak
 
 
  On Fri, Dec 11, 2009 at 9:25 AM, Martin Makundi 
  martin.maku...@koodaripalvelut.com wrote:
 
  Hi!
 
  It is a bit similar to my problem once:
  http://osdir.com/ml/users-wicket.apache.org/2009-07/msg00471.html
 
  The idea is that you do an ajax form submit, then you return an ajax
  response that opens the result popup window.
 
  **
  Martin
 
  2009/12/11 Zak Johnson zakinte...@gmail.com:
   So the reason I need this is because I have a requirement to submit a
  form
   which keeps the main page constant but opens the result page in a new
   window. Also, it can't be a modal window. I need to be able to popup
  several
   windows without taking control away from the main page, and without
  re-using
   the same popup. Not my favorite design choice, but it's a requirement
  that I
   can't get around. I had done this before by just feeding the new page
   instance URL to a javascript function to popup the windows.I was
 planning
  on
   getting the base URL from RequestUtils and just appending the unique
 page
   url to the end. If someone knows of a better way to do this, I'm all
  ears.
  
   Zak
  
   On Fri, Dec 11, 2009 at 9:10 AM, Martin Makundi 
   martin.maku...@koodaripalvelut.com wrote:
  
   Why do you need it? Maybe there is a better way around it?
  
   **
   Martin
  
   2009/12/11 Zak Johnson zakinte...@gmail.com:
I am trying to figure out a way to grab the url of a stateful page
   instance.
So for example, I want to click a link which creates a new page and
   before
redirecting to that page I want to grab the
 ?wicket:interface=:1
  part
   of
the URL. I stumbled across a simple way to do this before, but I've
  lost
that code and can't remember how I did it. I know I can use the
 page
  map
properties to get the page id and version, then just insert them
 into
  a
string but I have to believe there is a better way. Also, it's
  important
that I NOT use bookmarkable pages. Any ideas?
   
Zak
   
  
   -
   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: Get stateful page url

2009-12-11 Thread Zak Johnson
Is urlFor(Page page) available in the 1.3.7 release? I tried using the
urlFor method provided in the component, but I didn't see one that took a
page as a parameter. I'm in an enterprise environment that has me restricted
to that older package. :(

Zak

On Fri, Dec 11, 2009 at 11:29 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 urlfor exists on component, so you can simply say

 urlfor(page) inside any component method

 -gior

 On Fri, Dec 11, 2009 at 9:18 AM, Zak Johnson zakinte...@gmail.com wrote:
  Thanks Igor, that lead me in the right direction. Here is what I did:
 
  page.getRequestCycle().urlFor(page);
  That gave me the specific page url I was looking for.
  Seems kinda roundabout, so if there is a better way, let me know.
 
  Thanks!
 
  Zak
 
  On Fri, Dec 11, 2009 at 10:49 AM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  urlfor(page)
 
  -igor
 
  On Fri, Dec 11, 2009 at 7:36 AM, Zak Johnson zakinte...@gmail.com
 wrote:
   Yes, your example is what I was doing in the past to execute the JS on
  the
   form submit. My problem is getting the actual page url to feed into my
 JS
   call. I know there is a way to get it because I've done it before, I
 just
   can't remember how and I lost the original code.
  
   Zak
  
  
   On Fri, Dec 11, 2009 at 9:25 AM, Martin Makundi 
   martin.maku...@koodaripalvelut.com wrote:
  
   Hi!
  
   It is a bit similar to my problem once:
   http://osdir.com/ml/users-wicket.apache.org/2009-07/msg00471.html
  
   The idea is that you do an ajax form submit, then you return an ajax
   response that opens the result popup window.
  
   **
   Martin
  
   2009/12/11 Zak Johnson zakinte...@gmail.com:
So the reason I need this is because I have a requirement to submit
 a
   form
which keeps the main page constant but opens the result page in a
 new
window. Also, it can't be a modal window. I need to be able to
 popup
   several
windows without taking control away from the main page, and without
   re-using
the same popup. Not my favorite design choice, but it's a
 requirement
   that I
can't get around. I had done this before by just feeding the new
 page
instance URL to a javascript function to popup the windows.I was
  planning
   on
getting the base URL from RequestUtils and just appending the
 unique
  page
url to the end. If someone knows of a better way to do this, I'm
 all
   ears.
   
Zak
   
On Fri, Dec 11, 2009 at 9:10 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:
   
Why do you need it? Maybe there is a better way around it?
   
**
Martin
   
2009/12/11 Zak Johnson zakinte...@gmail.com:
 I am trying to figure out a way to grab the url of a stateful
 page
instance.
 So for example, I want to click a link which creates a new page
 and
before
 redirecting to that page I want to grab the
  ?wicket:interface=:1
   part
of
 the URL. I stumbled across a simple way to do this before, but
 I've
   lost
 that code and can't remember how I did it. I know I can use the
  page
   map
 properties to get the page id and version, then just insert them
  into
   a
 string but I have to believe there is a better way. Also, it's
   important
 that I NOT use bookmarkable pages. Any ideas?

 Zak

   
   
 -
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: How to post form to new window using AjaxSubmitLink

2009-12-11 Thread Zak Johnson
I had a similar need and did as Igor suggested. Here is an example:

add(new AjaxButton(ajax-button){
public void onSubmit(AjaxRequestTarget target, Form form) {
...create result page, get the url path to it...
target.appendJavascript(window.open('http://page_path_goes_here
','window_name'););
}
});

Something funny i'm working through in testing (and this a javascript issue,
not wicket) is that IE won't open the window unless the window name is
strictly alpha-numeric. FF works fine though.

Zak

On Fri, Dec 11, 2009 at 2:50 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 you can output some javascript using the ajaxrequesttarget that does
 window.open

 -igor

 On Fri, Dec 11, 2009 at 12:31 PM, Jeff Andersen jander...@posportal.com
 wrote:
  I need to know how I can post a form to a new window using an
 AjaxSubmitLink.  I have a small page where a user can make a few setting
 changes and then either save those settings (using an AjaxButton) or preview
 those settings (using an AjaxSubmitLink) in a new window.  The problem is, I
 can't figure out how to make the preview button open in a new window.  Since
 there are no popup settings for an AjaxSubmitLink, I'm not sure what to do.
 
  I've tried searching for a solution and the best I could find indicated
 that I should use a form target=_blank.  But that doesn't seem to change
 anything.  The call to setResponsePage always results in the preview page
 opening in the same browser window.
 
  Below is the code for my submit and preview buttons:
 
 AjaxButton submit = new AjaxButton(websiteSetting-submit-button)
 {
 
 @Override
 protected void onError(AjaxRequestTarget target, Form? form)
 {
 super.onError(target, form);
 feedbackPanel.add(new AttributeModifier(style, true, new
 Model(color:red;)));
 target.addComponent(feedbackPanel);
 target.addComponent(form);
 }
 
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form?
 form) {
 processSubmission(target, form, false);
 }
 
 //Prepending the call to set the target to nothing for normal
 form submission.
 @Override
 protected IAjaxCallDecorator getAjaxCallDecorator() {
 return new
 AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
 
 private static final long serialVersionUID = 1L;
 
 @Override
 public CharSequence preDecorateScript(CharSequence
 script) {
 String sJs = document.getElementById(' +
 form.getMarkupId() + ').target = '';;
 
 return sJs + script;
 }
 };
 }
 };
 
 AjaxSubmitLink preview = new
 AjaxSubmitLink(websiteSetting-preview-button) {
 
 @Override
 protected void onError(AjaxRequestTarget target, Form? form)
 {
 super.onError(target, form);
 feedbackPanel.add(new AttributeModifier(style, true, new
 Model(color:red;)));
 target.addComponent(feedbackPanel);
 target.addComponent(form);
 }
 
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form?
 form) {
 setResponsePage(HomePage.class);
 }
 
 //Prepending the call to set the target to _blank for
 preview submission to new window.
 @Override
 protected IAjaxCallDecorator getAjaxCallDecorator() {
 return new
 AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
 
 private static final long serialVersionUID = 1L;
 
 @Override
 public CharSequence preDecorateScript(CharSequence
 script) {
 String sJs = document.getElementById(' +
 form.getMarkupId() + ').target = '_blank';alert(document.getElementById('
 + form.getMarkupId() + ').target);;
 
 return sJs + script;
 }
 };
 }
 };
 
  Thanks,
  Jeff
 
  * This e-mail and any files transmitted with it may contain confidential
 and/or privileged information and intended solely for the use of the
 individual or entity to whom they are addressed. If you are not the
 addressee or authorized to receive this for the addressee, you must not use,
 copy, disclose, or take any action based on this message or any information
 herein. If you have received this message in error, please advise the sender
 immediately by reply e-mail and delete this message.
 

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




Open new window through a form

2009-11-18 Thread Zak Johnson
All -
 I am trying to find a way to open a new window after submitting a form.
I've seen the threads about using a Link with PopupSettings, but I can't use
a link in this case, I need this popup to happen within the onSubmit method.
I also can't use ModalWindow because I need the ability to keep the new
window open and still allow me to go back to the main window to submit
another form, spawning the creation of another new window, etc.

Basically, the app is executing queries (via a form, for variable input) and
I am trying to display the results in the new window. I Frequently need to
see the results of several queries, which is why I need the functionality to
go back to the main page and submit another form, opening an additional
window. I could use the Link with PopupSettings method to open the form in a
new window, but i'd prefer to avoid that option if possible.

I've been banging my head against a wall for days now. Does anyone have any
ideas?

Thanks,

Zak