Chris Guanzon Active Member Licensed User Longtime User May 12, 2023 #1 Hello everyone. I have a problem with StringUtils using base64encode. It works fine on my local PC, but when I run it on my VPS, I get an error. Here's the error message: B4X: (IllegalArgumentException) java.lang.IllegalArgumentException: Base64-encoded string must have at least four characters, but length specified was 3 Here is how I convert a string to a base64 string. B4X: dim s as string = "some text here" s = SU.EncodeBase64(s.GetBytes("UTF8")) This is how I decode it. B4X: s = BytesToString(SU.DecodeBase64(s), 0, SU.DecodeBase64(s).Length, "UTF8")
Hello everyone. I have a problem with StringUtils using base64encode. It works fine on my local PC, but when I run it on my VPS, I get an error. Here's the error message: B4X: (IllegalArgumentException) java.lang.IllegalArgumentException: Base64-encoded string must have at least four characters, but length specified was 3 Here is how I convert a string to a base64 string. B4X: dim s as string = "some text here" s = SU.EncodeBase64(s.GetBytes("UTF8")) This is how I decode it. B4X: s = BytesToString(SU.DecodeBase64(s), 0, SU.DecodeBase64(s).Length, "UTF8")
Chris Guanzon Active Member Licensed User Longtime User May 12, 2023 #2 I found the problem; it is not about the base64, but rather about the session. It is not adding a session on the VPS, which is why it returns an error because the string returns "null". How can I fix this? Is there anything I need to install on my VPS? Upvote 0
I found the problem; it is not about the base64, but rather about the session. It is not adding a session on the VPS, which is why it returns an error because the string returns "null". How can I fix this? Is there anything I need to install on my VPS?
Chris Guanzon Active Member Licensed User Longtime User May 12, 2023 #3 I cannot get the session on the server using the handler. Code: Sub Handle(req As ServletRequest, resp As ServletResponse) dim info as string = <some info here> req.GetSession.SetAttribute("info", info) End Sub Code: Sub Handle(req As ServletRequest, resp As ServletResponse) dim info as string = req.GetSession.GetAttribute("info") log("Info: " & info) End Sub Returns null value. Upvote 0
I cannot get the session on the server using the handler. Code: Sub Handle(req As ServletRequest, resp As ServletResponse) dim info as string = <some info here> req.GetSession.SetAttribute("info", info) End Sub Code: Sub Handle(req As ServletRequest, resp As ServletResponse) dim info as string = req.GetSession.GetAttribute("info") log("Info: " & info) End Sub Returns null value.
EnriqueGonzalez Expert Licensed User Longtime User May 12, 2023 #4 The session depends on cookies. Check in your browser that you are receiving a cookie and that the cookie is not being deleted, may be you have some extreme privacy measure. Upvote 0
The session depends on cookies. Check in your browser that you are receiving a cookie and that the cookie is not being deleted, may be you have some extreme privacy measure.