From 84adefa331c4159d432d22840663c38f155cd4c1 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Fri, 20 Nov 2009 14:54:40 +0000 Subject: The R13B03 release. --- lib/webtool/doc/src/Makefile | 127 +++++++++++++++ lib/webtool/doc/src/book.xml | 47 ++++++ lib/webtool/doc/src/fascicules.xml | 18 +++ lib/webtool/doc/src/make.dep | 20 +++ lib/webtool/doc/src/notes.xml | 112 +++++++++++++ lib/webtool/doc/src/notes_history.xml | 73 +++++++++ lib/webtool/doc/src/part.xml | 37 +++++ lib/webtool/doc/src/part_notes.xml | 39 +++++ lib/webtool/doc/src/part_notes_history.xml | 39 +++++ lib/webtool/doc/src/ref_man.xml | 38 +++++ lib/webtool/doc/src/start_webtool.xml | 103 ++++++++++++ lib/webtool/doc/src/webtool.xml | 156 ++++++++++++++++++ lib/webtool/doc/src/webtool_chapter.xml | 248 +++++++++++++++++++++++++++++ 13 files changed, 1057 insertions(+) create mode 100644 lib/webtool/doc/src/Makefile create mode 100644 lib/webtool/doc/src/book.xml create mode 100644 lib/webtool/doc/src/fascicules.xml create mode 100644 lib/webtool/doc/src/make.dep create mode 100644 lib/webtool/doc/src/notes.xml create mode 100644 lib/webtool/doc/src/notes_history.xml create mode 100644 lib/webtool/doc/src/part.xml create mode 100644 lib/webtool/doc/src/part_notes.xml create mode 100644 lib/webtool/doc/src/part_notes_history.xml create mode 100644 lib/webtool/doc/src/ref_man.xml create mode 100644 lib/webtool/doc/src/start_webtool.xml create mode 100644 lib/webtool/doc/src/webtool.xml create mode 100644 lib/webtool/doc/src/webtool_chapter.xml (limited to 'lib/webtool/doc/src') diff --git a/lib/webtool/doc/src/Makefile b/lib/webtool/doc/src/Makefile new file mode 100644 index 0000000000..7b86752738 --- /dev/null +++ b/lib/webtool/doc/src/Makefile @@ -0,0 +1,127 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +# AB. All Rights Reserved.'' +# +# $Id$ +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(WEBTOOL_VSN) +APPLICATION=webtool + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_APPLICATION_FILES = ref_man.xml + +XML_REF1_FILES = start_webtool.xml + +XML_REF3_FILES = webtool.xml + +XML_PART_FILES = \ + part.xml \ + part_notes.xml \ + part_notes_history.xml + +XML_CHAPTER_FILES = \ + webtool_chapter.xml \ + notes.xml \ + notes_history.xml + +BOOK_FILES = book.xml + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) $(XML_REF3_FILES) \ + $(XML_REF1_FILES) $(XML_APPLICATION_FILES) + +GIF_FILES = + +# ---------------------------------------------------- + +HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) + +INFO_FILE = ../../info + +MAN1_FILES = $(XML_REF1_FILES:%.xml=$(MAN1DIR)/%.1) +MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) + +HTML_REF_MAN_FILE = $(HTMLDIR)/index.html + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: pdf html man + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: gifs $(HTML_REF_MAN_FILE) + + +clean clean_docs: + rm -rf $(HTMLDIR)/* + rm -f $(MAN1DIR)/* + rm -f $(MAN3DIR)/* + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +man: $(MAN1_FILES) $(MAN3_FILES) + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(HTMLDIR)/* \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man1 + $(INSTALL_DATA) $(MAN1_FILES) $(RELEASE_PATH)/man/man1 + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3 + +release_spec: + diff --git a/lib/webtool/doc/src/book.xml b/lib/webtool/doc/src/book.xml new file mode 100644 index 0000000000..ace70b5726 --- /dev/null +++ b/lib/webtool/doc/src/book.xml @@ -0,0 +1,47 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + WebTool + + + + 1.0 +
+ + + WebTool + + + + + + + + + + + + + +
+ diff --git a/lib/webtool/doc/src/fascicules.xml b/lib/webtool/doc/src/fascicules.xml new file mode 100644 index 0000000000..0678195e07 --- /dev/null +++ b/lib/webtool/doc/src/fascicules.xml @@ -0,0 +1,18 @@ + + + + + + User's Guide + + + Reference Manual + + + Release Notes + + + Off-Print + + + diff --git a/lib/webtool/doc/src/make.dep b/lib/webtool/doc/src/make.dep new file mode 100644 index 0000000000..87526b3f73 --- /dev/null +++ b/lib/webtool/doc/src/make.dep @@ -0,0 +1,20 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex part.tex ref_man.tex start_webtool.tex \ + webtool.tex webtool_chapter.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +book.tex: ref_man.xml + diff --git a/lib/webtool/doc/src/notes.xml b/lib/webtool/doc/src/notes.xml new file mode 100644 index 0000000000..644cf7f7a8 --- /dev/null +++ b/lib/webtool/doc/src/notes.xml @@ -0,0 +1,112 @@ + + + + +
+ + 20042009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Webtool Release Notes + otp_appnotes + nil + nil + nil + notes.xml +
+

This document describes the changes made to the Webtool + application.

+ +
WebTool 0.8.5 + +
Improvements and New Features + + +

+ The documentation is now built with open source tools + (xsltproc and fop) that exists on most platforms. One + visible change is that the frames are removed.

+

+ Own Id: OTP-8201

+
+
+
+ +
+ +
WebTool 0.8.4 + +
Improvements and New Features + + +

The copyright notices have been updated.

+

+ Own Id: OTP-7851

+
+
+
+ +
+
WebTool 0.8.3.2 + +
Improvements and New Features + + +

+ Minor updates.

+

+ Own Id: OTP-6998

+
+
+
+ +
+ +
+ WebTool 0.8.3.1 + +
+ Improvements and New Features + + +

Minor Makefile changes.

+

Own Id: OTP-6689

+
+ +

Obsolete guard tests (such as list()) have been replaced + with the modern guard tests (such as is_list()).

+

Own Id: OTP-6725

+
+
+
+
+ +
+ WebTool 0.8.3 + +
+ Improvements and New Features + + +

Removed some dead code discovered by Dialyzer.

+

Own Id: OTP-6041

+
+
+
+
+
+ diff --git a/lib/webtool/doc/src/notes_history.xml b/lib/webtool/doc/src/notes_history.xml new file mode 100644 index 0000000000..edab54d61f --- /dev/null +++ b/lib/webtool/doc/src/notes_history.xml @@ -0,0 +1,73 @@ + + + + +
+ + 2006 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Webtool Release Notes History + otp_appnotes + nil + nil + nil +
+ +
+ Webtool 0.8.2 + +
+ Fixed Bugs and Malfunctions + + +

Bugfix: webtool crashed when trying to find a free + port number if connection failed with other reason than + econnrefused.

+

Own Id: OTP-5166

+
+
+
+ +
+ Improvements and New Features + + +

Misc improvements:

+ + The function debug_app/1 and some error + printouts are added to simplify debugging of own + application. + Multiple webtool instances can now be started on + the same host. If the default port (8888) is in use, port + 8889 is tried. If 8889 is also used, 8890 is tried and so + on. Max number of ports tried is 256. + Incompatible: If Data is set to + PortNumber in start(Path,Data), the default + data will be used for ip-number (127.0.0.1) and + server name (localhost). + +

*** POTENTIAL INCOMPATIBILITY ***

+

Own Id: OTP-4724

+
+
+
+
+
+ diff --git a/lib/webtool/doc/src/part.xml b/lib/webtool/doc/src/part.xml new file mode 100644 index 0000000000..9306ea020e --- /dev/null +++ b/lib/webtool/doc/src/part.xml @@ -0,0 +1,37 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + WebTool User's Guide + + + + +
+ +

WebTool provides a easy way to use web based tools with + Erlang/OTP. It configures and starts a webserver as well as all + available tools.

+
+ +
+ diff --git a/lib/webtool/doc/src/part_notes.xml b/lib/webtool/doc/src/part_notes.xml new file mode 100644 index 0000000000..7d5592d3aa --- /dev/null +++ b/lib/webtool/doc/src/part_notes.xml @@ -0,0 +1,39 @@ + + + + +
+ + 20042009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + WebTool Release Notes + + + + +
+ +

WebTool provides an easy way to use web based tools with + Erlang/OTP. It configures and starts a webserver as well as all + available tools.

+

For information about older versions, see + Release Notes History.

+
+ +
+ diff --git a/lib/webtool/doc/src/part_notes_history.xml b/lib/webtool/doc/src/part_notes_history.xml new file mode 100644 index 0000000000..c1f6f846f5 --- /dev/null +++ b/lib/webtool/doc/src/part_notes_history.xml @@ -0,0 +1,39 @@ + + + + +
+ + 2006 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + WebTool Release Notes History + + + + +
+ +

WebTool provides a easy way to use web based tools with + Erlang/OTP. It configures and starts a webserver as well as all + available tools.

+
+ +
+ diff --git a/lib/webtool/doc/src/ref_man.xml b/lib/webtool/doc/src/ref_man.xml new file mode 100644 index 0000000000..537e8697c9 --- /dev/null +++ b/lib/webtool/doc/src/ref_man.xml @@ -0,0 +1,38 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + WebTool Reference Manual + + + + +
+ +

WebTool provides an easy way to use web based tools with + Erlang/OTP. It configures and starts a webserver as well as all + available tools.

+
+ + +
+ diff --git a/lib/webtool/doc/src/start_webtool.xml b/lib/webtool/doc/src/start_webtool.xml new file mode 100644 index 0000000000..184285c631 --- /dev/null +++ b/lib/webtool/doc/src/start_webtool.xml @@ -0,0 +1,103 @@ + + + + +
+ + 20032009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + start_webtool + + + 1 + + + 2003-06-18 + + start_webtool.sgml +
+ start_webtool + WebTool Start Script + +

The start_webtool script starts WebTool, a WebTool + application and a web browser pointing to this application.

+
+ + + start_webtool application [ browser ] + Start a WebTool Application + +

Starts WebTool, the given WebTool Application and a web + browser pointing to this application. +

+

If no argument is given, a list of available applications + is displayed, e.g.

+
+>start_webtool
+Starting webtool...
+WebTool is available at http://localhost:8888/
+Or  http://127.0.0.1:8888/
+
+Usage: start_webtool application [ browser ]
+
+Available applications are: [orber,appmon,crashdump_viewer,webcover]
+Default browser is 'iexplore' (Internet Explorer) on Windows or else 'netscape'        
+

To start any of the listed applications, give the + application name as the first argument, e.g.

+
+>start_webtool webcover
+Starting webtool...
+WebTool is available at http://localhost:8888/
+Or  http://127.0.0.1:8888/
+Starting webcover...
+Sending URL to netscape...done        
+

The WebTool application WebCover is then started and the + default browser is used. The default browser is Internet + Explorer on Windows or else Netscape. +

+

To use another browser, give the browser's start command + as the second argument, e.g.

+
+>start_webtool webcover mozilla
+Starting webtool...
+WebTool is available at http://localhost:8888/
+Or  http://127.0.0.1:8888/
+Starting webcover...
+Sending URL to mozilla...done        
+

If the given browser name is not known to WebTool, WebTool + will run it as a command with the start URL as the only + argument, e.g.

+
+>start_webtool webcover mybrowser
+Starting webtool...
+WebTool is available at http://localhost:8888/
+Or  http://127.0.0.1:8888/
+Starting webcover...
+Starting mybrowser...        
+

Here the command "mybrowser http://localhost:8888/webcover" is executed. +

+
+
+
+ +
+ See Also +

webtool(3)

+
+
+ diff --git a/lib/webtool/doc/src/webtool.xml b/lib/webtool/doc/src/webtool.xml new file mode 100644 index 0000000000..55bac8bd34 --- /dev/null +++ b/lib/webtool/doc/src/webtool.xml @@ -0,0 +1,156 @@ + + + + +
+ + 2001 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + webtool + + + + +
+ webtool + WebTool is a tool used to simplify the implementation of web based tools with Erlang/OTP. + +

WebTool makes it easy to use web based tools with Erlang/OTP. WebTool + configures and starts the webserver httpd.

+
+ + + start()-> {ok,Pid}| {stop,Reason} + Start WebTool. + +

Start WebTool with default data, i.e. port 8888, ip-number + 127.0.0.1, and server-name localhost. If port 8888 is + in use, port 8889 is tried instead. If 8889 is also in use, + 8890 is tried and so on. Max number of ports tried is 256. +

+

The mime.types file and WebTool's own HTML files + are assumed to be in the directory + /priv/root/conf]]>.

+
+
+ + start(Path,Data)->{ok,Pid}|{stop,Reason} + Start WebTool with default configuration. + + Path = string() | standard_path + Data = [Port,Address,Name] | PortNumber | standard_data + Port = {port,PortNumber} + Address = {bind_address,IpNumber} + Name = {server_name,ServerName} + PortNumber = integer() + IpNumber = tuple(), e.g. {127,0,0,1} + ServerName = string() + Pid = pid() + + +

Use this function to start WebTool if the default port, + ip-number,servername or path can not be used.

+

Path is the directory where the mime.types + file and WebTool's own HTML files are located. By default + this is /priv]]>, and in most cases there + is no need to change this. If Path is set to + standard_path the default will be used.

+

If Data is set to PortNumber, the default data + will be used for ip-number (127.0.0.1) and server + name (localhost).

+
+
+ + stop()->void + Stop WebTool. + +

Stop WebTool and the tools started by WebTool.

+
+
+ + debug_app(Module)->void + Debug a WebTool application. + + Module = atom() + + +

Debug a WebTool application by tracing all functions in the + given module which are called from WebTool.

+
+
+ + stop_debug()->void + Stop debugging an application and format the trace log. + +

Stop the tracing started by debug_app/1, and format + the trace log.

+
+
+
+ +
+ CALLBACK FUNCTIONS +

The following callback function must be implemented by each web + based tool that will be used via WebTool. When started, WebTool + searches the Erlang code path for *.tool files to locate all web + based tools and their callback functions. See the WebTool User's Guide for more + information about the *.tool files.

+
+ + + Module:Func(Data)-> {Name,WebData}|error + Returns configuration data needed by WebTool to configure and start a tool. + + Data = term() + Name = atom() + WebData = [WebOptions] + WebOptions = LinkData | Alias | Start + LinkData = {web_data,{ToolName,Url}} + Alias = {alias,{VirtualPath,RealPath}} | {alias,{erl_alias,Path,[Modules]} + Start = {start,StartData} + ToolName = Url = VirtualPath = RealPath = Path = string() + Modules = atom() + StartData = AppData | ChildSpec | Func + AppData = {app,AppName} + ChildSpec = {child,child_spec()} + See the Reference Manual for the module supervisor in the STDLIB application for details about child_spec(). + Func = {func,{StartMod,StartFunc,StartArg}, {StopMod,StopFunc,StopArg}} + AppName = StartMod = StartFunc = StopMod = StopFunc =atom() + StartArg = StopArg = [term()] + + +

This is the configuration function (config_func) + which must be stated in the *.tool file.

+

The function is called by WebTool at startup to retrieve the + data needed to start and configure the tool. LinkData is + used by WebTool to create the link to the tool. Alias is + used to create the aliases needed by the webserver. Start + is used to start and stop the tool.

+
+
+
+ +
+ See Also +

start_webtool(1), + WebTool User's Guide

+
+
+ diff --git a/lib/webtool/doc/src/webtool_chapter.xml b/lib/webtool/doc/src/webtool_chapter.xml new file mode 100644 index 0000000000..ceadce382d --- /dev/null +++ b/lib/webtool/doc/src/webtool_chapter.xml @@ -0,0 +1,248 @@ + + + + +
+ + 20012009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + WebTool User Guide + + + + + webtool_chapter.xml +
+ +
+ Introduction +

WebTool provides an easy and efficient way to implement web + based tools with Erlang/OTP. WebTool configures and starts the + webserver and the various web based tools.

+

All tools that shall run under WebTool must have a *.tool + file in the code path or in its priv directory. When WebTool + starts it searches the code path for such files. For each + ebin directory in the path, the priv directory is + also searched. The *.tool files contain the configuration data + for each web based tool.

+
+ +
+ Starting WebTool +

Start WebTool by calling the function webtool:start/0 or + webtool:start/2. If webtool:start/0 is used the + start page of WebTool is available at + http://localhost:8888/ or + http://127.0.0.1:8888/, and the directory containing + the root directory for the webserver, is assumed to be + /priv]]>.

+

Use webtool:start/2 if the default path for the root + directory, port, ip-number or server name can not be used. See + the Reference Manual for webtool for more information.

+

WebTool, with the default configuration as in start/0, + can also be started with the start_webtool script which + is available in the priv directory of the WebTool + application. See the Reference Manual for start_webtool for further + information about this script. For Windows users, the batch file + start_webtool.bat can be used for the same purpose.

+
+ +
+ Using WebTool +

Start WebTool and point the browser to the corresponding URL. + At the top of the page there is a frame with a link named + WebTool. Click that link and a page where it is + possible to start the available tools will appear in the main + frame.

+
+ +
+ Start a web based tool +

Click on the link labeled WebTool in the topmost frame, + select the checkbox for each tool to start and + click on the button labeled Start. A link to each tool + that WebTool succeeded to start will appear in the topmost frame.

+
+ +
+ Stop a web based tool +

Click on the link labeled WebTool in the topmost + frame. Select Stop Tools in the left frame. Select the + checkbox for each tool to stop and click on the button labeled + Stop.

+
+ +
+ Develop new web based tools +

WebTool can be used as a framework when developing new web based + tools.

+

A web based tool running under WebTool will typically consist of + three parts.

+ + A *.tool file which defines how WebTool can find the tool's + configuration data + The Erlang code generating the web interface to the tool (HTML + code) + The tool itself. + +

In most cases it is a good idea to separate the code for + creation of the html-pages and the code for the logic. This + increases the readability of the code and the logic might be + possible to reuse.

+ +
+ The *.tool file +

When WebTool starts it searches the current path for + *.tool files to find all available tools. The *.tool + file contains a version identifier and a list of tuples which + is the configuration data. The version identifier specifies + the *.tool file version, i.e. not the version of + webtool. Currently the only valid version is "1.2" and the + only valid configuration tag is + config_func. config_func specifies which + function WebTool must call to get further configuration data + for the tool. This means that a *.tool file generally must + look like this:

+ + {version,"1.2"}. + [{config_func,{Module,Function,Arguments}}]. +

Module is the name of the module where the callback + function is defined. Function is the name of the + callback function, and Arguments is the list of + arguments to the callback function.

+
+ +
+ The configuration function +

The *.tool file points out a configuration function. This + function must return a list of configuration parameters (see + the Reference Manual for webtool).

+

The web_data parameter is mandatory and it specifies + the name of the tool and the link to the tool's start + page. All other parameters are optional.

+

If the tool requires any processes to run, the start + parameter specifies the function that WebTool must call in + order to start the process(es).

+

The alias parameters are passed directly on to the + webserver (INETS). The webserver has three ways to create + dynamic web pages CGI, Eval Scheme and Erl Scheme. All tools + running under WebTool must use Erl Scheme.

+

Erl Scheme tries to resemble plain CGI. The big difference is + that Erl Scheme can only execute Erlang code. The code will + furthermore be executed on the same instance as the webserver.

+

An URL which calls an Erlang function with Erl Scheme can have + the following syntax:

+ ]]> +

An alias parameter in the configuration function can be + an ErlScriptAlias as used in the above URL. The definition of + an ErlScripAlias shall be like this:

+

{alias,{erl_alias,Path,[Modules]}}, e.g.

+

{alias,{erl_alias,"/testtool",[helloworld]}}

+

The following URL will then cause a call to the function + helloworld:helloworld/2 (if WebTool is started with default + settings i.e. servername "localhost" and port 8888):

+

http://localhost:8888/testtool/helloworld/helloworld

+

Note that the module helloworld must be in the code + path of the node running WebTool.

+

Functions that are called via the Erl Scheme must take two + arguments, Environment and Input. +

+ + Environment is a list of key/value tuples. + Input is the part of the URL after the "?", i.e. the + part of the URL containing name-value pairs. If the page was + called with the URL: +

+

+Input will be the string + . In the module + httpd in the INETS application there is a function + parse_query which will parse such a string and return + a list of key-value tuples.
+
+

An alias parameter in the configuration function can + also be a normal path alias. This can e.g. be used to point + out a directory where HTML files are stored. The following + definition states that the URL + http://localhost:8888/mytool_home/ really points to the + directory /usr/local/otp/lib/myapp-1.0/priv:

+

{alias,{"/mytool_home","/usr/local/otp/lib/myapp-1.0/priv"}}

+

See the INETS documentation, especially the module + mod_esi, for a more in depht coverage of Erl Scheme.

+
+ +
+ A small example +

A Hello World example that uses Erl Scheme would look like + this. Note that this example does not have a process running + and thus does not need a start parameter in the + configuration function. +

+

helloworld.erl:

+
+        -module(helloworld).
+        -export([config_data/0]).
+        -export([helloworld/2]).
+        
+        config_data()->
+            {testtool,
+             [{web_data,{"TestTool","/testtool/helloworld/helloworld"}},
+              {alias,{erl_alias,"/testtool",[helloworld]}}]}.
+        
+        helloworld(_Env,_Input)->
+            [header(),html_header(),helloworld_body(),html_end()].
+
+        header() ->
+            header("text/html").
+
+        header(MimeType) ->
+            "Content-type: " ++ MimeType ++ "\\r\
+\\r\
+".
+
+        html_header() ->    
+            "<HTML>
+               <HEAD>
+                  <TITLE>Hello world Example </TITLE>
+               </HEAD>\
+".
+
+        helloworld_body()->
+            "<BODY>Hello World</BODY>".
+
+        html_end()->
+            "</HTML>".
+      
+

To use this example with WebTool a *.tool file must be created + and added to a directory in the current path, e.g. the same + directory as the compiled helloworld.beam.

+

testtool.tool:

+ + {version,"1.2"}. + [{config_func, {helloworld,config_data,[]}}]. + +

When helloworld.erl is compiled, start WebTool by + calling the function webtool:start() and point your + browser to http://localhost:8888/. Select WebTool in + the topmost frame and start TestTool from the web page. Click + on the link labeled TestTool in the topmost frame.

+
+
+
+ -- cgit v1.2.3