Simple Web SiteSimple Web Site
Home > Books > Tutorials and Training Guides > Web > Simple Web Site

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Simple Web Site Tutorial

This tutorial will describe how to build a simple web site that runs on a detected TCP/IP port.

Step 1

Create a new module using the steps described in the Manual Module Creation tutorial using the following for the contents of module.xml:

<module>
  <identity>
    <uri>urn:com:mycompany:websites:simple</uri>
    <version>0.1.0</version>
  </identity>
  <info>
    <name>Simple Web Site</name>
    <description>My company's simple web site</description>
    <type>application</type>
    <dynamic />
  </info>
  <export>
    <uri>
      <match>ffcpl:/.*</match>
    </uri>
  </export>
  <rewrite>
    <rule>
      <match>ffcpl:/.*</match>
      <to>ffcpl:/resources/$1</to>
    </rule>
  </rewrite>
  <mapping>
    <this>
      <match>ffcpl:/resources/.*</match>
    </this>
  </mapping>
</module>

Step 2

Create a new fulcrum module that will listen on an used TCP/IP port.

Copy of the directory [install]/modules/mod-fulcrum-frontend to the directory [install]/modules/mod-fulcrum-simplewebsite.

Edit the file [install]/modules/mod-fulcrum-simplewebsite/etc/TransportJettyConfig.xml and change the port number in the following section from 8080 to 8081 or any other valid, non-privileged available TCP/IP port on your computer.

<Call name="addListener">
  <Arg>
    <New class="org.mortbay.http.SocketListener">
      <Set name="Port">8080</Set>
      <Set name="MinThreads">5</Set>
      <Set name="MaxThreads">50</Set>
      <Set name="MaxIdleTimeMs">30000</Set>
      <Set name="LowResourcePersistTimeMs">5000</Set>
    </New>
  </Arg>
</Call>

Register the new fulcrum module with NetKernel by adding the following line:

<module>modules/mod-fulcrum-simplewebsite/</module>

to the file

[install]/etc/deployedModules.xml

Step 3

Import the simple web site module into the new fulcrum.

Add the following import to the new fulcrum's module.xml file:

<import>
  <uri>urn:com:mycompany:websites:simple</uri>
</import>

Initiate a cold restart to allow NetKernel to detect the new modules and start the new transport.

Step 4

Add contents to the simple web site module.

The simple web site maps all incoming requests to its internal subdirectory resources/. Simply create resources in this subdirectory to support the web site such as resources/index.html.

Step 5

Use a browser to access the resources in the simple web site module.

If you have added the file resources/index.html, request that resource from a browser using the address http://localhost:8081/index.html, or any other corresponding address.

© 2003-2007, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.