• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which is the best approach for URL creation

 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to understand the best approach to form a URL. Right now I have two approaches,



or

I can use a pattern to achieve the same.


Can you tell me which is the best approach to follow? And it would be really helpful to know more approaches to this URL generation.


Thanks in Advance...
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by a "pattern", but in any case neither of them is the best approach (note that your first approach puts too many slashes between the host and path parts, for example). Here's the best approach:
 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul, Thanks for your suggestion.

I don't know what you mean by a "pattern"


I was actually referring to using Message Formatter (java.text) for this.

I have one problem with your suggestion. The code you mentioned above will be effective if it runs only a few times. But in my case, it runs more than 100 times per minute; and when each time the code runs, it generates different jsp names (This is more of a business logic - so do not worry about why different names for a jsp ).

So, creating URL object for each jsp name does not seems to be a better approach. Please let me know if you have any other thought?


Regards,
Zahid
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic