Dec 12, 2013

Spring @RequestMethod Double Slashes

Ran into a painful issue with Spring-3.0.5's @RequestMethod not handling double slashes. It absorbs single slashes in urls as well!

package com.jostens.spring3template.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Test of spring's handling of double slashes
 * 
 * @see http://webmasters.stackexchange.com/questions/8354/what-does-the-double-slash-mean-in-urls
 */
@Controller
public class SlashTestController {
 @RequestMapping(value = "/productDetail/{param1}/{param2}/{param3}", method = RequestMethod.GET)
 @ResponseBody
 public String slashTest1(HttpServletRequest request,
   @PathVariable String param1, @PathVariable String param2,
   @PathVariable String param3) throws Exception {
  return "slashTest1\n"
   + request.getServletPath() + "\n"
   + "param1[" + param1 + "]\n" + "param2[" + param2 + "]\n" + "param3[" + param3 + "]\n";
 }

 @RequestMapping(value = "/productDetail/{param1}//{param3}", method = RequestMethod.GET)
 @ResponseBody
 public String slashTest2(HttpServletRequest request,
   @PathVariable String param1, @PathVariable String param3)
   throws Exception {
  String param2 = "-";
  return "slashTest2\n"
   + request.getServletPath() + "\n"
   + "param1[" + param1 + "]\n" + "param2[" + param2 + "]\n" + "param3[" + param3 + "]\n";
 }

 @RequestMapping(value = "/productDetail/{param1}/{param2}", method = RequestMethod.GET)
 @ResponseBody
 public String slashTest3(HttpServletRequest request,
   @PathVariable String param1, @PathVariable String param2)
   throws Exception {
  return "slashTest3\n"
   + request.getServletPath() + "\n"
   + "param1[" + param1 + "]\n" + "param2[" + param2 + "]\n";
 }
}

Logged as SPR-11220 RequestMapping maps double-slashes to single slashes.

Orgel Klang Elektro Tanz

I like the fonts used on Orgel Klang Elektro Tanz
Maria Alternate & Cg Triplet Is Maria the same as Maria Alternate? Nice Alternatives to helvetica.

Dec 2, 2013

Ross' Soviet Poster

«Чтобы строить — надо знать. Чтобы знать — надо учиться»

From here. Not really bold or angular enough to be considered Konstructivism. Yet a good engineering education statement, "To build, you need to know. To know you need to study."