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 6243339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:07:18+00:00 2026-05-24T12:07:18+00:00

I have a REST web service that I would like to take a URL

  • 0

I have a REST web service that I would like to take a URL as a parameter

Something along the lines of:

Example call: http://myserver.com/myService/http://www.website.com/files/myfile.docx

The original server mapping was:

 @RequestMapping(value="/myService/{url}", method=RequestMethod.GET)

Obviously calling this with any URL that has “/”‘s in breaks the mapping to the web service.

I have tried using a regex for a URL in the mapping

@RequestMapping( value="/getBase64/<\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]>", method=RequestMethod.GET )

but this didn’t seem to work either.

Does @RequestMapping support regex like this or should I simply replace “\”‘s in the parameter with another symbol and then convert back at the server?

  • 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-05-24T12:07:19+00:00Added an answer on May 24, 2026 at 12:07 pm
    http://myserver.com/myService/http://www.website.com/files/myfile.docx
    

    It’s not RFC-compliant URL so I’d not expect it to work.
    You should send an ID of site (that’s true restful way). I think that if you want to send URL as string parameter (maybe you can send hashcode instead?) the only way to do it is without http:// scheme and escape slashes properly (not sure if it will work).

    The best way however, if you must send and URL in a form that you mentioned (http://website.com/blablabla) is to send POST request and your parameter as a form param (identically as in case of a standard HTTP form).

    import javax.ws.rs.POST;
    import javax.ws.rs.FormParam;
    import javax.ws.rs.Path;
    
    // (...)
    
        @POST
        @Path("/myservice/")
        public Response myService(@FormParam("url") final String url) {
          LOG.debug(String.format("Received URL: %s", url));
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a service that I would like expose both via rest and
I have Camel route that I would like to expose as a REST Web
I have a REST web service that currently exposes this URL: http://server/data/media where users
I have to map a REST Webservice URL like http://server:8080/application/service/customer/v1 to createCustomer method in
I have a REST service that returns a JSON like this: [{@id:123,name:Name}] and I'm
I have a web service I would like to consume with Javascript. I've tried
I would like to build a simple REST web service (using Ruby on Rails).
I have a serializable dictionary that I created for a WCF REST web service
I have a REST web service that returns a structure containing an array of
I have created a REST web service and successfully used it with a client.

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.