Differences between revisions 1 and 2
Revision 1 as of 2007-06-05 19:57:32
Size: 1152
Comment:
Revision 2 as of 2009-09-20 23:20:02
Size: 1154
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
''Small word of caution:'' For convenience we're using the internal class [http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/internal/services/LinkImpl.html LinkImpl]. Although it's unlikely to change much, you may prefer to write your own implementation of the Link interface. ''Small word of caution:'' For convenience we're using the internal class [[http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/internal/services/LinkImpl.html|LinkImpl]]. Although it's unlikely to change much, you may prefer to write your own implementation of the Link interface.

When integrating Acegi security, you need to redirect login and logouts to Acegi's special URIs. You can do this from Tapestry by returning a Link object constructed using the encoder from the response, the context path from the request and the appropriate URI and parameters.

Example

import org.apache.tapestry.internal.services.LinkImpl;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.Response;

public class Login {
    @Inject
    private Request request;
    
    @Inject
    private Response response;

    Link onSuccessFromLoginForm() {
        Link link= new LinkImpl(response, request.getContextPath(), "j_acegi_security_check");
        link.addParameter("j_username", username);
        link.addParameter("j_password", password);
        return link;
    }

Small word of caution: For convenience we're using the internal class LinkImpl. Although it's unlikely to change much, you may prefer to write your own implementation of the Link interface.

Tapestry5LinkingToNonTapestryURIs (last edited 2009-09-20 23:20:02 by localhost)