Difference between revisions of "HTTP Server"

From PresenceWiki
Jump to: navigation, search
(Configuration)
(Configuration)
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
  
 
The Server can be configured by editing the file named "httpserver.config" which is located in the "res/config" directory. This allows you to set the port that the HTTP server listens on (default 81) in addition to setting up multiple servers identified by host name in the request and configuring the file upload permissions and directory.
 
The Server can be configured by editing the file named "httpserver.config" which is located in the "res/config" directory. This allows you to set the port that the HTTP server listens on (default 81) in addition to setting up multiple servers identified by host name in the request and configuring the file upload permissions and directory.
 +
 +
The default configuration looks like this:
 +
 +
<pre>
 +
<http-config port="80">
 +
<!-- This is the configuration file for Presence's in-built HTTP server. -->
 +
 +
<default-server>
 +
<!-- all domains not listed below will use this configuration -->
 +
<docs>./res/httpdocs/</docs> <!-- the directory that contains the http server documents -->
 +
<index-pages>
 +
<!-- specifies files that will be used as directory welcome pages -->
 +
index.html;index.xhtml;index.jsp;index.htm;
 +
default.html;default.xhtml;default.jsp;default.htm;
 +
</index-pages>
 +
<allow-directory-browsing>true</allow-directory-browsing> <!-- if true directory listing is allowed -->
 +
<upload-targets>
 +
<!-- specifies a list of upload targets - requested paths that files can be uploaded to -->
 +
<target paths="./receivefiles.xhtml;./upload/receivefile.xhtml"> <!-- semi-colon separated list of paths -->
 +
<max-bytes>1024*1024*1024</max-bytes> <!-- maximum file size -->
 +
<drop-dir>c:\temp</drop-dir> <!-- directory where files should be placed -->
 +
<file-extensions>jpg;jpeg;gif</file-extensions> <!-- allowable file extensions -->
 +
</target>
 +
</upload-targets>
 +
</default-server>
 +
 +
<server hostname="mydomain.com">
 +
<docs>./res/httpdocs/</docs>
 +
<index-pages>
 +
index.html;index.xhtml;index.jsp;index.htm;
 +
default.html;default.xhtml;default.jsp;default.htm;
 +
</index-pages>
 +
<allow-directory-browsing>false</allow-directory-browsing>
 +
<upload-targets>
 +
<target paths="./receive.xhtml">
 +
<max-bytes>1024*1024*1024</max-bytes>
 +
<drop-dir>c:\temp</drop-dir>
 +
<file-extensions>jpg;jpeg;gif</file-extensions>
 +
</target>
 +
</upload-targets>
 +
</server>
 +
 +
</http-config>
 +
</pre>
 +
 +
The default server server (default-server) element specifies the configuration for requests made to any host name other than those that have their own server entry. For example if you access your http server via "localhost" and there is no server configuration matching "localhost" (the hostname attribute of the server element), the default server will be used.
 +
 +
* '''docs''': This element specifies the document directory to use for this server configuration.
 +
* '''index-pages''': An order sensitive list of default index pages to use. In the examples above, index.html will be used first and foremost. If there is no index.html the server will look for index.xhtml, then index.jsp and so on.
 +
* '''allow-directory-browsing''': This specifies whether directory browsing is enabled for directories which have no index page. The text child should be "true" or "false".
 +
* '''upload-targets'''
 +
** '''target''' element (one or more)
 +
*** '''paths''' attribute: This specifies a a semi-colon separated list of files which can be used as upload targets (form actions using the input type="file" html tag). Files will normally contain a call to a Presence task which can handle the uploaded file.
 +
*** '''max-bytes''': Specifies the maximum file size that can be uploaded.
 +
*** '''drop-dir''': Specifies the location that uploaded files should be placed.
 +
*** '''file-extensions''': A semi-colon separated list of acceptable file types.
 +
 +
See also: [[Custom Servlets]]
  
 
{{ArchitectureLinks|Server Processes}}
 
{{ArchitectureLinks|Server Processes}}

Latest revision as of 06:16, 26 March 2012

Key Facts

Cog.png
Purpose: HTTP Servlet Engine designed to run On Demand Tasks
Type: Background Process
Started By: httpstart.exe or via Heartbeat Server and Remote Program Call Server

Introduction

The Presence HTTP Server is a simple Servlet container, configured only to run servlets which call on an available Presence Server to serve Presence On Demand requests and SOAP requests. It is installed as part of Presence and can run on any machine provided it is properly configured. It can be combined with a switch to load balance across HTTP servers.

Presence Tasks can be invoked "On Demand" by making requests to the following URL:

http://[HTTP_SERVER_HOSTNAME]:[HTTP_SERVER_PORT]/task/[TASK_ALIAS]

The "/task/" part of the URL is mapped to a dedicated servlet which chains the request to a Presence server depending on Load Balancing settings. The HTTP headers, request parameters and Task alias are passed to the Presence Server, which translates these values into variables for use in the Task being called. The Presence Server sends the response of the Task (set in the magic variable "${response}") back to the HTTP Server which in turn sends it to the client browser.

Configuration

The Server can be configured by editing the file named "httpserver.config" which is located in the "res/config" directory. This allows you to set the port that the HTTP server listens on (default 81) in addition to setting up multiple servers identified by host name in the request and configuring the file upload permissions and directory.

The default configuration looks like this:

<http-config port="80">
	<!-- This is the configuration file for Presence's in-built HTTP server. -->
	
	<default-server>
		<!-- all domains not listed below will use this configuration -->
		<docs>./res/httpdocs/</docs> 								<!-- the directory that contains the http server documents -->
		<index-pages>
				<!-- specifies files that will be used as directory welcome pages -->
				index.html;index.xhtml;index.jsp;index.htm;
				default.html;default.xhtml;default.jsp;default.htm;
		</index-pages>
		<allow-directory-browsing>true</allow-directory-browsing> 	<!-- if true directory listing is allowed -->
		<upload-targets>
			<!-- specifies a list of upload targets - requested paths that files can be uploaded to -->
			<target paths="./receivefiles.xhtml;./upload/receivefile.xhtml">					<!-- semi-colon separated list of paths -->
				<max-bytes>1024*1024*1024</max-bytes> 				<!-- maximum file size -->
				<drop-dir>c:\temp</drop-dir>						<!-- directory where files should be placed -->
				<file-extensions>jpg;jpeg;gif</file-extensions>		<!-- allowable file extensions -->
			</target>
		</upload-targets>
	</default-server>
	
	<server hostname="mydomain.com">
		<docs>./res/httpdocs/</docs>
		<index-pages>
				index.html;index.xhtml;index.jsp;index.htm;
				default.html;default.xhtml;default.jsp;default.htm;
		</index-pages>
		<allow-directory-browsing>false</allow-directory-browsing>
		<upload-targets>
			<target paths="./receive.xhtml">
				<max-bytes>1024*1024*1024</max-bytes>
				<drop-dir>c:\temp</drop-dir>
				<file-extensions>jpg;jpeg;gif</file-extensions>
			</target>
		</upload-targets>
	</server>

</http-config>

The default server server (default-server) element specifies the configuration for requests made to any host name other than those that have their own server entry. For example if you access your http server via "localhost" and there is no server configuration matching "localhost" (the hostname attribute of the server element), the default server will be used.

  • docs: This element specifies the document directory to use for this server configuration.
  • index-pages: An order sensitive list of default index pages to use. In the examples above, index.html will be used first and foremost. If there is no index.html the server will look for index.xhtml, then index.jsp and so on.
  • allow-directory-browsing: This specifies whether directory browsing is enabled for directories which have no index page. The text child should be "true" or "false".
  • upload-targets
    • target element (one or more)
      • paths attribute: This specifies a a semi-colon separated list of files which can be used as upload targets (form actions using the input type="file" html tag). Files will normally contain a call to a Presence task which can handle the uploaded file.
      • max-bytes: Specifies the maximum file size that can be uploaded.
      • drop-dir: Specifies the location that uploaded files should be placed.
      • file-extensions: A semi-colon separated list of acceptable file types.

See also: Custom Servlets


Architecture > Server Processes > HTTP Server

Heartbeat Server | Database Server | Presence Server | HTTP Server | Remote Program Call Server
Administration Client | Heartbeat Client