How to get host name with port from a http or https request

You can use HttpServletRequest.getScheme() to retrieve either “http” or “https”. Using it along with HttpServletRequest.getServerName() should be enough to rebuild the portion of the URL you need. You don’t need to explicitly put the port in the URL if you’re using the standard ones (80 for http and 443 for https). Edit: If your servlet … Read more

HttpServletRequest UTF-8 Encoding [duplicate]

Paul’s suggestion seems like the best course of action, but if you’re going to work around it, you don’t need URLEncoder or URLDecoder at all: String item = request.getParameter(“param”); byte[] bytes = item.getBytes(StandardCharsets.ISO_8859_1); item = new String(bytes, StandardCharsets.UTF_8); // Java 6: // byte[] bytes = item.getBytes(“ISO-8859-1”); // item = new String(bytes, “UTF-8”); Update: Since this … Read more

How does Request.IsAuthenticated work?

Thanks to Google, I found a cached version of the post @keyboardP refers to in his answer. I’m posting that answer/post here as a reference for others since the original link is broken (2012-12-06). Original question that the answer below refers to: I have a forms based application that is giving me fits. I noticed … Read more

How to use curl to get a GET request exactly same as using Chrome?

If you need to set the user header string in the curl request, you can use the -H option to set user agent like: curl -H “user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36” http://stackoverflow.com/questions/28760694/how-to-use-curl-to-get-a-get-request-exactly-same-as-using-chrome Updated user-agent form newest Chrome at 02-22-2021 Using a proxy tool like Charles Proxy really … Read more

Understanding Chrome network log “Stalled” state

Google gives a breakdown of these fields in the Evaluating network performance section of their DevTools documentation. Excerpt from Resource network timing: Stalled/Blocking Time the request spent waiting before it could be sent. This time is inclusive of any time spent in proxy negotiation. Additionally, this time will include when the browser is waiting for … Read more