-
Apr 28th, 2012, 10:23 AM
#1
How to have "/" forward slash in @RequestMapping ?
Hi,
I have a requirement where the id I use in @RequestMapping accept a value of the format “1234567812345678” and “abcxyz/abcxy+z$” (basically a auto generated string with “/” forward slash in it).
I have tried a mapping of all the 3 below formats but nothing works:
@RequestMapping(value="abc/action/{id: .+[//]*.*}.{format}", method=RequestMethod.PUT) -- Accepts nothing.
@RequestMapping(value=" abc/action/{id:.+}.{format}", method=RequestMethod.PUT) -- Accepts everything except ‘/’
@RequestMapping(value=" abc/action/{id:.*}.{format}", method=RequestMethod.PUT) -- Accepts everything except ‘/’
However, when I try the same regex in a normal java program, it works like a charm :
package miscellenousTest;
public class RegExTest {
public static void main(String[] args) {
String s1 ="9876543298765432";
String s2 =" abcxyz/abcxy+z$";
System.out.println(s1.matches(".+[//]*.*"));
System.out.println(s2.matches(".+[//]*.*"));
}
}
I have gone through some of the previous posts but nothing gives me the exact solution I am looking for.
It will be great if someone can throw some pointers/solution at this one.
Last edited by deepinjava; Apr 28th, 2012 at 11:26 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules