• 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

Which is the best approach for URL creation

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic