4 Replies Latest reply on Sep 1, 2007 8:24 AM by chris1

    Themes question

    phantom

      Good day,

      How can I realise such functionality:

      I have 2 themes on my site:
      1) Default - with images, CSS etc.
      2) Printable - plain text - suitable for printing

      I want: for human show Default theme, but for crawles (Google, Yahoo etc.) show by default Printable version. How can I do that? May be some filter?

        • 1. Re: Themes question
          chris1

          Basically I have a similar requirement. Not on request.agent but on request.servername.

          How can I automagically make the shown skin dependent on facesContext.externalContext.request.serverName without any user interaction?

          I'm currently developing a multi-user, multi-domain site with seam - seam is unbelievable. Thanks guys for this great piece of software!

          - Chris

          • 2. Re: Themes question
            chris1

            nobody out here who has an idea?

            - Christian

            • 3. Re: Themes question
              wise_guybg

              I guess you could install a custom filter using @Filter:
              http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/configuration.html#d0e12795

              Detect the spider. (Chris has given some clues on how to do that)

              Change the theme accordingly, using the themeSelector component. Example:

              @In
              ThemeSelector themeSelector;
              ...
              themeSelector.selectTheme(...);


              HTH

              • 4. Re: Themes question
                chris1

                I installed a custom filter (@Filter(within = "org.jboss.seam.web.contextFilter")) and the filter is called as expected.

                I can also get and access the ThemeSelector via
                Context ctx = new SessionContext(new ServletRequestSessionMap(sreq));
                ThemeSelector ts = (ThemeSelector) ctx.get(ThemeSelector.class);

                Problem is that I get a NPE when setting a theme. selectTheme throws

                java.lang.NullPointerException
                 at org.jboss.seam.theme.ThemeSelector.select(ThemeSelector.java:87)
                


                The annotations in my custom filter class are:
                @Startup
                @Scope(ScopeType.APPLICATION)
                @Name("de.dvdb.generic.seam.ThemeFilter")
                @Intercept(InterceptionType.NEVER)
                @Filter(within = "org.jboss.seam.web.contextFilter")

                Is this ok?

                - Chris