Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6753697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:11:36+00:00 2026-05-26T13:11:36+00:00

Simple question really. Can a webapp access a config file I define and put

  • 0

Simple question really. Can a webapp access a config file I define and put at the Tomcat->Conf sort of level, or am I restricted to web.xml environment variables alone?

I suspect the answer is no as it would probably be rather dangerous for a webapp to access anything outside the webapp directory.

I don’t want to use web.xml as I don’t want any possibility of this config getting into a production environment. It should reside purely in my dev tomcat instance. (It’s just a flag to allow me to bypass certain functionality which, in dev, is extremely slow and not critical to include)

This is a java/jsp webapp btw.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:11:36+00:00Added an answer on May 26, 2026 at 1:11 pm

    Can a webapp access a config file I define and put at the Tomcat->Conf sort of level, or am I restricted to web.xml environment variables alone?

    You can put config files everywhere you want. You just need to know its exact location, then you can use one of zillion ways in Java to read resources. Canonical approach is to put it in the classpath or to add its path to the classpath, so that you can just read it from the classpath by the class loader. For more detail, see also this answer.


    I suspect the answer is no as it would probably be rather dangerous for a webapp to access anything outside the webapp directory.

    It’s only dangerous if the client can control/change this behaviour by manipulating HTTP requests accordingly. With properly designed servlets, this shouldn’t be possible.


    I don’t want to use web.xml as I don’t want any possibility of this config getting into a production environment.

    I’m not sure if I understand your concern. By default, clients won’t be able to see web.xml file (actually, the whole /WEB-INF and /META-INF folders are restricted from direct access by clients). Only when you’ve a badly configured/written default servlet, then chances are there that clients will be able to download and see web.xml file.


    It should reside purely in my dev tomcat instance. (It’s just a flag to allow me to bypass certain functionality which, in dev, is extremely slow and not critical to include)

    I think it’s a bad idea to download config files from a remote location. This way everyone else can see your config files. You’d need to serve it over HTTPS and put login based access restriction on it. This all is plain clumsy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question really... How can I copy a ReadOnly file? When running a debug
This is a really simple question, but I can't seem to find the answer.
I've got a really simple rails question here but I can't seem to find
I have what is probably a really simple, studid question but I can't find
I know it's a simple question but I really can't find anything on Google.
I have a really simple question, yet I can't find an answer for it.
Really simple question. I'm on Ubuntu 9.04 (I'm new to Ubuntu) and I can't
This is probably a really simple question but I can't seem to find anything
I have a simple question about sending a file (XML file) from my webapp
Real simple question really. I need to read a Unicode text file in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.