사실 심심하지는 않다. 스프링 3.1의 내용을 추가한 토스3 개정판 원고를 쓰느라 저녁과 주말의 개인시간을 모두 바쳐야 하는 폐인 생활을 하고 있을 뿐.

아무튼 @RequestMapping에 들어가는 7가지 조건의 조합을 정리하다 보니 이런 내용은 간단한 퀴즈로 만들면 재밌겠다 싶다.

컨트롤러의 @RequestMapping 설정을 보고 hello() 라는 메소드가 호출되게 할 수 있는 HTTP 요청의 개수가 얼마나 될지 세어보는 간단 문제.

먼저 간단한 샘플.

public class MyController {
  @RequestMapping({“/a”, “/b”})
  public void hello() {}

이 컨트롤러의 hello 메소드가 실행되게 만들 수 있는 HTTP 요청 조건은 2가지다. URL이 /a 인 경우와 /b인 경우. 물론 나머지 조건(파라미터, 요청 메소드, 헤더 등등)은 어떻든 상관없고.

이제 실전 문제.

@RequestMapping({“/a”, “/b”})
public class MyController {
  @RequestMapping({“/c”, “/d”})
  public void hello() {}

@RequestMapping(params={“a”, “b”})
public class MyController {
  @RequestMapping(params={“c”, “d”})
  public void hello() {}

@RequestMapping(headers={“a”, “b”})
public class MyController {
  @RequestMapping(headers={“c”, “d”})
  public void hello() {}

@RequestMapping(headers={“a”, “Content-Type=application/json”, “Content-Type=multipart/form-data”})
public class MyController {
  @RequestMapping(headers={“c”, “d”})
  public void hello() {}


@RequestMapping(headers={“a”, “b”})
public class MyController {
  @RequestMapping(headers={“c”, “d”, “Content-Type=application/json”}, consumes=”multipart/form-data”)
  public void hello() {}


@RequestMapping(consumes={“application/xml”, “application/x-www-form-urlencoded”})
public class MyController {
  @RequestMapping(consumes={”multipart/form-data”, “application/json”})
  public void hello() {}

1번부터 6번까지 컨트롤러의 hello() 메소드를 실행하게 만드는 HTTP 요청의 가짓수는 각각 몇개일까?

1,2,3번은 쉽고, 4,5,6번은 각 요청 조건의 결합 특성을 바르게 알고 있으면 어렵지 않다. 문제를 가능한 쉽게 만들기 위해서 한번에 나오는 조건의 종류는 최소화 했고, 인터페이스나 수퍼 클래스에 붙은 @RM의 경우도 안 넣었다.

코멘트에 답 주시는 분 중에서 정답자를 뽑아서 다음 달에 할까 하는 토스3 독자모임/세미나에 참가 우선권을 드리도록 하겠다.

아.. 아무도 관심이 없을지도. 원고나 쓰러 가야지.

Related posts:

  1. Inside Spring (6) 애노테이션 설정 지원 스프링 웹 테스트용 DispatcherServlet 만들기
  2. Spring ROO 대충대충 분석 (2) ROO란 무엇인가?
  3. Spring 상식퀴즈 (1) – DI 태클하기
  4. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (2)
  5. 토비의 스프링 3 간략 목차
  6. 스프링 빈의 이름은 한글로 지어도 된다
  7. Spring 3.0 (58) Static Class를 XML없이 빈으로 등록하기
  8. Spring ROO 대충대충 분석 (3) ROO의 Inter-type declaration
  9. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (1)
  10. 미리 보는 Spring 3.0.1의 변경사항
  11. 유쾌한 이슈처리 재촉 메일
  12. 스프링 3.1 (8) web.xml 없는 스프링 개발
  13. [토스3] 매핑 가능한 BeanPropertySqlParameterSource
  14. Spring 3.0 @MVC 메소드에서 자동으로 리턴 모델에 추가되는 것들
  15. S1A 2008 셋째날 – Spring JavaConfig

Facebook comments:

to “스프링 3.1 (10) 심심풀이 @RequestMapping 요청 조건 퀴즈”

  1. I love what you guys tend to be up too. Such clever work and exposure!
    Keep up the excellent works guys I’ve added you guys to
    my personal blogroll.

  2. whoah this blog is excellent i love studying your articles.

    Stay up the great work! You recognize, many persons are searching round for this
    info, you could aid them greatly.

  3. If you want to take a good deal from this article then you have to apply these techniques
    to your won weblog.

  4. Can I simply say what a comfort to discover somebody that genuinely knows what they are talking about over the internet.
    You definitely realize how to bring an issue to light
    and make it important. A lot more people must look at this and understand this side of your story.
    I can’t believe you are not more popular because you certainly have the gift.

  5. Thankfulness to my father who shared with me about this
    website, this website is in fact awesome.

  6. This is really interesting, You are a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of
    your fantastic post. Also, I’ve shared your site
    in my social networks!

  7. I have been exploring for a little bit for any high quality articles or weblog posts
    in this kind of house . Exploring in Yahoo I eventually stumbled upon this site.
    Reading this information So i am glad to exhibit that I have a
    very excellent uncanny feeling I discovered just what
    I needed. I most definitely will make certain to don?t fail to remember this website and
    give it a look regularly.

  8. Like!! Great article post.Really thank you! Really Cool.

  9. Hey I am so delighted I found your web site, I really found you by mistake, while I
    was searching on Yahoo for something else, Anyhow I am here now and
    would just like to say thank you for a fantastic post and a all round exciting blog
    (I also love the theme/design), I don’t have time to browse it all at the minute but I
    have book-marked it and also included your RSS feeds, so
    when I have time I will be back to read much more, Please do keep
    up the superb job.

  10. It’s going to be ending of mine day, but before ending I am reading this fantastic paragraph to
    improve my know-how.

  11. Aw, this was an extremely good post. Spending some time and actual effort to produce a good article… but what can I say… I put things off a whole lot and don’t manage to get
    nearly anything done.

  12. I enjoy what you guys are up too. This sort of clever work and reporting!
    Keep up the great works guys I’ve you guys to my
    own blogroll.

  13. I couldn’t refrain from commenting. Very well written!

  14. I am regular reader, how are you everybody? This piece of
    writing posted at this website is in fact nice.

  15. Great post. I was checking continuously this blog and I’m impressed!
    Very helpful info specially the last part :) I care for such information a lot.
    I was seeking this certain information for a very long time.
    Thank you and good luck.

  16. I relish, lead to I discovered exactly what I used to be looking for.
    You have ended my 4 day long hunt! God Bless you man. Have
    a nice day. Bye

  17. I simply could not leave your site before suggesting that I
    extremely loved the usual info an individual supply on your visitors?

    Is going to be back continuously in order to investigate
    cross-check new posts

  18. It’s the best time to make some plans for the future and it is time to
    be happy. I have read this post and if I could I desire to suggest you some interesting things or suggestions.
    Maybe you could write next articles referring to this article.
    I desire to read more things about it!

  19. Wow, that’s what I was looking for, what a data! existing here at this weblog, thanks admin of this site.

  20. I’m no longer certain where you are getting your information, however
    great topic. I needs to spend a while finding out
    much more or working out more. Thanks for excellent info I
    used to be looking for this information for my mission.

  21. Hi, I do think this is a great site. I stumbledupon it ;) I may return once again since I bookmarked it.
    Money and freedom is the best way to change,
    may you be rich and continue to guide other people.

  22. WOW just what I was searching for. Came here by searching for 성남출장만남

  23. I believe everything said made a lot of sense. But, what about this?
    what if you added a little content? I mean, I don’t want to tell you how to run your website,
    but what if you added something to maybe grab people’s attention? I mean 스프링 3.1 (10) 심심풀이 @RequestMapping 요청 조건 퀴즈 »
    Toby's Epril is kinda boring. You ought to glance at Yahoo’s home page and
    note how they create news titles to grab viewers to open the links.
    You might add a video or a related picture or two to grab people interested about everything’ve got to say.
    Just my opinion, it might bring your blog a little bit more

  24. I need to to thank you for this excellent read!! I certainly enjoyed every little bit of
    it. I’ve got you saved as a favorite to look at new things you

  25. Hmm it looks like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say,
    I’m thoroughly enjoying your blog. I too am an aspiring
    blog writer but I’m still new to everything. Do you have any
    points for newbie blog writers? I’d genuinely appreciate it.

  26. Hello friends, its enormous piece of writing about teachingand completely
    explained, keep it up all the time.

  27. I’ll immediately clutch your rss as I can not in finding your e-mail subscription link or newsletter service.
    Do you’ve any? Please permit me know so that I could subscribe.

  28. Excellent pieces. Keep writing such kind of information on your blog.
    Im really impressed by it.
    Hello there, You’ve done a great job. I’ll definitely digg it and personally suggest to my friends.
    I am sure they’ll be benefited from this website.

  29. Unquestionably believe that which you stated. Your favorite justification seemed to be on the internet
    the simplest thing to be aware of. I say to you, I definitely get irked
    while people think about worries that they just do not know about.

    You managed to hit the nail upon the top and also defined out the whole
    thing without having side effect , people can take a signal.
    Will probably be back to get more. Thanks

  30. I know this web page provides quality depending content and additional stuff,
    is there any other web site which offers these stuff in quality?

  31. Fantastic post however , I was wanting to
    know if you could write a litte more on this subject?
    I’d be very grateful if you could elaborate a little bit further.

    Bless you!

  32. I know this if off topic but I’m looking into starting my own weblog and was curious what all is required
    to get setup? I’m assuming having a blog like yours would cost
    a pretty penny? I’m not very internet smart so I’m
    not 100% certain. Any recommendations or advice would be
    greatly appreciated. Many thanks

Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha