title: Spring servlet-mapping
body: <p>friends.
  I'm not good at English. Please Understand it.</p>
  
  <p>I was asked to make a xml file.</p>
  
  <p>When I access below address with a browser. I should see below xml.
  <strong>http://localhost:8080/update/update.jsp</strong></p>
  
  <pre><code>&lt;update_info app_name="ktp_app" version="2012031001" count=""&gt;
    &lt;apache_start version="20120310011255" type="bat" reg="123123" size="423"&gt;
    &lt;remote&gt;http://192.168.0.1/ka/apache_start.bat&lt;/remote&gt;
    &lt;remote&gt;apache_start.bat&lt;/remote&gt;
    &lt;/apache_start&gt;
  &lt;/update_info&gt;
  </code></pre>
  
  <p>but, in web.xml
  I have this setting.</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.byto&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>with above, I could process all my other request with spring controller which look like this.</p>
  
  <pre><code>@Controller
  public class DownloadManageController {
  
      @Autowired
      private DownloadManageService downService;
  
      @RequestMapping("/ajax/add_download_hour")
      public void addDownloadHour(HttpServletRequest request, HttpServletResponse response) throws IllegalArgumentException, SecurityException, InvalidHourRangeException, IOException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
          downService.addDownloadLimit(
              request.getParameter("app_cmd"),
              request.getParameter("start_hour"),
              request.getParameter("end_hour"), 
              request.getParameter("limit_count"));
      }
      ...
  }
  </code></pre>
  
  <p>But I also have this controller.</p>
  
  <pre><code>@Controller
  public class UpdateXmlController extends HttpServlet {
  
      @Autowired
      private UpdateXmlService updateService;
  
      @RequestMapping("/update")
      protected ModelAndView getUpdateData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String cmd = request.getParameter("cmd");
          Map resultMap = null;
          PrintWriter writer = response.getWriter();
          try {
              resultMap = updateService.getUpdateData(cmd);
              request.setAttribute("server", resultMap.get("server"));
              request.setAttribute("package", resultMap.get("package"));
              request.setAttribute("file", resultMap.get("file"));
          } catch(NoCmdException ex) {
              return new ModelAndView("error_page", "errorMsg", ex.getMessage());
          } catch(DownloadCountExceedException ex) {
              return new ModelAndView("error_page", "errorMsg", ex.getMessage());
          } catch(Exception ex) {
              //System.out.println(ex.getMessage());
              //response.getWriter().write();
              ex.printStackTrace();
          }
  
          return new ModelAndView("update", "result", resultMap);
      }
  
  }
  </code></pre>
  
  <p>which i need to access with <strong>http://localhost:8080/update/update.jsp</strong> .</p>
  
  <p>But, I only way to access that controller is with <a href="http://localhost:8080/update/update.byto" rel="nofollow">http://localhost:8080/update/update.byto</a></p>
  
  <p><strong>So, here's my QUESTION</strong></p>
  
  <p>how could I access that controller with .jsp address.</p>
  
  <p>thanks a lot.</p>