• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to know if it is a servlet or folder

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have an interesting question:

I have the following link:

http://www.somesite.com/news/topic

Now there are 2 possibilities:

1. There is a servlet called "topic"
2. "topic" is a folder name and which actually has one of the following file: index.jsp/index.html/index.htm

The question is:
How do I know the actual folder name?
In case 1, the folder name is "news"
In case 2, the folder name is "topic"

Now in the page there is an image with the following html:
<img src="hi.jpg">
How does browser know if it is
http://www.somesite.com/news/hi.jpg
or
http://www.somesite.com/news/topic/hi.jpg

Thanks.
 
Ranch Hand
Posts: 31
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The Servlet's name can be /news/topic too. It depends of servlet mapping in Deployment Descriptor...
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you think that website will be showing their original web Application structure to you ??

Never , these may be all false names , this is internally done with Directory Hosting or on to FrontController in the Application.
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you talking from a developer's point of view or a hacker's point of view (i have answers for both but i need you to choose one before i proceed)
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll never know what's behind a URL. An URL like http://www.somesite.com/news/topic/hi.jpg may cause the image to be generated dynamically, without there ever being a file called "hi.jpg" anywhere, or a directory named "news/topic".
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try ans check the response headers,
if they contain a last modified and created values,
you can make a guess if its a dynamic content or static
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't said it in a long time, but: A file server is not a web server.

EVERY URL request that comes into a web application server is parsed by the framework, using the web.xml file for guidance. If the URL patterns in web.xml indicate that the URL addresses a servlet, that request will be passed to the indicated servlet. Otherwise, the application container will use the part of the URL that comes after the context but before the query as a path to a resource inside the WAR. And just as a reminder, a WAR isn't necessarily a set of files and directories. In its official form, it's a ZIP file containing a resource directory that can be - but doesn't have to be - exploded into a set of files and directories.

On the client side, there's no way to tell WHAT will be done to a URL inside the server. It may even end up rewritten. For example, in JSF, a "/admin/myPage.jsf" might end up pulling in an "/admin.xhtml" resource to actually build the response. Even a simple "/images/myPic.gif" could end up being rewritten to convert a JPEG resource located in a completely different directory tree into a returned GIF data stream.
 
Bageshwar Pratap Narain
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if they contain a last modified and created values,



you can re-request for the resource and check if http 304 is returned,
which means content not modified.
 
zan zang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thanks for all the reply,

I think I will end up with just consider the absolute path of hi.jpg as
http://www.somesite.com/news/topic/hi.jpg

The reason is if the page html set the path of the imag as
src="hi.jpg"

That's mean resource "hi.jpg" (No matter it is a static file or dynamically generated) is available on
http://www.somesite.com/news/topic/hi.jpg

If not, I believe that a "X" will be displayed on the browser and I don't think the web developer will like that before they publish the site.
 
reply
    Bookmark Topic Watch Topic
  • New Topic