B4J Question Dim In As InputStream = req.InputStream

Discussion in 'B4J Questions' started by schimanski, Jun 19, 2015.

  1. schimanski

    schimanski Well-Known Member Licensed User

    I have a problem with reading paramters in the server-handler. When i call Dim In As InputStream = req.InputStream, i can only read out the paramter "type". The other parameters are only available, when I do not set Dim In As InputStream = req.InputStream.
    Sub Handle(req As ServletRequest, resp As ServletResponse)
    If req.Method <> "POST" Then
    500"Methode wird nicht unterstützt! (nur POST)")
    End If
    'we need to call req.InputStream before calling GetParameter.
        'Otherwise the stream will be read internally (as the parameter might be in the post body).
        Dim In As InputStream = req.InputStream
    Dim reqType As String = req.GetParameter("type")
    log(req.getParamter("absender"))     <----- is emty!
    If reqType = "" Then
    500"Parameter für den Dateityp wurde nicht übertragen (text oder file)")
    End If
    Select reqType
    Case "status"
  2. billzhan

    billzhan Active Member Licensed User

    typo: req.getParamter("absender") . GetParameter
  3. Erel

    Erel Administrator Staff Member Licensed User

    You need to first get the URL parameters and only then get the input stream (see the comment in the code).
  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