This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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: 43011
76
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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 '?'.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!