java - Reading a properties file in Servlet -


To read the attribute file in my servlet using the code below I getClass.getClassLoader () I would like to get clarity about GetResourceAsStream (...) line.

From my understanding, getClassLoader () will add class loader to the servlet class I have defined but how is it propFileName ?

  Properties is associated with PRO = new properties (); String profile name = "config.properties"; InputStream inputstream = getClass (). GetClassLoader (). GetResourceAsStream (propFileName); prop.load (InputStream); String User = Propetepti ("GOOGLE_CLIENT_ID"); String ID = Prop. Apt ("GOOGLE_REDIRECT_URL"); Public InputStream getResourceAsStream (string name)  

The parameter " Name "should be an" absolute "path for the file, so that it can open InputStream and its example can be found in the Properties.load (inputStream) method. Could be disturbed

> This is clearly mentioned in the Java API. Please take a look at this:

Hope it helps!

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -