please, Any idea about?
jimmy10 Nov 7, 2013 6:52 PMMy Class
package edu.unl.sbe.rewrite;
import javax.servlet.ServletContext;
import org.ocpsoft.common.services.NonEnriching;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.config.Direction;
import org.ocpsoft.rewrite.config.Invoke;
import org.ocpsoft.rewrite.el.El;
import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
import org.ocpsoft.rewrite.servlet.config.Path;
import org.ocpsoft.rewrite.servlet.config.Redirect;
import org.ocpsoft.rewrite.servlet.config.Response;
import org.ocpsoft.rewrite.servlet.config.rule.Join;
/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
* @adapter <a href="mailto:jimmy.anazco@gmail.com">Jimmy Alexander Añazco</a>
*/
public class AccessRewriteConfiguration extends HttpConfigurationProvider implements NonEnriching {
@Override
public Configuration getConfiguration(final ServletContext context) {
return ConfigurationBuilder.begin()
.addRule(Join.path("/").to("/pages/home.xhtml"))
.addRule(Join.path("/responsable").to("/pages/homeResponsable.xhtml"))
.addRule(Join.path("/auxiliar").to("/pages/homeAuxiliar.xhtml"))
.addRule(Join.path("/director").to("/pages/homeDirector.xhtml"))
.addRule(Join.path("/signup").to("/pages/signup.xhtml"))
.addRule(Join.path("/login").to("/pages/login.xhtml"))
// 404 and Error
.addRule(Join.path("/404").to("/pages/404.xhtml").perform(Response.setCode(404)))
.addRule(Join.path("/error").to("/pages/error.xhtml"))
// Authentication
// .defineRule()
// .when(Direction.isInbound().and(Path.matches("/logout")))
// .perform(Invoke.binding(El.retrievalMethod("authentication.logout"))
// .and(Redirect.temporary(context.getContextPath() + "/")))
// //Authentication
// .defineRule()
// .when(Direction.isInbound().and(Path.matches("/logout")))
// .perform(Invoke.binding(PhaseBinding.to(El.property("#{authentication.logout}")).after(PhaseId.RESTORE_VIEW))
// .and(Redirect.temporary(context.getContextPath() + "/")));
// // Create a dynamic logout URL via EL
.defineRule()
.when(Direction.isInbound().and(Path.matches("/logout")))
.perform(Invoke.binding(El.retrievalMethod("#{authentication.logout}"))
.and(Redirect.temporary(context.getContextPath() + "/")));
}
@Override
public int priority() {
return 10;
}
}