<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-02-26 6:31 GMT-03:00 Giuseppe <span dir="ltr"><<a href="mailto:glpunzi@gmail.com" target="_blank">glpunzi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>El 26/02/2014 4:57, silvioprog
      escribió:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">2014-02-25 18:22 GMT-03:00 Giuseppe <span dir="ltr"><<a href="mailto:glpunzi@gmail.com" target="_blank">glpunzi@gmail.com</a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF"> Hi all,<br>
                <br>
                I'm trying demos on Brook 3 (from github), and simple
                demos works fine, but with DB demos I get the error:<br>
                Error 405<br>
                <span>HTTP
                  method not allowed for the requested resource.</span><br>
                <br>
                Some idea?<br>
                <br>
                Regards.</div>
            </blockquote>
          </div>
          <div><br>
          </div>
          <div>Oh, is you Giu of Lazarus forum? Sorry, I could only see
            it now hehe...</div>
          <div><br>
          </div>
          <div>Please delete all old files, like .ppu etc. These
            examples are working fine, I tested it on Windows and Linux.</div>
          <div><br>
          </div>
          <div>If problem persists, please say step by step how you are
            doing the test as well as your environment.</div></div></div></blockquote>
    Yes, I am.<br>
    Lazarus 1.2RC2, FPC 2.6.2 rev.43696, 32 bits.<br>
    brookframework downloaded from github.<br>
    Opened brookex and brookrt lpk and compiled.<br>
    dopf downloaded from github, opened and compiled.<br>
    <br>
    Open brookframework\demos\simple\helloworld\cgi project<br>
    Build.<br>
    Copy to cgi-bin folder<br>
    <a href="http://localhost:8080/cgi-bin/cgi1.bf" target="_blank">http://localhost:8080/cgi-bin/cgi1.bf</a> returns Hello World!<br>
    <br>
    Open brookframework\demos\simple\static project<br>
    Build.<br>
    Execute test.exe<br>
    <a href="http://localhost:8000/index" target="_blank">http://localhost:8000/index</a> returns static page opening a dialog as
    expected.<br>
    <br>
    Open \brookframework\demos\simple\entity project<br>
    Build.<br>
    Copy to <a href="http://cg1.bf" target="_blank">cg1.bf</a> to cgi-bin folder<br>
    <a href="http://localhost:8080/cgi-bin/cgi1.bf" target="_blank">http://localhost:8080/cgi-bin/cgi1.bf</a> returns "<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times New Roman';word-spacing:0px;display:inline!important">HTTP method not allowed for the requested resource.</span>"<br>

<br>
    Created postgres database with table person.<br>
    Open brookframework/demos/db/dopf/cgi1.lpi<br>
    Changed db configuration from dbutils.pas pointing to my database<br>
    Copied all postgres dll from postgres/bin folder to project folder.<br>
    Changed on Brokers.pas BrookFCLCGIBroker -> BrookFCLHttpAppBroker<br>
    <a href="http://localhost" target="_blank">http://localhost</a> returns "<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times New Roman';word-spacing:0px;display:inline!important">HTTP method not allowed
      for the requested resource.</span>"<br>
    <br>
    Shell:<br>
    D:\DevAux\LazComp\brookframework\demos\db\dopf>cgi1.exe<br>
    exception at 0043A79E:<br>
    Missing HTTP protocol version in request.</div></blockquote></div><div><br></div><div>Exactly how Canneyt said: <span style="font-family:arial,sans-serif;font-size:13px">It is a known bug in FPC 2.6.2</span>.</div><div>

<br></div><div>RESTful uses all HTTP methods (GET/POST/PUT/DELETE), and old FCL-web does not supports it, but it is fixed in new FCL-web.</div><div><br></div><div>Try it now in a new environment, I'll show my environment to you:</div>

<div><br></div><div>0. use a stable release of Lazarus/FPC: Lazarus 1.0.14 r43446 FPC 2.6.2 i386-win32-win32/win64 (<a href="http://sourceforge.net/projects/lazarus">http://sourceforge.net/projects/lazarus</a>);</div><div>

1. install Apache server in your system (<a href="http://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.22-win32-x86-openssl-0.9.8t.msi">http://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.22-win32-x86-openssl-0.9.8t.msi</a>), choosing the "c:\websrv" folder instead of default Apache folder in "Program Files", after install, you will have the "c:\websrv\cgi-bin" folder;</div>

<div>2. undo all changes in your Brook demos (in SmartGIT, I select all files and use "Revert" button), and keep using BrookFCLCGIBroker instead of BrookFCLHTTPAppBroker broker that you changed;</div><div>3. install the best browser in your system: Google Chrome;</div>

<div>4. install a complete REST client plugin in your Chrome: <a href="https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo">https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo</a>;</div>

<div>5. with your database and "person" table already created, open the project "C:\repository\git\brookframework\demos\db\rest\cgi1.lpi" and, in your project options (Ctrl+Shift+F11), set "c:\websrv\cgi-bin\<a href="http://cgi1.bf">cgi1.bf</a>" in "Compiler Options > Paths > Target file name", and uncheck the "Apply conventions" option;</div>

<div>6. compile your project (Ctrl+F9);</div><div>7. configure your REST plugin to: <a href="http://imagebin.org/295955">http://imagebin.org/295955</a>;</div><div>8. enjoy;</div><div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>