Publish Static Content to WebLogic

This post has been updated to provide a more flexible approach to deploying static content 16.07.2012.

Most people know WebLogic has a built in web server. Typically this is not an issue as you deploy java applications and WebLogic publishes to the web. But what if you just want to display a simple static HTML page. In WebLogic you can develop a simple web application to display static HTML content.

In this example I used WLS 10.3.3. I want to display 2 files, an HTML file, and an xsd for reference.

  1. Create a directory of your choice, this is what I will call the document root.

    mkdir /home/oracle/html
  2. Download the war file here. This file creates a simple web app to expose the files.
  3. In the war file you will see a directory WEB-INF, inside there you will see 2 files, web.xml, and weblogic.xml. There is no need to edit these files but if you want to change the context or the directory edit the weblogic.xml file to match your environment.

    <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-web-jar.dtd">

    <weblogic-web-app>

      <container-descriptor>
        <index-directory-enabled>true</index-directory-enabled>
      </container-descriptor>

      <virtual-directory-mapping>
        <local-path>/home/oracle/html</local-path>
        <url-pattern>*</url-pattern>
      </virtual-directory-mapping>

      <context-root>/html</context-root>

    </weblogic-web-app>

  4. Login to the WebLogic console to deploy application
  5. Click on Deployments
  6. Click on Lock & Edit
  7. Click Install and upload the war file downloaded in step 2

    image
  8. Leave default "Install this deployment as an application" and click Next

    image
  9. Select a Managed Server to deploy to and click Next

    image
  10. Accept the defaults and click Finish
  11. Deployment completes successfully, now click the Activate Changes

    image
  12. You should now see the application started in the deployments

    image
  13. You can now access your static content via the following URL

    http://localhost:7001/html/helloworld.html

    image
Comments:

good day..

would like to check if i have the static html files replaced daily, will it auto refresh by itself?

at the moment following the steps above, i have to go to deployments and run UPDATE in order for the pages to refresh.

Thanks.
Regards,
Liang

Posted by low on March 29, 2011 at 03:22 PM GMT+13:00 #

A very good blog. Very useful in time. Great job done by you.

Posted by Bala on April 20, 2011 at 01:48 AM GMT+13:00 #

This works for statis html file but when tried viewing/downloading doc, docx. csv,xls, etc. it show junk characters. How can I fix this?

Posted by guest on July 11, 2012 at 08:05 AM GMT+13:00 #

This maybe a browser thing, are you able to access doc etc from other sites.

Also I have made an update to this posting which is a little more flexible. I have tested this method with firefox and doc, xls, etc work.

cheers
James

Posted by James Taylor on July 16, 2012 at 02:22 AM GMT+13:00 #

FYI -- this doesnt work for WebLogic 10.3.6 running on Linux. Not sure why. Works fine on Windows.

Posted by guest on September 07, 2012 at 06:53 AM GMT+13:00 #

It maybe something in your configuration I have tested on 10.3.6 on Linux and it works.

Make sure that the paths are correct, you have read/write access to the files and directories.

cheers
James

Posted by James Taylor on September 07, 2012 at 10:03 AM GMT+13:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.

Twitter:@james8001

tumblr hit counter vistors, thanks for your support

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today