Updated to use FPC's servers (TCP and HTTP) implementation

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1782 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa 2011-08-06 17:10:39 +00:00
parent 1793c3f0f4
commit d1ae85de1d
2 changed files with 29 additions and 21 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/>
@ -12,11 +12,13 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@ -28,12 +30,7 @@
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="indylaz"/>
</Item1>
</RequiredPackages>
<Units Count="3">
<Units Count="2">
<Unit0>
<Filename Value="http_server.pas"/>
<IsPartOfProject Value="True"/>
@ -44,27 +41,23 @@
<IsPartOfProject Value="True"/>
<UnitName Value="user_service_intf"/>
</Unit1>
<Unit2>
<Filename Value="..\..\indy_tcp_server.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="indy_tcp_server"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Version Value="9"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="http_server"/>
</Target>
<SearchPaths>
<IncludeFiles Value="..\..\"/>
<OtherUnitFiles Value="..\;..\..\;..\..\wst_rtti_filter\"/>
<IncludeFiles Value="..\.."/>
<OtherUnitFiles Value="..;..\..;..\..\wst_rtti_filter"/>
<UnitOutputDirectory Value="obj"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking>
@ -74,10 +67,12 @@
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CustomOptions Value="-dINDY_10
-dUseCThreads
-dWST_DBG
"/>
-dWST_DBG"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>

View File

@ -1,13 +1,22 @@
program http_server;
{$mode objfpc}{$H+}
{$IFDEF UNIX}
{$DEFINE UseCThreads}
{$DEFINE USE_THREAD}
{$ENDIF}
{$IFDEF WINDOWS}
{$DEFINE USE_THREAD}
{$ENDIF}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils,
indy_http_server, metadata_service, logger_extension, server_listener,
fpc_http_server, // indy_http_server,
metadata_service, logger_extension, server_listener,
server_service_soap, server_binary_formatter, server_service_xmlrpc, server_service_json, config_objects,
user_service_intf, user_service_intf_binder, user_service_intf_imp, server_service_intf;
@ -26,8 +35,12 @@ begin
GetServiceImplementationRegistry().FindFactory('UserService').RegisterExtension(['TLoggerServiceExtension']);
//wst_CreateDefaultFile(wst_GetConfigFileName(),nil);
AppObject := TwstIndyHttpListener.Create('');
//AppObject := TwstIndyHttpListener.Create('');
AppObject := TwstFPHttpListener.Create('');
try
{$IFDEF USE_THREAD}
TwstFPHttpListener(AppObject).Options := [loExecuteInThread, loHandleRequestInThread];
{$ENDIF}
WriteLn('"Web Service Toolkit" HTTP Server sample listening at:');
WriteLn('');
WriteLn('http://127.0.0.1:8000/');