1 Reply Latest reply on Jan 19, 2011 9:31 AM by Lincoln Baxter III

    Prettyfaces custom URL processor with Seam

    Tanya Ruttenberg Expert

      Has anyone gotten prettyface's custom URL processor to work with seam?


      From pretty-faces.xml





      <rewrite redirect="301" match="ONDList" processor="dne.nmt.ond.action.util.RemoveEmptyParams" />





      It works as advertised in a simple JSF project, but when I try to use it in my seam project I get a ClassCastException:




      java.lang.ClassCastException: dne.nmt.ond.action.util.RemoveEmptyParams cannot be cast to com.ocpsoft.pretty.faces.rewrite.Processor
      com.ocpsoft.pretty.faces.rewrite.processor.CustomClassProcessor.process(CustomClassProcessor.java:35)
      com.ocpsoft.pretty.faces.rewrite.RewriteEngine.processOutbound(RewriteEngine.java:83)
      com.ocpsoft.pretty.faces.servlet.PrettyFacesWrappedResponse.rewrite(PrettyFacesWrappedResponse.java:180)
      com.ocpsoft.pretty.faces.servlet.PrettyFacesWrappedResponse.encodeURL(PrettyFacesWrappedResponse.java:79)
      com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:375)
      org.jboss.seam.faces.FacesManager.redirect(FacesManager.java:220)
      org.jboss.seam.faces.FacesManager.redirect(FacesManager.java:185)



      etc. etc.


      text of class RemoveEmptyParams:




      import com.ocpsoft.pretty.faces.config.rewrite.RewriteRule;
      import com.ocpsoft.pretty.faces.rewrite.Processor;
      
      public class RemoveEmptyParams implements Processor
      {
         public String process(final RewriteRule rule, final String url)
         {
            String result = url.replaceAll("\\?[^=]+=&", "?");
            result = result.replaceAll("&[^=]+=&", "&");
            result = result.replaceAll("&[^=]+=$", "");
            return result;
         }
      }



      Has anyone gotten this to work in seam? Did you do anything special?  Anyone have any ideas?


      Tanya