<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- webtool</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/webtool-0.8.9.1.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>WebTool</strong><br><strong>Reference Manual</strong><br><small>Version 0.8.9.1</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="loadscrollpos" title="webtool " expanded="true">webtool<ul> <li><a href="webtool.html"> Top of manual page </a></li> <li title="start-0"><a href="webtool.html#start-0">start/0</a></li> <li title="start-2"><a href="webtool.html#start-2">start/2</a></li> <li title="stop-0"><a href="webtool.html#stop-0">stop/0</a></li> <li title="debug_app-1"><a href="webtool.html#debug_app-1">debug_app/1</a></li> <li title="stop_debug-0"><a href="webtool.html#stop_debug-0">stop_debug/0</a></li> <li title="Module:Func-1"><a href="webtool.html#Module:Func-1">Module:Func/1</a></li> </ul> </li> <li title="start_webtool"><a href="start_webtool.html">start_webtool</a></li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>webtool</h1></center> <h3>MODULE</h3> <div class="REFBODY">webtool</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">WebTool is a tool used to simplify the implementation of web based tools with Erlang/OTP.</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>WebTool makes it easy to use web based tools with Erlang/OTP. WebTool configures and starts the webserver httpd.</p> </p></div> <h3>EXPORTS</h3> <p><a name="start-0"><span class="bold_code">start()-> {ok,Pid}| {stop,Reason}</span></a><br></p> <div class="REFBODY"><p> <p>Start WebTool with default data, i.e. port 8888, ip-number 127.0.0.1, and server-name <span class="code">localhost</span>. 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. </p> <p>The <span class="code">mime.types</span> file and WebTool's own HTML files are assumed to be in the directory <span class="code">webtool-<vsn>/priv/root/conf</span>.</p> </p></div> <p><a name="start-2"><span class="bold_code">start(Path,Data)->{ok,Pid}|{stop,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Path = string() | standard_path</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Data = [Port,Address,Name] | PortNumber | standard_data</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Port = {port,PortNumber}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Address = {bind_address,IpNumber}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Name = {server_name,ServerName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">PortNumber = integer()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">IpNumber = tuple(), e.g. {127,0,0,1}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ServerName = string()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Pid = pid()</span><br> </div> </div> <div class="REFBODY"><p> <p>Use this function to start WebTool if the default port, ip-number,servername or path can not be used.</p> <p><span class="code">Path</span> is the directory where the <span class="code">mime.types</span> file and WebTool's own HTML files are located. By default this is <span class="code">webtool-<vsn>/priv</span>, and in most cases there is no need to change this. If <span class="code">Path</span> is set to <span class="code">standard_path</span> the default will be used.</p> <p>If <span class="code">Data</span> is set to <span class="code">PortNumber</span>, the default data will be used for ip-number (<span class="code">127.0.0.1</span>) and server name (<span class="code">localhost</span>).</p> </p></div> <p><a name="stop-0"><span class="bold_code">stop()->void</span></a><br></p> <div class="REFBODY"><p> <p>Stop WebTool and the tools started by WebTool.</p> </p></div> <p><a name="debug_app-1"><span class="bold_code">debug_app(Module)->void</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Module = atom()</span><br> </div> </div> <div class="REFBODY"><p> <p>Debug a WebTool application by tracing all functions in the given module which are called from WebTool.</p> </p></div> <p><a name="stop_debug-0"><span class="bold_code">stop_debug()->void</span></a><br></p> <div class="REFBODY"><p> <p>Stop the tracing started by <span class="code">debug_app/1</span>, and format the trace log.</p> </p></div> <h3><a name="id60773">CALLBACK FUNCTIONS</a></h3> <div class="REFBODY"> <p>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 <span class="bold_code"><a href="webtool_chapter.html">WebTool User's Guide</a></span> for more information about the *.tool files.</p> </div> <h3>EXPORTS</h3> <p><a name="Module:Func-1"><span class="bold_code">Module:Func(Data)-> {Name,WebData}|error</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Data = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Name = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">WebData = [WebOptions]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">WebOptions = LinkData | Alias | Start</span><br> </div> <div class="REFTYPES"> <span class="bold_code">LinkData = {web_data,{ToolName,Url}}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Alias = {alias,{VirtualPath,RealPath}} | {alias,{erl_alias,Path,[Modules]}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Start = {start,StartData}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ToolName = Url = VirtualPath = RealPath = Path = string()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Modules = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">StartData = AppData | ChildSpec | Func</span><br> </div> <div class="REFTYPES"> <span class="bold_code">AppData = {app,AppName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ChildSpec = {child,child_spec()}</span><br> </div> <div class="REFBODY">See the Reference Manual for the module supervisor in the STDLIB application for details about child_spec().</div> <div class="REFTYPES"> <span class="bold_code">Func = {func,{StartMod,StartFunc,StartArg}, {StopMod,StopFunc,StopArg}}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">AppName = StartMod = StartFunc = StopMod = StopFunc =atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">StartArg = StopArg = [term()]</span><br> </div> </div> <div class="REFBODY"><p> <p>This is the configuration function (<span class="code">config_func</span>) which must be stated in the <span class="code">*.tool</span> file.</p> <p>The function is called by WebTool at startup to retrieve the data needed to start and configure the tool. <span class="code">LinkData</span> is used by WebTool to create the link to the tool. <span class="code">Alias</span> is used to create the aliases needed by the webserver. <span class="code">Start</span> is used to start and stop the tool.</p> </p></div> <h3><a name="id62298">See Also</a></h3> <div class="REFBODY"> <p><span class="bold_code"><a href="start_webtool.html">start_webtool(1)</a></span>, <span class="bold_code"><a href="webtool_chapter.html">WebTool User's Guide</a></span></p> </div> </div> <div class="footer"> <hr> <p>Copyright © 2001-2012 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>