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


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/auth/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=BookmarkablePage[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=245M
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$LoginForm(loginForm),
page: com.sam.auth.TestLogin(0), interface:
IFormSubmitListener.onFormSubmitted],sessionid=535C7A65C8E2F12DE0EEA8EF26830D80,sessionsize=2602,sessionstart=Fri
Mar 26 13:42:13 EDT
2010,requests=3,totaltime=366,activerequests=0,maxmem=891M,total=525M,used=253M
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;
  }

}

Reply via email to