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 7832545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:16:48+00:00 2026-06-02T12:16:48+00:00

Given that we use the code below Set paths = servletCtxt.getResourcePaths(/app/themes); How can we

  • 0

Given that we use the code below
Set paths = servletCtxt.getResourcePaths(“/app/themes”);

How can we tell if the path in paths is directory or a actual file?

This would usually be in an zipped war.

What I did find is this, but I am betting it isn’t reliable:

When it is a file

servletCtxt.getResource(dir).getContent()
    returned (java.io.ByteArrayInputStream) java.io.ByteArrayInputStream@5a645a64

When it is a directory it returned:

(org.apache.naming.resources.FileDirContext) org.apache.naming.resources.FileDirContext@57155715

Is it safe to say that I could use a instanceof with InputStream on what is returned by getContent?

Thanks

  • 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-06-02T12:16:50+00:00Added an answer on June 2, 2026 at 12:16 pm

    Without testing I see the following in the JavaDoc of getResourcePaths():

    Paths indicating subdirectory paths end with a /.

    […]

    For example, for a web application containing:

    • /welcome.html

    • /catalog/index.html

    • /catalog/products.html

    • /catalog/offers/books.html

    • /catalog/offers/music.html

    • /customer/login.jsp

    • /WEB-INF/web.xml

    • /WEB-INF/classes/com.example.OrderServlet.class

    • /WEB-INF/lib/catalog.jar!/META-INF/resources/catalog/moreOffers/books.html

    getResourcePaths("/") would return {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}, and getResourcePaths("/catalog/") would return {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/", "/catalog/moreOffers/"}.

    Seems like you can simply rely on the last character of the path.

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

Sidebar

Related Questions

What regular expression can I use (if any) to validate that a given string
I use the below code to assign a given by the user character to
What algorithm would you use to create an application that given appropriate data (list
I was given an static library (.a extension file) that I have to use
Given that I don't know at deployment time what kinds of system my code
Given the image below, what algorithm might I use to detect whether regions one
Given the test case below how can I: Sort the IList<TestObject> based on the
I currently use WebFaction for my hosting with the basic package that gives us
Is it possible to use COUNT in some way that will give me the
Given that EVAL is Evil how do I create an Array name dynamically: I

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.