B4J Question HTTP response Headers in Non Ui applications

Discussion in 'B4J Questions' started by Pedro Caldeira, Mar 21, 2018.

  1. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    How can I get the headers from the response in a non-ui application ?
    I recall that Erel provided a code to replace in the Httputils source to expose the headers, but how can i do it in non UI app ?

    code provided by Erel

    Code:
    Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
       
    Dim job As HttpJob = TaskIdToJob.Get(TaskId)
       job.Tag = Response.GetHeaders
     
       Response.GetAsynchronously(
    "response"File.OpenOutput(TempFolder, TaskId, False), _
         
    True, TaskId)
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Exactly like you do in a UI application. Switch to OkHttpUtils2 source code instead of the library and make this modification.
     
  3. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    OkHttpUtils2_NONUI source code, you mean ?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This is the same source code.
     
  5. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    Please help me with this, just add the two modules to my code and remove te reference to the compiled library ?
    i did that and I get some missing references errors.
    Can't i just compile the Okhttpuitls2 source code into a new library ? is it to hard to do that ?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Yes. OkHttpUtils2 depends on jOkHttp and jStringUtils.

    No. It is very simple.
     
  7. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    I have to do something else other than compile the source code just like any other B4j application ? Or do I have to change something inthe xml also ?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. basic4mace

    basic4mace New Member Licensed User

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