1

Can someone please tell me why my email address is getting cut.. for testing we use email address like [email protected]

I have the following code:

@RequestMapping(value = "/profilenumber/{email}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<String> getProfileNumber(@PathVariable String email, ModelMap model) throws ResourceNotFoundException
{
    logger.debug("Looking for Profile Number for: " + email);
}

The output of my logger.debug is [email protected] we are losing the .dev which we need. Can someone please tell me why we would be losing it

Java have this in my WebConfig but it does not help

@Bean
    public DefaultAnnotationHandlerMapping defaultAnnotationHandlerMapping ()
    {
        DefaultAnnotationHandlerMapping b = new DefaultAnnotationHandlerMapping();

        b.setUseDefaultSuffixPattern(false);
        return b;
    }
user2428795
  • 547
  • 6
  • 11
  • 26

2 Answers2

3

I fixed it but change the code to the following:

@RequestMapping(value = "/profilenumber/{email:.+}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<String> getProfileNumber(@PathVariable String email, ModelMap model) throws ResourceNotFoundException
{
    logger.debug("Looking for Profile Number for: " + email);
}

It looks like thats all I had to do

user2428795
  • 547
  • 6
  • 11
  • 26
1

If you are using spring 3.0.x add the following to your spring config file:

<!-- Spring Configuration needed to avoid URI using dots to be truncated -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    <property name="useDefaultSuffixPattern" value="false" />
</bean>

if you are using a more recent version of spring check this discussion: Spring MVC @PathVariable with dot (.) is getting truncated

Spring default configuration cuts off extensions in urls.

Community
  • 1
  • 1
Farid
  • 2,265
  • 18
  • 14