Simply can't figure this one out. Tried again today to use v1.2.3 and came up short. Opened JIRA issue *WICKET-198 <https://issues.apache.org/jira/browse/WICKET-198> * kurt heston wrote: > This war replicates the problem. Use it with RC3 jars, it will work > fine. However, it won't work with 1.2.x jars at all. > > > Johan Compagner wrote: >> if not make a jira issue: >> >> http://issues.apache.org/jira/browse/WICKET >> >> and point us to the jira number. >> >> johan >> >> >> On 10/31/06, *kurt heston* <[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>> wrote: >> >> Sure. Didn't know I could attach a web archive (it wouldn't let me >> attach a zip). >> >> >> Johan Compagner wrote: >> > can't you put in in a quickstart.war so that we can directly >> run it? >> > >> > joahn >> > >> > >> > On 10/30/06, *kurt heston* < [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> >> > <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>>> wrote: >> > >> > I've attached a test case I wrote. It works fine until I >> upgrade >> > the jars. >> > >> > kurt heston wrote: >> > > None of my Forms work after upgrading from 1.2.rc3. Can >> anyone give >> > > me a clue what's wrong? No error is thrown, it's just >> that NONE >> > of my >> > > form field values are anything other than an empty string. >> > > >> > > Johan Compagner wrote: >> > >> that seems to be the error then. >> > >> What is the full stacktrace of that error? >> > >> >> > >> johan >> > >> >> > >> >> > >> On 10/23/06, *kurt heston* < [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> >> > <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>> >> > >> <mailto: [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> >> > <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>>>> wrote: >> > >> >> > >> Is this normal behavior or a good place to start >> chasing >> > down my >> > >> issue: >> > >> >> > >> "java.lang.NoSuchFieldException: username" >> > >> >> > >> kurt heston wrote: >> > >> > Something changed about how I'm supposed to override >> > >> WebRequestCycle. >> > >> > This is where my values are disappearing. Reading >> up on >> > it now... >> > >> > >> > >> > Igor Vaynberg wrote: >> > >> > >> > >> >> yes you are too vague, and another problem is that >> this >> > list >> > >> has been >> > >> >> down because of sf.net <http://sf.net> >> <http://sf.net> <http://sf.net> >> > <http://sf.net >> > >> < http://sf.net>> for a while. >> > >> >> >> > >> >> -Igor >> > >> >> >> > >> >> >> > >> >> On 10/2/06, * kurt heston* < >> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >> > <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>> >> > >> <mailto: [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>>> >> > >> >> <mailto: [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> >> > <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>> >> > >> <mailto:[EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]> >> > <mailto: [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>>>>> wrote: >> > >> >> >> > >> >> Am I being too vague here to get an answer? >> Do I >> > need to >> > >> post my >> > >> >> code? >> > >> >> >> > >> >> kurt heston wrote: >> > >> >> > All I did was switch from >> wicket-1.2-rc3.jar to >> > >> wicket-1.2.2.jar >> > >> >> and my >> > >> >> > SignIn page, adapted from Juergen's code, >> stopped >> > >> working. The >> > >> >> fields >> > >> >> > are always an empty string. >> > >> >> > >> > >> >> > What did I miss in the release notes? >> > >> >> > >> > >> >> > >> > >> >> >> > >> >> > >> ------------------------------------------------------------------------- >> >> >> > >> > >> >> > >> >> > Take Surveys. Earn Cash. Influence the >> Future of IT >> > >> >> > Join SourceForge.net's Techsay panel and >> you'll >> > get the >> > >> chance >> > >> >> to share your >> > >> >> > opinions on IT & business topics through >> brief surveys >> > >> -- and >> > >> >> earn cash >> > >> >> > >> > >> >> >> > >> >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>> >> >> > >> >> > >> >> > >> < >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>>> >> >> >> > >> >> > >> >> < >> > >> >> > >> >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>> >> >> > >> >> > >> >> > >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>>>> >> >> >> > >> >> > >> >> > >> _______________________________________________ >> > >> >> > Wicket-user mailing list >> > >> >> > [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>> >> > >> >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>>> >> > >> >> > >> > https://lists.sourceforge.net/lists/listinfo/wicket-user >> > >> >> > >> > >> >> > >> > >> >> >> > >> >> >> > >> >> > >> ------------------------------------------------------------------------- >> >> > >> > >> >> > >> >> >> > >> >> Take Surveys. Earn Cash. Influence the Future >> of IT >> > >> >> Join SourceForge.net's Techsay panel and >> you'll get the >> > >> chance to >> > >> >> share your >> > >> >> opinions on IT & business topics through brief >> > surveys -- >> > >> and earn >> > >> >> cash >> > >> >> >> > >> >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>> >> >> > >> >> > >> >> > >> < >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>>> >> >> >> > >> >> > >> >> >> > >> < >> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>> >> >> > >> >> > >> >> > >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> >> >> > >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> >> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>>>> >> >> >> > >> >> > >> >> _______________________________________________ >> > >> >> Wicket-user mailing list >> > >> >> [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>> >> > >> >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto: [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>>> >> > >> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > >> >> <https://lists.sourceforge.net/lists/listinfo/wicket-user> >> > >> >> >> > >> >> >> > >> >> >> > >> > >> > >> > >> > >> >> > >> >> > >> ------------------------------------------------------------------------- >> >> >> > >> >> > >> > Using Tomcat but need to do more? Need to support web >> > services, >> > >> security? >> > >> > Get stuff done quickly with pre-integrated >> technology to make >> > >> your job easier >> > >> > Download IBM WebSphere Application Server v.1.0.1 >> based on >> > >> Apache Geronimo >> > >> > >> > >> >> > >> >> > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>> >> >> > >> >> > >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>>> >> >> > >> >> > >> > _______________________________________________ >> > >> > Wicket-user mailing list >> > >> > [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto:[email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>> >> > >> > >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > <https://lists.sourceforge.net/lists/listinfo/wicket-user> >> > >> > >> > >> > >> > >> >> > >> >> > >> >> > >> ------------------------------------------------------------------------- >> >> > >> >> > >> Using Tomcat but need to do more? Need to support web >> > services, >> > >> security? >> > >> Get stuff done quickly with pre-integrated >> technology to >> > make your >> > >> job easier >> > >> Download IBM WebSphere Application Server v.1.0.1 >> based on >> > Apache >> > >> Geronimo >> > >> >> > >> >> > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>> >> >> > >> >> > >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>>> >> >> > >> >> > >> _______________________________________________ >> > >> Wicket-user mailing list >> > >> [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>> >> > >> <mailto:[email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>> >> > >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> <https://lists.sourceforge.net/lists/listinfo/wicket-user> >> > <https://lists.sourceforge.net/lists/listinfo/wicket-user> >> > >> >> > >> >> > >> >> > >> ------------------------------------------------------------------------ >> >> > >> >> > >> >> > >> ------------------------------------------------------------------------- >> >> > >> >> > >> Using Tomcat but need to do more? Need to support web >> services, >> > >> security? >> > >> Get stuff done quickly with pre-integrated technology to >> make your >> > >> job easier >> > >> Download IBM WebSphere Application Server v.1.0.1 based >> on Apache >> > >> Geronimo >> > >> >> > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>> >> >> > >> >> > >> ------------------------------------------------------------------------ >> > >> >> > >> _______________________________________________ >> > >> Wicket-user mailing list >> > >> [email protected] >> <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]> > >> > >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > >> >> > > >> > >> > >> > package test.base ; >> > >> > import java.awt.Color; >> > >> > import test.auth.UserSession; >> > import wicket.Resource; >> > import wicket.markup.html.WebPage; >> > import wicket.markup.html.form.ImageButton ; >> > import >> wicket.markup.html.image.resource.DefaultButtonImageResource ; >> > import wicket.markup.html.link.BookmarkablePageLink; >> > import wicket.markup.html.link.PopupSettings; >> > >> > public class BasePage extends WebPage { >> > >> > public static ImageButton getButton(String buttonName, >> String >> > label) { >> > DefaultButtonImageResource r = new >> > DefaultButtonImageResource(label); >> > Color c = new Color(60, 179, 113); >> > r.setColor(c); >> > return new ImageButton(buttonName, r); >> > } >> > >> > public static Resource getButton(String label) { >> > DefaultButtonImageResource r = new >> > DefaultButtonImageResource(label); >> > Color c = new Color(60, 179, 113); >> > r.setColor(c); >> > >> > return r; >> > } >> > >> > public UserSession getWebSession() { >> > return (UserSession) getSession(); >> > } >> > >> > protected BookmarkablePageLink popInstructions(String >> string, >> > Class class1) { >> > PopupSettings popupSettings = new >> > PopupSettings().setHeight(500).setWidth( >> > 500); >> > BookmarkablePageLink pl = new BookmarkablePageLink(string, >> > class1); >> > pl.setPopupSettings(popupSettings); >> > >> > return pl; >> > } >> > >> > }package test.data; >> > >> > import org.hibernate.HibernateException; >> > import org.hibernate.Session; >> > import org.hibernate.SessionFactory ; >> > import org.hibernate.cfg.Configuration; >> > >> > public class HibernateConnectionMgr { >> > >> > public static final SessionFactory sessionFactory; >> > >> > static { >> > try { >> > // Create the SessionFactory from hibernate.cfg.xml >> > sessionFactory = new >> > Configuration().configure().buildSessionFactory(); >> > } catch (Throwable ex) { >> > // Make sure you log the exception, as it might be >> swallowed >> > System.err.println("Initial SessionFactory creation >> failed." >> > + ex); >> > throw new ExceptionInInitializerError(ex); >> > } >> > } >> > >> > public static final ThreadLocal session = new ThreadLocal(); >> > >> > public static Session currentSession() throws >> HibernateException { >> > Session s = (Session) session.get(); >> > >> > // Open a new Session, if this thread has none yet >> > if (s == null) { >> > s = sessionFactory.openSession(); >> > // Store it in the ThreadLocal variable >> > session.set(s); >> > } >> > >> > if (!s.isOpen()) { >> > s = sessionFactory.openSession(); >> > // Store it in the ThreadLocal variable >> > session.set(s); >> > } >> > >> > return s; >> > } >> > >> > public static void closeSession() throws >> HibernateException { >> > Session s = (Session) session.get(); >> > if (s != null) >> > s.close(); >> > session.set(null); >> > } >> > }<html xmlns:wicket="http://wicket.sourceforge.net/ >> > <http://wicket.sourceforge.net/ >"> >> > <head> >> > <title></title> >> > </head> >> > <body> >> > </body> >> > </html> >> > package test; >> > >> > import org.apache.log4j.Logger; >> > >> > import test.auth.UserSession; >> > import test.base.BasePage; >> > >> > >> > public class Main extends BasePage { >> > >> > UserSession ses = getWebSession(); >> > >> > static Logger logger = Logger.getLogger(Main.class); >> > >> > public Main() { >> > rebuild(); >> > } >> > >> > private void rebuild() { >> > } >> > >> > public UserSession getUserSession() { >> > return (UserSession) getSession(); >> > >> > } >> > >> > } >> > package test.base; >> > >> > import java.io.Serializable ; >> > >> > import org.apache.commons.logging.Log; >> > import org.apache.commons.logging.LogFactory; >> > import org.hibernate.SessionFactory; >> > import org.hibernate.cfg.Configuration; >> > >> > import test.Main; >> > import test.auth.SignIn ; >> > import test.auth.UserSession; >> > import wicket.IRequestCycleFactory; >> > import wicket.ISessionFactory; >> > import wicket.Request; >> > import wicket.RequestCycle; >> > import wicket.Response; >> > import wicket.Session; >> > import >> > >> wicket.authorization.strategies.page.SimplePageAuthorizationStrategy ; >> > import wicket.protocol.http.WebApplication; >> > import wicket.protocol.http.WebRequest; >> > import wicket.protocol.http.WebSession; >> > >> > public final class MyApplication extends WebApplication >> implements >> > ISessionFactory, Serializable { >> > >> > /** Logger. */ >> > private static Log log = >> LogFactory.getLog(MyApplication.class); >> > >> > private final SessionFactory sessionFactory; >> > >> > public void init() { >> > SimplePageAuthorizationStrategy authorizationStrategy = >> new >> > SimplePageAuthorizationStrategy( >> > BasePage.class, SignIn.class) { >> > protected boolean isAuthorized() { >> > return (((UserSession) Session.get ()).isSignedIn()); >> > } >> > }; >> > >> > >> getSecuritySettings().setAuthorizationStrategy(authorizationStrategy); >> > getAjaxSettings().setAjaxDebugModeEnabled(false); >> > } >> > >> > /** >> > * custom request cycle factory. >> > */ >> > private IRequestCycleFactory requestCycleFactory = new >> > IRequestCycleFactory() { >> > public RequestCycle newRequestCycle(Session session, >> Request >> > request, >> > Response response) { >> > return new test.base.RequestCycle((WebSession) session, >> > (WebRequest) request, response, sessionFactory); >> > } >> > }; >> > >> > /** >> > * Constructor >> > */ >> > public MyApplication() { >> > super(); >> > try { >> > final Configuration configuration = new Configuration(); >> > configuration.configure(); >> > sessionFactory = configuration.buildSessionFactory(); >> > } catch (Exception e) { >> > throw new RuntimeException(e); >> > } >> > >> > // setSessionFactory(this); >> > } >> > >> > /** >> > * @see wicket.ISessionFactory#newSession() >> > */ >> > public Session newSession() { >> > return new UserSession( MyApplication.this) { >> > protected IRequestCycleFactory >> getRequestCycleFactory() { >> > return requestCycleFactory; >> > } >> > }; >> > } >> > >> > public Class getHomePage() { >> > return Main.class; >> > } >> > }package test.base; >> > >> > import org.hibernate.HibernateException; >> > import org.hibernate.Session ; >> > import org.hibernate.SessionFactory ; >> > >> > import wicket.Response; >> > import wicket.protocol.http.WebRequest; >> > import wicket.protocol.http.WebRequestCycle; >> > import wicket.protocol.http.WebSession; >> > >> > public class RequestCycle extends WebRequestCycle { >> > private final SessionFactory sessionFactory; >> > private Session session = null; >> > >> > public RequestCycle(WebSession session, WebRequest request, >> > Response response, SessionFactory sessionFactory) { >> > super(session, request, response); >> > this.sessionFactory = sessionFactory; >> > } >> > >> > protected void onEndRequest() { >> > if (session != null) { >> > try { >> > session.close(); >> > } catch (HibernateException e) { >> > throw new RuntimeException(e); >> > } finally { >> > session = null; >> > } >> > } >> > } >> > >> > public Session getHibernateSession() { >> > if (session == null) { >> > try { >> > session = sessionFactory.openSession(); >> > } catch (HibernateException e) { >> > throw new RuntimeException(e); >> > } >> > } >> > return session; >> > } >> > }<html> >> > <head> >> > <title>Sign In</title> >> > <link href="tables.css" rel="stylesheet" >> type="text/css" /> >> > </head> >> > <body> >> > <span wicket:id="toppanel">panel here</span> >> > <fieldset> >> > <span wicket:id="signInPanel"/> >> > </fieldset> >> > </body> >> > </html> >> > /* >> > * $Id: SignIn.java,v 1.1 2006/04/30 21:26:43 Exp $ >> $Revision: 1.1 $ >> > * $Date: 2006/04/30 21:26:43 $ >> > * >> > * >> > >> ============================================================================== >> >> >> >> > * Licensed under the Apache License, Version 2.0 (the >> "License"); >> > you may not >> > * use this file except in compliance with the License. You may >> > obtain a copy of >> > * the License at >> > * >> > * http://www.apache.org/licenses/LICENSE-2.0 >> > * >> > * Unless required by applicable law or agreed to in writing, >> software >> > * distributed under the License is distributed on an "AS IS" >> > BASIS, WITHOUT >> > * WARRANTIES OR CONDITIONS OF ANY KIND, either express or >> implied. >> > See the >> > * License for the specific language governing permissions and >> > limitations under >> > * the License. >> > */ >> > package test.auth; >> > >> > import wicket.PageParameters; >> > import wicket.markup.html.WebPage; >> > >> > /** >> > * Simple example of a sign in page. It extends SignInPage, a >> base >> > class which >> > * provide standard functionality for typical log-in pages >> > * >> > * @author Jonathan Locke >> > */ >> > public final class SignIn extends WebPage { >> > /** >> > * Construct >> > */ >> > public SignIn() { >> > this(null); >> > } >> > >> > /** >> > * Constructor >> > * >> > * @param parameters >> > * The page parameters >> > */ >> > public SignIn(final PageParameters parameters) { >> > // add(new feeple.base.ApplicationHeader("mainNavigation", >> > "Sign In!")); >> > >> > add(new SignInPanel("signInPanel") { >> > public boolean signIn(String username, String >> password) { >> > return ((UserSession) >> getSession()).authenticate(username, >> > password); >> > } >> > }); >> > } >> > >> > } >> > <html xmlns:wicket> >> > <body> >> > <wicket:panel> >> > <span wicket:id="feedback" /> >> > <form wicket:id="signInForm"> >> > <table> >> > >> > <tr><td> </td> >> > <td><b>Use your network login and >> > password</b></td> >> > </tr> >> > <tr> >> > <td align="right">Username:</td> >> > <td><input wicket:id="username" >> > type="text" value="" size="30" /></td> >> > </tr> >> > <tr> >> > <td align="right">Password:</td> >> > <td><input wicket:id="password" >> > type="password" value="password" >> > size="30" /></td> >> > </tr> >> > <tr wicket:id="rememberMeRow"> >> > <td></td> >> > <td><input wicket:id="rememberMe" >> > type="checkbox" /> Remember Me</td> >> > </tr> >> > <tr> >> > <td></td> >> > <td><input type="submit" name="submit" >> > value="Sign In" /> <input >> > type="reset" value="Reset" >> /></td> >> > </tr> >> > </table> >> > </form> >> > </wicket:panel> >> > </body> >> > </html> >> > /* >> > * $Id: SignInPanel.java,v 1.2 2006/05/13 13:19:10 Exp $ >> > * $Revision: 1.2 $ $Date: 2006/05/13 13:19:10 $ >> > * >> > * >> > >> ============================================================================== >> >> >> > >> > * Licensed under the Apache License, Version 2.0 (the >> "License"); >> > you may not >> > * use this file except in compliance with the License. You may >> > obtain a copy of >> > * the License at >> > * >> > * http://www.apache.org/licenses/LICENSE-2.0 >> > * >> > * Unless required by applicable law or agreed to in writing, >> software >> > * distributed under the License is distributed on an "AS IS" >> > BASIS, WITHOUT >> > * WARRANTIES OR CONDITIONS OF ANY KIND, either express or >> implied. >> > See the >> > * License for the specific language governing permissions and >> > limitations under >> > * the License. >> > */ >> > package test.auth; >> > >> > import wicket.Application; >> > import wicket.markup.html.WebMarkupContainer; >> > import wicket.markup.html.form.CheckBox ; >> > import wicket.markup.html.form.Form; >> > import wicket.markup.html.form.PasswordTextField; >> > import wicket.markup.html.form.TextField; >> > import wicket.markup.html.panel.FeedbackPanel ; >> > import wicket.markup.html.panel.Panel; >> > import wicket.model.PropertyModel; >> > import wicket.util.value.ValueMap; >> > >> > /** >> > * Reusable user sign in panel with username and password as >> well >> > as support for >> > * cookie persistence of the both. When the SignInPanel's >> form is >> > submitted, the >> > * abstract method signIn(String, String) is called, passing >> the >> > username and >> > * password submitted. The signIn() method should sign the >> user in >> > and return >> > * null if no error ocurred, or a descriptive String in the >> event >> > that the sign >> > * in fails. >> > * >> > * @author Jonathan Locke >> > * @author Juergen Donnerstag >> > * @author Eelco Hillenius >> > */ >> > public abstract class SignInPanel extends Panel { >> > /** True if the panel should display a remember-me >> checkbox */ >> > private boolean includeRememberMe = true; >> > >> > /** Field for password. */ >> > private PasswordTextField password; >> > >> > /** True if the user should be remembered via form >> persistence >> > (cookies) */ >> > private boolean rememberMe = true; >> > >> > /** Field for user name. */ >> > private TextField username; >> > >> > /** >> > * Sign in form. >> > */ >> > public final class SignInForm extends Form { >> > /** El-cheapo model for form. */ >> > private final ValueMap properties = new ValueMap(); >> > >> > /** >> > * Constructor. >> > * >> > * @param id >> > * id of the form component >> > */ >> > public SignInForm(final String id) { >> > super(id); >> > >> > // Attach textfield components that edit properties map >> > // in lieu of a formal beans model >> > add(username = new TextField("username", new >> > PropertyModel(properties, >> > "username"))); >> > add(password = new PasswordTextField("password", new >> > PropertyModel( >> > properties, "password"))); >> > >> > // MarkupContainer row for remember me checkbox >> > WebMarkupContainer rememberMeRow = new >> > WebMarkupContainer("rememberMeRow"); >> > add(rememberMeRow); >> > >> > // Add rememberMe checkbox >> > rememberMeRow.add(new CheckBox("rememberMe", new >> PropertyModel( >> > SignInPanel.this, "rememberMe"))); >> > >> > // Make form values persistent >> > setPersistent(rememberMe); >> > >> > // Show remember me checkbox? >> > rememberMeRow.setVisible(includeRememberMe); >> > } >> > >> > /** >> > * @see wicket.markup.html.form.Form#onSubmit() >> > */ >> > public final void onSubmit() { >> > if (signIn(getUsername(), getPassword())) { >> > // If login has been called because the user was not >> yet >> > // logged in, than continue to the original >> destination, >> > // otherwise to the Home page >> > if (getPage().continueToOriginalDestination()) { >> > // HTTP redirect response has been committed. No >> more data >> > // shall be written to the response. >> > setResponsePage(Application.get().getHomePage()); >> > } else { >> > setResponsePage(Application.get().getHomePage()); >> > } >> > } else { >> > // Try the component based localizer first. If not >> found >> > try the >> > // application localizer. Else use the default >> > final String errmsg = >> > getLocalizer().getString("loginError", this, >> > "Unable to sign you in"); >> > >> > error(errmsg); >> > } >> > } >> > } >> > >> > /** >> > * @see wicket.Component#Component(String) >> > */ >> > public SignInPanel(final String id) { >> > this(id, true); >> > } >> > >> > /** >> > * @param id >> > * See Component constructor >> > * @param includeRememberMe >> > * True if form should include a remember-me >> checkbox >> > * @see wicket.Component#Component(String) >> > */ >> > public SignInPanel(final String id, final boolean >> > includeRememberMe) { >> > super(id); >> > >> > this.includeRememberMe = includeRememberMe; >> > >> > // Create feedback panel and add to page >> > final FeedbackPanel feedback = new >> FeedbackPanel("feedback"); >> > add(feedback); >> > >> > // Add sign-in form to page, passing feedback panel as >> > // validation error handler >> > add(new SignInForm("signInForm")); >> > } >> > >> > /** >> > * Removes persisted form data for the signin panel >> (forget me) >> > */ >> > public final void forgetMe() { >> > // Remove persisted user data. Search for child component >> > // of type SignInForm and remove its related persistence >> values. >> > getPage().removePersistedFormData( >> > SignInPanel.SignInForm.class, true); >> > } >> > >> > /** >> > * Convenience method to access the password. >> > * >> > * @return The password >> > */ >> > public String getPassword() { >> > return password.getModelObjectAsString (); >> > } >> > >> > /** >> > * Get model object of the rememberMe checkbox >> > * >> > * @return True if user should be remembered in the future >> > */ >> > public boolean getRememberMe() { >> > return rememberMe; >> > } >> > >> > /** >> > * Convenience method to access the username. >> > * >> > * @return The user name >> > */ >> > public String getUsername() { >> > return username.getModelObjectAsString (); >> > } >> > >> > /** >> > * Convenience method set persistence for username and >> password. >> > * >> > * @param enable >> > * Whether the fields should be persistent >> > */ >> > public void setPersistent(boolean enable) { >> > username.setPersistent(enable); >> > password.setPersistent(enable); >> > } >> > >> > /** >> > * Set model object for rememberMe checkbox >> > * >> > * @param rememberMe >> > */ >> > public void setRememberMe(boolean rememberMe) { >> > this.rememberMe = rememberMe; >> > this.setPersistent(rememberMe); >> > } >> > >> > /** >> > * Sign in user if possible. >> > * >> > * @param username >> > * The username >> > * @param password >> > * The password >> > * @return True if signin was successful >> > */ >> > public abstract boolean signIn(final String username, final >> > String password); >> > } >> > <?xml version=" 1.0"?> >> > <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate >> Mapping >> > DTD 3.0//EN" >> > "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd >> <http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd>"> >> > <!-- Generated Jun 21, 2006 8:00:34 PM by Hibernate Tools >> > 3.1.0.beta4 --> >> > <hibernate-mapping> >> > <class name="test.data.UserCredentials" >> table="user_credentials"> >> > <id name="recId" type="int"> >> > <column name="rec_id" /> >> > <generator class="native" /> >> > </id> >> > <property name="userNm" type="string"> >> > <column name="user_nm" length="50" /> >> > </property> >> > <property name="lastUser" type="string"> >> > <column name="last_user" length="40" /> >> > </property> >> > <property name="lastUpdate" type="timestamp"> >> > <column name="last_update" length="23" /> >> > </property> >> > <property name="credentials" type=" >> java.lang.Integer"> >> > <column name="credentials" /> >> > </property> >> > </class> >> > </hibernate-mapping> >> > package test.data; >> > // Generated Jun 21, 2006 8:00:35 PM by Hibernate Tools >> 3.1.0.beta4 >> > >> > import java.util.Arrays; >> > import java.util.Date; >> > import java.util.List; >> > >> > >> > /** >> > * UserCredentials generated by hbm2java >> > */ >> > >> > public class UserCredentials implements >> java.io.Serializable { >> > >> > >> > // Fields >> > >> > private int recId; >> > private String userNm; >> > private String lastUser; >> > private Date lastUpdate; >> > private Integer credentials; >> > >> > public static List availableRoles = Arrays.asList(new >> > String[] { "Administrator", "Manager", "User" }); >> > >> > // Constructors >> > >> > /** default constructor */ >> > >> > >> > >> > >> > public UserCredentials() { >> > } >> > >> > /** minimal constructor */ >> > public UserCredentials(int recId) { >> > this.recId = recId; >> > } >> > >> > /** full constructor */ >> > public UserCredentials(int recId, String userNm, String >> > lastUser, Date lastUpdate, Integer credentials) { >> > this.recId = recId; >> > this.userNm = userNm; >> > this.lastUser = lastUser; >> > this.lastUpdate = lastUpdate; >> > this.credentials = credentials; >> > } >> > >> > >> > /* public int hashCode() { >> > return recId; >> > } >> > >> > public boolean equals(Object obj) { >> > if (obj instanceof UserCredentials) { >> > UserCredentials o = (UserCredentials) obj; >> > if (recId == recId) { >> > return true; >> > } >> > } >> > return false; >> > } >> > */ >> > >> > >> > // Property accessors >> > >> > public int getRecId() { >> > return this.recId; >> > } >> > >> > public void setRecId(int recId) { >> > this.recId = recId; >> > >> > } >> > >> > public String getUserNm() { >> > return this.userNm; >> > } >> > >> > public void setUserNm(String userNm) { >> > this.userNm = userNm; >> > >> > } >> > >> > public String getLastUser() { >> > return this.lastUser; >> > } >> > >> > public void setLastUser(String lastUser) { >> > this.lastUser = lastUser; >> > >> > } >> > >> > public Date getLastUpdate() { >> > return this.lastUpdate; >> > } >> > >> > public void setLastUpdate(Date lastUpdate) { >> > this.lastUpdate = lastUpdate; >> > } >> > >> > public Integer getCredentials() { >> > return this.credentials; >> > } >> > >> > public void setCredentials(Integer credentials) { >> > this.credentials = credentials; >> > >> > } >> > >> > >> > public String getRole(){ >> > try{ >> > int i = credentials.intValue(); >> > if(i == 0) >> > return "Administrator"; >> > else if(i == 1) >> > return "Manager"; >> > else >> > return "User"; >> > } >> > catch(java.lang.NullPointerException e){ >> > return "User"; >> > } >> > >> > } >> > >> > public void setRole(String s){ >> > if(s == null) >> > this.setCredentials(new Integer(2)); >> > else if(s.equals("Administrator")) >> > this.setCredentials(new Integer(0)); >> > else if(s.equals ("Manager")) >> > this.setCredentials(new Integer(1)); >> > else >> > this.setCredentials(new Integer(2)); >> > this.lastUpdate = new Date(); >> > >> > } >> > >> > >> > >> > >> > >> > >> > } >> > package test.auth; >> > >> > import java.util.Iterator; >> > import java.util.List ; >> > >> > import org.hibernate.Query; >> > import org.hibernate.Session; >> > import org.hibernate.Transaction; >> > >> > import test.data.HibernateConnectionMgr ; >> > import test.data.UserCredentials ; >> > import wicket.protocol.http.WebApplication; >> > import wicket.protocol.http.WebSession; >> > >> > public class UserSession extends WebSession { >> > private String user; >> > >> > public Session getDbSession() { >> > return HibernateConnectionMgr.currentSession(); >> > } >> > >> > public final boolean authenticate(final String username, >> final >> > String password) { >> > setUserCredentials(username); >> > return authenticateAlways(username, password); >> > } >> > >> > private boolean authenticateAlways(final String username, >> > final String password) { >> > >> > user = username; >> > if ("".equals(user)) { >> > user = null; >> > } >> > return true; >> > } >> > >> > public boolean isSignedIn() { >> > return user != null; >> > } >> > >> > public String getUser() { >> > return user; >> > } >> > >> > public void setUser(final String user) { >> > this.user = user; >> > } >> > >> > private void setUserCredentials(String username) { >> > Session session = HibernateConnectionMgr.currentSession(); >> > Transaction tx = session.beginTransaction (); >> > Query query = session >> > .createQuery(" from UserCredentials u where u.userNm = >> > :user"); >> > query.setString("user", username); >> > query.setMaxResults(1); >> > List l = query.list(); >> > for (Iterator itr = l.iterator(); itr.hasNext();) { >> > UserCredentials u = (UserCredentials) itr.next(); >> > } >> > tx.commit(); >> > } >> > >> > public UserSession(WebApplication arg0) { >> > super(arg0); >> > } >> > } >> > <?xml version="1.0" encoding="utf-8"?> >> > <!DOCTYPE hibernate-configuration PUBLIC >> > "-//Hibernate/Hibernate Configuration DTD 3.0//EN" >> > " >> http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> >> > <hibernate-configuration> >> > <session-factory> >> > <property >> > name=" hibernate.cglib.use_reflection_optimizer"> >> > false</property> >> > <property name=" >> hibernate.connection.driver_class"> >> > >> com.microsoft.sqlserver.jdbc.SQLServerDriver</property> >> > <property >> > name="hibernate.connection.username">dba</property> >> > <property name=" hibernate.dialect"> >> > >> org.hibernate.dialect.SQLServerDialect</property> >> > <property name="hibernate.connection.password >> > ">lqs</property> >> > <property name="hibernate.connection.url"> >> > >> jdbc:sqlserver://localhost;DatabaseName=deathcare;SelectMethod=cursor</property> >> >> >> > >> > <property >> name="hibernate.show_sql">false</property> >> > >> > <mapping >> > resource="test/data/UserCredentials.hbm.xml"/> >> > </session-factory> >> > </hibernate-configuration> >> > # Set root logger level to DEBUG and its only appender to A1. >> > log4j.rootLogger=DEBUG, A1 >> > >> > # A1 is set to be a ConsoleAppender. >> > #log4j.appender.A1=org.apache.log4j.ConsoleAppender >> > log4j.appender.A1=org.apache.log4j.FileAppender >> > >> > # A1 uses PatternLayout. >> > log4j.appender.A1.layout=org.apache.log4j.PatternLayout >> > log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c >> %x - %m%n >> > log4j.appender.A1.file=C:/log4j_out.log >> > log4j.appender.A1.append=false >> > >> > log4j.logger.org.apache.commons.digester=DEBUG >> > >> > >> > >> ------------------------------------------------------------------------- >> >> > Using Tomcat but need to do more? Need to support web >> services, >> > security? >> > Get stuff done quickly with pre-integrated technology to >> make your >> > job easier >> > Download IBM WebSphere Application Server v.1.0.1 based on >> Apache >> > Geronimo >> > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> >> >> > >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>> >> >> > >> > _______________________________________________ >> > Wicket-user mailing list >> > [email protected] >> <mailto:[email protected]> >> > <mailto: [email protected] >> <mailto:[email protected]>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user >> <https://lists.sourceforge.net/lists/listinfo/wicket-user> >> > >> > >> > >> >> > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > Wicket-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-user >
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
