B4J Question Dim In As InputStream = req.InputStream


Well-Known Member
Licensed User
Longtime 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
        resp.SendError(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
        resp.SendError(500, "Parameter für den Dateityp wurde nicht übertragen (text oder file)")
    End If
    Select reqType
        Case "status"