• 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

Stripes 2.5.1 - Is colon allowed in the URLBinding to map variables?

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
I'm back again with an issue in Stripes. I need to support a different URL structure where users can pass parameters, to query, in the URL itself.The structure is as next:
[http://mydomain.com/find: term1+term2+...]. My bean class was previously having @UrlBinding ("/find"); How do I get the mapping of this new URL "/find:term1+term2+..."? Kindly suggest.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Couldn't you just use something like "/find?query=term1+term2+..."?
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,
Yes ofcourse...but the project requirement was specified with that URL type. If there's no way at all, the I have go back to the team & propose the new URL. Let me the feasibility of having the colon in URL.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The "?" is part of the HTTP URL specification.

Also from the spec :



So, no - an unescaped ':' can't appear in the path component of a valid HTTP URL.
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
It makes sense what you are saying. I also checked the "HTTP URL specification". It has "=", ":" etc as reserved characters. Now the http url allows "=" in it in the "/url?serach=term" structure, as we know. Hence isn't there any possibility that ":" also would be taken someway!!!
Just a thought. Thanks for your reply.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that's because he mentions that the URL spec doesn't cover query strings - here's the section -


Query strings

The question mark ("?", ASCII 3F hex) is used to delimit the boundary between the URI of a queryable object, and a set of words used to express a query on that object. When this form is used, the combined URI stands for the object which results from the query being applied to the original object.
Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded. This method was used to make query URIs easier to pass in systems which did not allow spaces.

The query string represents some operation applied to the object, but this specification gives no common syntax or semantics for it. In practice the syntax and sematics may depend on the scheme and may even on the base URI.



So the "?" has to be there to mark the start of the query string, if it's left out, it's part of the path (which the URL spec does cover) - but the query string itself isn't defined in this document. (It actually is in the httpaddress grammar as "search" and is defined as alphanumerics and '+' - but I think this is just to emphasize that you should use + instead of spaces in the URL...)

So *query strings* can contain some reserved characters that other parts of the URL cannot - equals are used to separate name/value pairs; I've seen ':' used when a value is an http address; etc. - but they have to start with a '?'.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic