aspose file tools*
The moose likes Ranch Office and the fly likes URLs without any extension Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "URLs without any extension" Watch "URLs without any extension" New topic
Author

URLs without any extension

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
In our website, we are having urls like

www.mywebsite.com/XYZ/login.htm. The point is they have extension like .htm.

While JR has url like

http://www.coderanch.com/forums/f-50/JSP

I am wondering if there is any significant benefit of having urls like JR.

Thank you.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The only reason to have file extensions would be if you're serving actual files, and the server determines the type of file based on the file name. For the Ranch URL you cite, there is no actual file -- the page is generated dynamically by a servlet. It's not that there's a file with no extension, it's that there's no filename involved at all.


[Jess in Action][AskingGoodQuestions]
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
Ernest Friedman-Hill wrote:For the Ranch URL you cite, there is no actual file -- the page is generated dynamically by a servlet.


Yes, servlet would fetch the data but , no JSP atall for page structure and populating data?

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

In the Saloon, nope. No JSPs. Freemarker templates.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Saurabh Pillai wrote:
Ernest Friedman-Hill wrote:For the Ranch URL you cite, there is no actual file -- the page is generated dynamically by a servlet.


Yes, servlet would fetch the data but , no JSP atall for page structure and populating data?



That's not what was said. A servlet responds with HTML. How that HTML is rendered is besides the point; whether it is JSP, Freemarker, etc. The point is, a request was sent to a servlet, not a file.


GenRocket - Experts at Building Test Data
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Right. And it's better not to exposure your choice of implementation language in the URL anyway. That way you can change it without changing URLs.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
Gregg Bolinger wrote:The point is, a request was sent to a servlet, not a file.


Hello Gregg, if you map login.htm to LoginSevlet then also request is sent to servlet. And it is also possible to have virtually any url in order to hide server side framework.

I was just curious, if this type of urls http://www.coderanch.com/forums/posts/quote/0/2445384 add any benefit?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

Saurabh Pillai wrote:Yes, servlet would fetch the data but , no JSP atall for page structure and populating data?

Even if JSPs were used, a properly structured web application will not show the .jsp extension because the JSPs will be hidden behind a forward.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Saurabh Pillai wrote:I was just curious, if this type of urls http://www.coderanch.com/forums/posts/quote/0/2445384 add any benefit?


They are semantic. Jeanne pointed out the main advantage.

The advantage the extension had (sic past tense), besides when serving static files: Broken servers and clients (i.e. browsers) treated a document by extension, not by content type. So in earlier times some browsers would offer you to save a file instead of presenting it because the browser didn't know what to do with it without extension. Oh, and there where some server that determined the content type by extension and set it "automagically" so you didn't have to care for that. One of the situations where it would have been better to let the system fail so the cause gets fixed.

Broken clients, broken servers. Long time gone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLs without any extension