Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:09:26+00:00 2026-06-06T04:09:26+00:00

Having a method like this: @GET @Path(/name/{name}) @Produces(MediaType.TEXT_PLAIN) public String getProperty(@PathParam(name) String name) {

  • 0

Having a method like this:

@GET @Path("/name/{name}")
@Produces(MediaType.TEXT_PLAIN)
public String getProperty(@PathParam("name") String name) {
        System.out.println(name);
}

How do I pass a value like “test./test”?

/name/test./test     gives HTTP 404
/name/test.%2Ftest   gives HTTP 400
/name/test.%252Ftest prints test%2Ftest

But if I do name = URLDecoder.decode(name); it prints /test and the first part of test. disappears.

There is one or two questions like this already but they are old and there was no good solution found, I thought I’ll ask again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:09:28+00:00Added an answer on June 6, 2026 at 4:09 am

    The pattern in the @Path annotation is internally turned into a regular expression, with the template parts matching only selected characters by default. In particular, they normally don’t match / characters; that’s almost always the right thing to do (as it lets you put templates part way through a path) but in this case it isn’t as you’re wanting to consume the whole subsequent path. To get everything, we have to override the regular expression fragment for that particular template; this is actually pretty easy, since we just put in the template fragment a : followed by the RE that we want to use:

    @GET @Produces(MediaType.TEXT_PLAIN)
    @Path("/name/{name:.+}")
    public String getProperty(@PathParam("name") String name) {
        return name;
    }
    

    This will match all characters after the /name/ (up to but not including any ? query part) but will only match if there’s something there at all. Be aware that if you have any other @Path("/name/...") things about, things can get really confusing! So don’t do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having this method: public Boolean isCorrect() { return correct; } I can't write: @XmlType(propOrder
Can I dynamically call an object method having the method name as a string?
I'm having the following code: @Path(stores) class StoreResources { private ServerConfig config; @GET public
I'm having a little trouble with something. I have an HttpGet method like this:
Instead of having an add() method in the repository, I would like to overload
I'd like to get the currently executing NUnit test in a helper method I'm
I've got a prototype having a method I can add callbacks with: /* *
I am using custom row view in ListView widget. I am having getView method
I am having using onActivityResult method in my ParentActivity and i call a ChildActivity
Having an assembly which I cannot modify (vendor-supplied) which have a method returning an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.