I am trying to handle a request containing word "filter". For the time being, I am using the url as http://localhost:9997/filter=....
and parsing by using pathPrefix(fiter)
But url will change and becomes like http://localhost:9997/something../filter=
So here I can't take pathPrefix(). How can I handle this kind of path in routing so that any url containing "filter" keyword it can handle. I am very much new to akka spray. Please let me know about your opinions. Thanks in advance
If the string you want to match will always be at the end you can use "pathSuffix" (it might be enough for what you want)
But if it can be anywhere in the path, is not that straighforward. One way is using segments:
But it doesn't match if filter is at either end: "filter/blah/blah" nor "balh/blah/filter", but you can work around by matching with prefix and suffix. I suppose there's a better way, maybe with a custom directive.
Take a look at http://spray.io/documentation/1.2.3/spray-routing/predefined-directives-alphabetically/#predefined-directives