Open bagipriyank opened 6 years ago
Are you expecting
request.splat()[0]
->
good/golly/miss/molly
request.splat()[1]
->
luka
?
yes. that's what i expected after i saw https://github.com/perwendel/spark/issues/59#issuecomment-239677100
i see the issue is happening because of no backtracking while matching routes with wildcards.
Is this behavior intended?
the bigger problem is that /say/good/golly/miss/molly/to/luka
doesn't map to /say/*/to/*
I don't think it's intended, maybe @perwendel knows? I've marked it as a bug at least.
created https://github.com/perwendel/spark/pull/950/ to resolve this. please have a look.
any news on this? :)
any progress on this?
any update on this?
Hello
is @bagipriyank fix not merged due to issues with the pull, or just maintainer's capacity ?
thank you
@bagipriyank I find this pretty weird. I get what the purpose is and how it would work but I can't imagine why or when anyone would use URLs this way but I might be ignorant of the potenial use-cases.
@bagipriyank however, after looking at the discussion in #59 I understand a bit better. I'm still very interested in a use case where this would be useful so I can learn something.
@perwendel one place where we are using this is in our image processing service. we send the link to original images to the client, and then depending on what experience client is showing it can apply image processing commands and send a request to the server to generate the final image on the fly.
ex endpoint:
Spark.get("/idType/:idType/context/:context/id/:id/*/filters/*", processImage);
Spark.get("/*/filters/*", processImage);
ex requests
1. https://images.com/idType/a/context/homepage/id/b/flowers/sunflower.png/filters/blur
2. https://images.com/idType/a/context/homepage/id/b/https://flowers.com/hd/sunflower.png/filters/blur
3. https://images.com/flowers/sunflower.png/filters/blur
4. https://images.com/https://flowers.com/hd/sunflower.png/filters/blur
here splat[0] = flowers/sunflower.png
for 1 and 3 and splat[0] = https://flowers.com/hd/sunflower.png
for 2 and 4
we could have definitely tried extracting these things ourselves with in processImage method but this approach makes it much more cleaner
@perwendel any update on this?
get("/say/*/to/*", (request, response) -> request.splat()[0] + " " + request.splat()[1]);
if you pass
/say/good/golly/miss/molly/to/luka
it doesn't work. Instead ofrequest.splat()[0]
mapping togood/golly/miss/molly
andrequest.splat()[1]
mapping toluka
i get a 404.