B4J Question Web server

Discussion in 'B4J Questions' started by Zlgo, May 24, 2019.

Tags:
  1. Zlgo

    Zlgo Member

    Hi
    Playing with web server example on https://www.b4x.com/android/forum/threads/server-building-web-servers-with-b4j.37172/ find that if you create simple form page with some visual app editor(instead one in example) in Logs part of B4J IDE appear message
    " org.eclipse.jetty.http.BadMessageException: 400: Unable to parse form content" .
    Is it some rules how must look HTML code that could be parsed correctly, in this page which I create is included background, dimension, location and other parameters? After all I put loop For / Next to extract
    key from ParameterMap with break point on "For" line and left for 20 sec before go to next line(Step IN)
    and then it parsed key from map! So it looks that for parsing other format it needs much more time to finish but before he throws error.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Make sure not to connect to a non-ssl port with https:// or to a ssl port with http://.
     
  3. Zlgo

    Zlgo Member

    Hi
    I was out of home for while so I'm delay , but I try just simple example from your tutorial and only difference is new created page with some visual tool (Dynamic HTML editor) for easier positioning fields and no HTTPS port used. Just open from \\10.0.0.x:8080 , that's it. If i make delay(debuging) of cca 22sec. then req.ParameterMap is filled correctly. Second problem is if in some fields put word with diacritic char (from CP1250) program broke in copying ParametarMap into Map variable. OS is Win10
    java version "1.8.0_191".
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I'm sorry but I don't understand. Were you able to solve the BadMessageException?
     
  5. Zlgo

    Zlgo Member

    Hi
    In B4J editor put "breakpoint" on some line for example line 39 in Main program (your web example)39 "Dim params As Map = req.ParameterMap", put mouse over
    ParametarMap and wait that data show in floating window instead "error evaulating expression" and then release program with F10 (step out). With this procedure data
    come in right shape and web page is refreshed with correct return data. Hope that I answer correctly on your question? If you can, try put some name in field with char from CP1250 and will see error occur , on my PC which use this code page it is easy to produce!

    Regards
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This means that you are not setting the request content encoding correctly.
     
  7. Zlgo

    Zlgo Member

    Hi
    I'm not sure is it correct but I put <meta charset="utf-8"/> into header of both pages (my creation and one in example "Form example") but parsing still go bad if there is
    diacritic signs or many chars above 127dec . Is there any explanation for first problem that parsing go wrong with created pages with some other tools?
    Regards
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Please upload your project.
     
  9. Zlgo

    Zlgo Member

    Hi
    There is WWW example with inserted new created form page.
    In further trying, get positive result for using other chars (UTF 8 settings ) in form fields.
    Regards
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice