B4J Question Dim In As InputStream = req.InputStream

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.
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
   
    If req.Method <> "POST" Then
        resp.SendError(500, "Methode wird nicht unterstützt! (nur POST)")
        Return
    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.GetParameter("type"))
    log(req.getParamter("absender"))     <----- is emty!
    
    If reqType = "" Then
        resp.SendError(500, "Parameter für den Dateityp wurde nicht übertragen (text oder file)")
        Return
    End If
    Select reqType
        Case "status"
                .............
 
Top