Topic
7 replies Latest Post - ‏2013-06-13T13:34:51Z by gazzadc
3A6E_Tom_Russell
3A6E_Tom_Russell
9 Posts
ACCEPTED ANSWER

Pinned topic How do I get a home page for all applications in Liberty

‏2013-06-03T15:14:12Z |

I am migrating a single application from the HTTP server with a WAS 3.5 plugin to WAS 8.5 Liberty.  

How do I get a home page for the whole site?  The index.html page only gets shown if the user points at the specific application.  For example, if the user goes to http://<host address>/app_name  then the index.html page displays and all is well.  Unfortunately the users currently just go to http://<host address>  and they get the application home page or logon panel.  With liberty, leaving off the application name gets you to a "Welcome to Liberty" page with a number of IBM links on it.  

I want the users to go directly to the application if they don't specify it.  Where can I put an index.html page that will get loaded when the user just goes to the site, not the application at the site? 

Any suggestions would be appreciated.

regards, Tom     

  • Alasdair
    Alasdair
    55 Posts
    ACCEPTED ANSWER

    Re: How do I get a home page for all applications in Liberty

    ‏2013-06-03T15:21:17Z  in response to 3A6E_Tom_Russell

    Have you tried configuring the application with a context-root of "/"?

    Thanks
    Alasdair

    • 3A6E_Tom_Russell
      3A6E_Tom_Russell
      9 Posts
      ACCEPTED ANSWER

      Re: How do I get a home page for all applications in Liberty

      ‏2013-06-03T15:32:07Z  in response to Alasdair

      No.  I haven't. 

      How would this be done?  I am using Eclipse. The servlet has a package name.  The old WAS used /servlet/packagename.servletname to call the servlet. In current eclipse I used the same package and servlet name as before but use the url mapping so that new WAS sees /packagename/servletname 

      To use a context root of "/" do I have to remove the package statement from the front of each of the Java programs? Or just fiddle with the directory structure in eclipse? 

      Any comments, or pointers to doc would be appreciated. 

      regards, Tom     

      • Alasdair
        Alasdair
        55 Posts
        ACCEPTED ANSWER

        Re: How do I get a home page for all applications in Liberty

        ‏2013-06-04T19:06:00Z  in response to 3A6E_Tom_Russell

        There are a couple of ways to do this and part of it depends on whether you are using 8.5.0.x or the more recent beta. Assuming you are using 8.5.0.x then if you open the server configuration you should see an xml element like this (there will be more attributes than this):

        <application location="app_name.war" />

        if you update it to be like this:

         

        <application location="app_name.war" context-root="/" />

        then your application will be available at http://<host address>/

        If you are using the more recent beta I think you'll see this:

        <webApplication location="app_name.war" />

        at which point you want to use:

        <webApplication location="app_name.war" contextRoot="/" />

        I hope that is clear (tricky with all the forward slashes everywhere).

        Alasdair

        • 3A6E_Tom_Russell
          3A6E_Tom_Russell
          9 Posts
          ACCEPTED ANSWER

          Re: How do I get a home page for all applications in Liberty

          ‏2013-06-05T18:38:43Z  in response to Alasdair

          Thank you.  Thank you.

          My appliciation must use a expanded war file, as this was the only way I could get the existing servlet code to work.  Applications in the dropins directory must have the conetct root equal to the war file name.  And it is not clear from the documentation whether or not you can put an expanded war in the apps directory.  In any case changing the context root of this application would require several modifications to the servlet code.   

          So, I created a web application called homepage in eclipse.  I had to define it as a Java application so that eclipse would allow me to export a war file.  The application has only a single html page (index.html) that uses a <meta> tag to redirect to my application.  If we ever come up with a second applicaiotn, I will change the homepage to offer a menu rather than just redirect. 

          I put the war file in /apps and  put an application entry in server.xml that said:

          <application id="home" name="homepage" location="homepage.war"
          type="war" context-root="/" />
          

          This has now all been successfully tested and works fine.

          Thanks a lot for your help, and your patience with a WAS newbie.

          regards, Tom

           

           

           

           

            

              

           

          • Alasdair
            Alasdair
            55 Posts
            ACCEPTED ANSWER

            Re: How do I get a home page for all applications in Liberty

            ‏2013-06-05T19:04:11Z  in response to 3A6E_Tom_Russell

            Hi,

            I'm sorry you found our documentation unclear regarding expanded vs zipped wars. You can absolutely deploy an exploded war in the apps dir and configure it using the <application> element. The dropins support is simply syntactic sugar around the runtime support for the <application> element. Essentially when we see something in the dropins dir we act as if there was an <application> element. 

            I'm glad you got it working.
            Alasdair

            • 3A6E_Tom_Russell
              3A6E_Tom_Russell
              9 Posts
              ACCEPTED ANSWER

              Re: How do I get a home page for all applications in Liberty

              ‏2013-06-05T19:58:08Z  in response to Alasdair

              Well thank you again. 

              The original application is old.  It was written with a Java servlet running in the WAS 3.5 plug-in to the HTTP server.  It is on z/OS 1.8 which is no longer supported.  So.  I was tasked with upgrading it to supported z/OS and WAS levels, even though I have no WAS experience. The servlet writes files into the context root and then invokes the pages by generating a "frameset page" that is delivered to the browser with a write to stdout. 

              This voyage of discovery though WAS liberty has been intersting. If I had known when I started that I could deploy the servlet with a context root of "/ ", I would have spent much less time modifying the servlet code to add the context root to the generated html that needed it.

              My guide thorough this was the "Liberty Quickstart" white paper on Techdocs.  It of course shows only one easy way to deploy applications.  I also got a lot of help from our local Websphere support guy, but WSC support pointed me here, and I'm glad of the help I got.  

              I've learned a lot on this voyage, and I think we have a  reasonable solution.  

              Thanks again for the help. 

              • gazzadc
                gazzadc
                1 Post
                ACCEPTED ANSWER

                Re: How do I get a home page for all applications in Liberty

                ‏2013-06-13T13:34:51Z  in response to 3A6E_Tom_Russell

                Hi Tom

                We have updated the information center to state that you can deploy an expanded WAR file to the apps directory.

                This will go live next time we refresh the public information center in July.

                Thank you for your input.

                Regards

                Gary