question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vert.x Routes Wrong Behaviour when using hyphens (-) in params

See original GitHub issue

Describe the bug When using a route with param names that includes hyphen characters:

@Route(methods = HttpMethod.GET, path = "/path/:my-param")
boolean myRoute(@Param("my-param") String param) {
    return true;
}

If we call our route, we will get a HTTP 404 Not Found error.

Now, if we change our route to get rid of hyphens:

@Route(methods = HttpMethod.GET, path = "/path/:myParam")
boolean myRoute(@Param("myParam") String param) {
    return true;
}

Everything works fine now.

Expected behavior If there is a strong technical reason to not support hyphens, this should be documented. However, I think it should be supported. And for sure, not return HTTP Not Found 404 status.

Actual behavior It returns HTTP Not Found 404 status.

Environment (please complete the following information):

  • Quarkus version or git rev: 1.12.0.Final

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
pmlopescommented, Mar 1, 2021

Hi @Sgitario The issue here was that vert.x was not allowing the - symbol to be part of a variable name as it used a regular expression that mimicks the java variable naming rules. I’ve created a PR to address this and allow it:

:([A-Za-z][A-Za-z0-9_-]*)

A variable must start with a letter and have a sequence of letters, numbers or _ and -. I guess the rule could be even more relaxed to support more characters but as it gets more complex it may also introduce a parsing tax on performance.

1reaction
mkoubacommented, Mar 2, 2021

Ok, I misunderstood the concept of path parameters. My understanding was that a path param always represents a path segment. A subtle clarification in the docs would be helpful 😉.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vert.x Core Manual
Vert.x will then route them to just one of the handlers registered at that address. ... Use params to return the parameters of...
Read more >
Why Vertx doesn't allow query parameters based Routers
Vertx only allows defining routes/handlers based on path, not based on query parameters. I am wondering if it's intentional. Due to nature of...
Read more >
Management & Monitoring - Micronaut Documentation
Micronaut is a modern, JVM-based, full stack Java framework designed for building modular, easily testable JVM applications with support for Java, Kotlin, and ......
Read more >
PDF - Citrus Reference Guide
call some operation log() in the middle of our Java DSL test. ... @CitrusResource tells Citrus to inject this parameter with the according...
Read more >
TextView - Android Developers
android:gravity, Specifies how to align the text by the view's x- and/or y-axis when ... android:hyphenationFrequency, Frequency of automatic hyphenation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found