File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLs without any extension

 
Saurabh Pillai
Ranch Hand
Posts: 524
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saurabh Pillai
Ranch Hand
Posts: 524
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Saloon, nope. No JSPs. Freemarker templates.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saurabh Pillai
Ranch Hand
Posts: 524
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64202
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic