4 Replies Latest reply on Jul 9, 2008 11:57 AM by Adrien Orsier

    Seam Newbie - Please help !!

    Arshad Mahmood Newbie

      I am starting a new project and have decided to JBoss and Seam rather than plain Tomcat, but I am having a problem trying to build my first application. Can somebody please answer the following questions or point me to any relevant docs (I've read the Seam manuals but still can't quite figure out how things work).


      I am not clear how seam processes url's. For instance in the registration example, index.html sends a redirect to register.seam. But what method does it call on register EJB because there is no form GET/POST which defines a command link? Somehow, it seems to display register.xhtml but I am not sure how it decides to do that.


      The reason I want to understand the underlying mechanism is because I tend to hide the application server by making all url's plain .html (i.e. customer.html, supplier.html) and then map these to appropiate EJB's (i.e. I don't want the extension .seam) but I don't know how to do that with Seam.


      Second, there is quite a lot of sensitive data being passes between the presentation tier and Seam (e.g. converstaion id's, command links, etc). Where would I start if I wanted to encrypt these and add an MD5 hash to ensure the users were not messing with this data.


      Many thanks for your help.

        • 1. Re: Seam Newbie - Please help !!
          Adrien Orsier Newbie

          1) Well, I see that in index.html in registration exemple:


          <head>
            <meta http-equiv="Refresh" content="0; URL=register.seam">
          </head>
          


          Co it seems quite clear to me, or I didn't understand your question.


          2) You can do that simply with a rewrite rule.
          Here's some doc about it:
          http://tuckey.org/urlrewrite/manual/3.0/
          Simply put a rule like


           <!-- seam extension removal / -->
               <outbound-rule>
                    <name>.seam removal out</name>
                    <from>/([/a-zA-Z0-9]*)\.seam</from>
                    <to>/$1</to>
               </outbound-rule>



          • 2. Re: Seam Newbie - Please help !!
            Mikael Andersson Master
            About the URL (.seam) this is nothing specific, have a look in your web.xml and the Faces servlet and its servlet-mapping. You can easily change this to *.html.

            About the mapping to .xhtml, this is configured via a context-param in your web.xml.

                 <context-param>
                      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                      <param-value>.xhtml</param-value>
                 </context-param>

            Have a look at the Facelets documentation for more information regarding this, http://facelets.dev.java.net check the developer documentation.

            About the encryption, I've got no idea. How about using https (not sure how to configure this tough)?

            - Micke
            • 3. Re: Seam Newbie - Please help !!
              Arshad Mahmood Newbie
              >> 1) Well, I see that in index.html in registration exemple:
              >>
              >><head>
              >>  <meta http-equiv="Refresh" content="0; URL=register.seam">
              >></head>
              >>Co it seems quite clear to me, or I didn't understand your question.

              Yes, but how does it decide to go from a request like /register.seam to displaying the file register.xhtml. There is nothing in the RegisterAction EJB that tells it to do that. The EJB either adds a new user or displays that a user already exists.

              There is some default processing going on here which I don't understand. I have looked at the config files under WEB-INF, again nowhere can I see how it decides to do that. The only thing I can imaging is that somehow if no parameters are passed to register.seam it is the default behaviour that a page of the same name but with a .xhtml extenion is displayed. But I haven't seen this mentioned anywhere in the documentation.

              Regards.
              • 4. Re: Seam Newbie - Please help !!
                Adrien Orsier Newbie

                You're actually right about changing the extension, dunno why but I thought he wanted to remove it completely, not to change it.