Skip to content
Advertisement

How to get the custom HTTP request header in server end by Java

I have a simple Google cloud function to receive the InputStream via an HTTP request.

JavaScript

I can get the content type and input stream correctly.

However, there is also some other information, such as a SourceFileName sent in the HTTP request header from the client. I am wondering how can I get this custom header value?

I’m a .NET developer and it is very easy for me to get it in .NET:

JavaScript

Could anyone tell me how can I get it in Java?

Advertisement

Answer

You can use getHeaders method like that

JavaScript
Advertisement