You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bryan Montgomery <mo...@english.net> on 2010/04/05 16:36:54 UTC

Re: Wicket form data isn't received

Hello,
I left this for a week - but had another look. It's weird - if I don't mess
with the flow (ie don;t try to do NTLM authentication) it works fine.
However, I somehow seem to be messing up the process flow with the NTLM
authentication. Unfortunately I'm not currently running through an ide so
I'm relying on debug statements. don't know if it will shed any light, but
what I'm seeing is;

Make request to /app
(redirects to login page which includes login panel)
In LoginPage - constructor, username & password null
In LoginPanel constructor
In LoginPanel.onBeforeRender
Call ntlm authorization
throw AbortWithHttpStatusException

In LoginPage - constructor, username & password null
In LoginPanel constructor
In LoginPanel.onBeforeRender
At this point, have an authentication header, but no user information.

In LoginPage - constructor, username & password null
In LoginPanel constructor
In LoginPanel.onBeforeRender
Obtain and validate ntlm authentication
Call AuthenticatedWebSession.get().signIn with windows username
throw unknown user exception
catch exception, call error

Page displayed to user - fill in form, hit submit
In LoginPanel.onBeforeRender (no constructor called) user is empty string
(not value entered or null)

At this point I get the entry below, so it seems that the submit isnot
getting called and also that the user and passwod values are not being
submitted from the form to the class.

05 Apr 2010 09:55:24,798:
time=25,event=Interface[target:NrgLoginPanel$OmsLoginForm(nrgLoginPanel:loginForm),
page: com.sam.auth.NrgLoginPage(2), interface:
IFormSubmitListener.onFormSubmitted],response=Interface[target:NrgLoginPanel$OmsLoginForm(nrgLoginPanel:loginForm),
page: com.sam.auth.NrgLoginPage(2), interface:
IFormSubmitListener.onFormSubmitted],sessionid=564654FE9A6195261CB9895783FCDD45,sessionsize=6970,sessionstart=Mon
Apr 05 09:55:13 EDT
2010,requests=6,totaltime=2612,activerequests=0,maxmem=891M,total=531M,used=261M






On Fri, Mar 26, 2010 at 5:14 PM, Josh Chappelle <jc...@4redi.com>wrote:

> Bryan,
>
> Have you put a breakpoint in your onSubmit method of the form to see if it
> is getting to that point? If it isn't then make sure you don't have a
> validator failing and no feedback panel. I've made that mistake before.
>
> Thanks,
>
> Josh
>
> -----Original Message-----
> From: Bryan Montgomery [mailto:monty@english.net]
> Sent: Friday, March 26, 2010 3:33 PM
> To: users@wicket.apache.org
> Subject: Wicket form data isn't received
>
> I've been working on an existing wicket application and am banging my head
> against the desk :)
>
> I'm trying to have two different pages that handle the sign on for the
> authenticated web session. One which is using ntlm with jcifs works fine.
> However, I can't get any other forms to work. I see from looking closely at
> the log file that the data is posted - however it almost looks like it's
> redirected. I did see that it was 'unable to find cookie' - but i wouldn't
> think that is the problem. I've looked through the web.xml and the page we
> have that extends the AuthenticatedWebApplication. I'm not sure if that is
> the issue, or  if it something else. I wonder if the form is being
> redirected as it is not authenticated ending up in a catch 22. Is a way to
> have unauthenticated pages when using the AuthenticatedWebApplication? Or
> am
> I stuck in a vicious circle :)
>
> I've included the html and java, based on the article at
>
> http://www.developer.com/java/web/article.php/3673576/Wicket-The-First-Steps
> .htm<http://www.developer.com/java/web/article.php/3673576/Wicket-The-First-Steps%0A.htm>
>
>
> 26 Mar 2010 13:42:13,430: (request cycle) url: /nrg/app/test
> 26 Mar 2010 13:42:13,603: Add userId to [MarkupContainer [Component id =
> loginForm]]
> 26 Mar 2010 13:42:13,605: Add loginForm to [Page class =
> com.sam.auth.TestLogin, id = 0, version = 0]
> 26 Mar 2010 13:42:13,649: Begin render [Page class =
> com.sam.auth.TestLogin,
> id = 0, version = 0]
> 26 Mar 2010 13:42:13,657: Load markup:
> cacheKey=com.sam.auth.TestLoginen_UShtml
> 26 Mar 2010 13:42:13,694: Loading markup from
>
> file:/home/HOMEDIRS/montgomeryb/tomcat/webapps/nrg/WEB-INF/classes/com/sam/a
> uth/TestLogin.html
> 26 Mar 2010 13:42:13,756: ending request for page [Page class =
> com.sam.auth.TestLogin, id = 0, version = 0], request [method = GET,
> protocol = HTTP/1.1, requestURL = http://poe3b:8800/nrg/app/test,
> contentType = null, contentLength = -1, contextPath = /nrg, pathInfo =
> null,
> requestURI = /nrg/app/test, servletPath = /app/test, pathTranslated = null]
> 26 Mar 2010 13:42:13,771:
>
> time=328,event=BookmarkablePage[com.sam.auth.TestLogin()],response=Bookmarka
>
> blePage[com.sam.auth.TestLogin()],sessionid=535C7A65C8E2F12DE0EEA8EF26830D80
> ,sessionsize=326,sessionstart=Fri
> Mar 26 13:42:13 EDT
>
> 2010,requests=2,totaltime=328,activerequests=0,maxmem=891M,total=525M,used=2
> 45M
> 26 Mar 2010 13:42:13,771: ending request for page [Page class =
> com.sam.auth.TestLogin, id = 0, version = 0], request [method = GET,
> protocol = HTTP/1.1, requestURL = http://poe3b:8800/nrg/app/test,
> contentType = null, contentLength = -1, contextPath = /nrg, pathInfo =
> null,
> requestURI = /nrg/app/test, servletPath = /app/test, pathTranslated = null]
> 26 Mar 2010 13:42:18,771: (request cycle) url: /nrg/app/test
> 26 Mar 2010 13:42:18,772: Getting page [path = 0:loginForm, versionNumber =
> 0]
> 26 Mar 2010 13:42:18,774: registered listener interface
> [RequestListenerInterface name=INewBrowserWindowListener, method=public
> abstract void
>
> org.apache.wicket.markup.html.INewBrowserWindowListener.onNewBrowserWindow()
> ]
> 26 Mar 2010 13:42:18,790: Unable to find Cookie with name=loginForm.userId
> and request URI=/nrg/app/test
> You entered User id null
> 26 Mar 2010 13:42:18,793: Begin render [Page class =
> com.sam.auth.TestLogin,
> id = 0, version = 0]
> 26 Mar 2010 13:42:18,799: Rendering raw markup
> 26 Mar 2010 13:42:18,807: End render [Page class = com.sam.auth.TestLogin,
> id = 0, version = 0]
> 26 Mar 2010 13:42:18,809: ending request for page [Page class =
> com.sam.auth.TestLogin, id = 0, version = 0], request [method = POST,
> protocol = HTTP/1.1, requestURL = http://poe3b:8800/nrg/app/test,
> contentType = application/x-www-form-urlencoded, contentLength = 0,
> contextPath = /nrg, pathInfo = null, requestURI = /nrg/app/test,
> servletPath
> = /app/test, pathTranslated = null]
> 26 Mar 2010 13:42:18,813:
> time=38,event=Interface[target:TestLogin$LoginForm(loginForm), page:
> com.sam.auth.TestLogin(0), interface:
>
> IFormSubmitListener.onFormSubmitted],response=Interface[target:TestLogin$Log
> inForm(loginForm),
> page: com.sam.auth.TestLogin(0), interface:
>
> IFormSubmitListener.onFormSubmitted],sessionid=535C7A65C8E2F12DE0EEA8EF26830
> D80,sessionsize=2602,sessionstart=Fri
> Mar 26 13:42:13 EDT
>
> 2010,requests=3,totaltime=366,activerequests=0,maxmem=891M,total=525M,used=2
> 53M
> 26 Mar 2010 13:42:18,815: ending request for page [Page class =
> com.sam.auth.TestLogin, id = 0, version = 0], request [method = POST,
> protocol = HTTP/1.1, requestURL = http://poe3b:8800/nrg/app/test,
> contentType = application/x-www-form-urlencoded, contentLength = 0,
> contextPath = /nrg, pathInfo = null, requestURI = /nrg/app/test,
> servletPath
> = /app/test, pathTranslated = null]
> 26 Mar 2010 13:42:18,816: Redirecting to ?wicket:interface=:0::::
>
>
>
> <html>
>  <title>Hello World</title>
>  <body>
>    <form wicket:id="loginForm">
>           User Name <input type="text" wicket:id="userId"/><br/>
>           <input type="submit" value="Login"/>
>    </form>
>  </body>
> </html>
>
> package com.sam.auth;
>
>
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.form.Form;
> import org.apache.wicket.markup.html.form.PasswordTextField;
> import org.apache.wicket.markup.html.form.TextField;
> import org.apache.wicket.model.PropertyModel;
>
> public class TestLogin extends WebPage {
>
>  private String userId;
>
>  private Form form;
>
>  public TestLogin(){
>
>    TextField userIdField = new TextField("userId",
>                  new PropertyModel(this,"userId"));
>
>    form = new LoginForm("loginForm");
>    form.add(userIdField);
>    add(form);
>  }
>
> // Define your LoginForm and override onSubmit
> class LoginForm extends Form {
>  public LoginForm(String id) {
>    super(id);
>  }
>  @Override
>  public void onSubmit() {
>    String userId = TestLogin.this.getUserId();
>    System.out.println("You entered User id "+ userId );
>  }
> }
>
> /** Helper methods to retrieve the userId and the password **/
>
>  public String getUserId() {
>    return userId;
>  }
>
>  public void setUserId(String userId) {
>    this.userId = userId;
>  }
>
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>