Reading weblogic.xml properties


We're using weblogic 8.1 sp3.  In our weblogic.xml we have something like this:

  </session-descriptor>
    <session-param>
      <param-name>CookieName</param-name>
      <param-value>EBKLXQ</param-value>
    </session-param>
  </session-descriptor>

How do we get the name/value parid for CookieName in a Java servlet?

Thx.

jkabx
jkavxAsked:
Who is Participating?
 
petmagdyCommented:
yes u can use a code like this:

          System.out.println("/WEB-INF/weblogic.xml");
          ServletContext serv = this.getServlet().getServletContext();
          InputStream inputStream = getServlet().getServletContext().getResourceAsStream("/WEB-INF/weblogic.xml");
          System.out.println("/WEB-INF/weblogic.xml");

          System.out.println(inputStream.available());
       //   System.out.println(url.getFile());
          BufferedInputStream bufferedInput;
          bufferedInput = new BufferedInputStream(inputStream);
          byte[] buffer = new byte[bufferedInput.available()];
          bufferedInput.read(buffer);
          System.out.println(buffer.length);
          String str = new String(buffer);
          System.out.println(str);


and with any xml parser u can get the value u want

Cheers
0
 
jkavxAuthor Commented:

Sorry.  How do we get the name/value pair for CookieName in a Java servlet?
0
 
ECollinCommented:
hi,

following a little code sample to see how to retreive cookies from a servlet


Cookie[] cookies = request.getCookies();

for(int i=0; i<cookies.length; i++) {
      Cookie cookie = cookies[i];
      String name = cookie.getName();
      String value = cookie.getValue();
       ...
    }


Emmanuel
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.