Paul Cantrell <[EMAIL PROTECTED]> wrote: Normally, Tapestry does handle this 
for you -- or rather, it passes  
the job along to the servlet container, which will usually append a  
";jsessionid=xxxx" to your requests.
That's what I expected.
However, if you're bypassing Tapestry to generate links directly --  
for example, by using a plain old  in your page, instead  
of one of the link components, or a  instead of a 
jwcid="@Form"> -- I doubt Tapestry will append the URL.
I am not bypassing Tapestry. I use XXXLink and form components and no 
;jsessionid=xxx is appended to the requests.

It would be helpful if you could send a snippet of the page template  
for the form or link where the session is being lost.


Some of the relevant code.

// An exemple of a link in the page
<a href="#" jwcid="@PageLink" page="pages/Home">Home</a>


// The page class
public abstract class HubPage extends BasePage {
....
    @InjectState("user")
    public abstract UserState getUserState();
    public abstract void setUserState(UserState state);

    @InjectStateFlag("user")
    public abstract boolean getUserStateExists();
...
}

// The login component class
public abstract class Login extends BaseComponent {
    
    @InjectObject("service:hub.DaoManager")
    public abstract DaoManager getDaoManager();
    public abstract String getUsername();
    public abstract String getPassword();

    ...
    public void login()
    {
        final User user = 
getDaoManager().getUserDao().findByName(getUsername());
        final Encrypter encrypter = Encrypter.getEncrypter();
        if(encrypter.isValidPassword(getPassword(), user)
        {
            ((HubPage) getUserState()).setUser(user);
        }
    }

...
}

// The login form
...
  <form jwcid="@Form" class="login" listener="listener:login">
    <table>
      <tr>
        <td><label jwcid="@FieldLabel" field="component:username"/></td>
          <td><input jwcid="[EMAIL PROTECTED]" value="ognl:username" 
displayName="votre pseudo" maxlength="15"/></td>
      </tr>
      <tr>
        <td><label jwcid="@FieldLabel" field="component:password"/></td>
          <td>
          <input jwcid="[EMAIL PROTECTED]" value="ognl:password" 
displayName="mot de passe" maxlength="15" hidden="true"/>
          <input type="submit" value="ok" class="ok"/>
        </td>
      </tr>
    </table>
    </form>
...

// Hivemind 
  <!-- state objects -->
  <contribution configuration-id="tapestry.state.ApplicationObjects">
    <state-object name="application" scope="application">
      <create-instance class="hub.web.ApplicationState"/>
    </state-object>
    <state-object name="user" scope="session">
      <create-instance class="hub.web.UserState"/>
    </state-object>
  </contribution>



                
---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

Reply via email to