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

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

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

먼저 간단한 샘플.

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

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

이제 실전 문제.

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

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

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

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

 

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

 

6.
@Controller
@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. At this moment I am going away to do my breakfast, later
    than having my breakfast coming over again to read additional news.

  2. It’s really a great and helpful piece of information. I am happy that you just shared this useful info with us.
    Please stay us informed like this. Thanks for sharing.

  3. Some truly good articles on this website, thank you for contribution.

  4. Hi there it’s me, I am also visiting this web page daily, this
    web site is truly pleasant and the visitors are really sharing pleasant thoughts.

  5. It’s very effortless to find out any matter on net as compared to textbooks, as I found this post at this web page.

  6. FIFA55BOY
    FIFA55 BOY เว็บไซต์แทงบอลออนไลน์และเดิมพันกีฬาอย่างเป็นทางการจาก FIFA55 วางเดิมพันบอลผ่านระบบออนไลน์ภาษาไทยตลอด 24 ชม. ที่มีผู้ใช้งานเยอะที่สุด รวมรวมทุกรูปแบบการแทงบอลไม่ว่าจะเป็น บอลเดี่ยว (บอลเต็ง) บอลชุด สเต็ป
    2 – 12 คู่ พร้อมด้วยกีฬาหลายประเภท ตัวอย่างเช่น บาส มวย เทนนิส ให้คุณได้ร่วมลุ้นกันอย่างจุใจในเว็บเดียว ทั้งยังมีคาสิโนออนไลน์ให้เลือกเล่นมากมายอีกด้วย

  7. You can certainly see your skills in the paintings you write.
    The arena hopes for more passionate writers
    such as you who are not afraid to mention how they believe.

    All the time go after your heart.

  8. Hi there, I discovered your blog by way of Google while searching for a comparable matter, your site came up,
    it looks good. I have bookmarked it in my google bookmarks.

  9. Touche. Great arguments. Keep up the great work.

  10. It’s very easy to find out any topic on web as compared to books, as I found this piece of writing at this web site.

  11. Hello there, I discovered your website via Google at the same time as searching for a similar subject, your site got here up,
    it seems to be good. I have bookmarked it in my google bookmarks.

  12. You can certainly see your skills in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how
    they believe. Always go after your heart.

  13. Very interesting topic, thank you for putting up.

  14. Hmm is anyone else encountering problems with the images on this blog
    loading? I’m trying to find out if its a problem on my end
    or if it’s the blog. Any responses would be greatly appreciated.

  15. Very clear website, thank you for this post.

  16. I just could not leave your web site prior to suggesting that I extremely enjoyed
    the standard info an individual provide to your guests?
    Is gonna be again continuously in order to inspect new posts

  17. Srbija Oglasi | Besplatni oglasi Srbija
    Besplatni oglasi srbija ,licni oglasi,automobili, nekretnine,nudi vam mogućnost da postavite neograničen broj malih oglasa i budete među najboljima.

  18. I don’t even know how I ended up here, but I thought this
    post was great. I do not know who you are but definitely you’re going to a famous blogger
    if you aren’t already ;) Cheers!

    Feel free to visit my web page – http://www.facecool.com/profiles/blogs/address-here-10 (Alex)

  19. bookmarked!!, I like your site!

  20. I am really glad to glance at this website posts which includes lots of valuable data, thanks for providing these data.

  21. Please let me know if you’re looking for a article author for your weblog.
    You have some really great posts and I feel I
    would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for
    a link back to mine. Please shoot me an email if
    interested. Thank you!

  22. Hi would you mind stating which blog platform you’re using?
    I’m planning to start my own blog soon but I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking for
    something unique. P.S My apologies for getting off-topic but I had to ask!

  23. May I simply say what a relief to uncover a person that
    actually knows what they’re discussing on the web. You
    actually know how to bring a problem to light and make it important.
    A lot more people must read this and understand this side of your
    story. I was surprised you are not more popular since you certainly have the gift.

  24. Hey, you used to write wonderful, but the last several posts have been kinda boring…
    I miss your great writings. Past several
    posts are just a little bit out of track! come on!

  25. The One S is pre-shipped սsing the latеst Android Iteration tһе Ice Cream Sandwich.
    Ιf yoᥙ are cᥙrrently hаppy usinjg tһe top features оf the HTC Sensation, іt is not vital
    to download the update аnd you’ll maintain your current ѵersion of Android.
    Уou can run twice the amount ᧐f apps and OS functions about
    the handset yet stіll not notice a loss of performance.

    Ꭲake a looҝ at mу web blog :: core i5

  26. Oh my goodness! Awesome article dude! Thanks,
    However I am encountering troubles with your RSS.
    I don’t know the reason why I can’t subscribe to it.
    Is there anyone else having identical RSS issues? Anyone that knows the solution will you kindly respond?
    Thanks!!

  27. magnificent submit, very informative. I’m wondering why
    the opposite specialists of this sector do not notice
    this. You must continue your writing. I’m confident, you have a great readers’ base already!

  28. whoah this weblog is excellent i really like reading your posts.
    Keep up the good work! You know, lots of people are
    searching around for this information, you could help them greatly.

  29. Having read this I believed it was extremely informative.
    I appreciate you finding the time and energy to put this information together.
    I once again find myself personally spending a lot of time both reading and posting comments.
    But so what, it was still worth it!

  30. I was suggested this website by means of my
    cousin. I am not sure whether this put up is written via him as nobody else realize
    such targeted approximately my problem. You are amazing!

    Thank you!

  31. Hello! This is my 1st comment here so I just wanted to
    give a quick shout out and tell you I genuinely enjoy
    reading through your articles. Can you suggest any
    other blogs/websites/forums that cover the same topics?
    Thanks a ton!

  32. Heya i’m for the primary time here. I found this board and I find It truly useful
    & it helped me out a lot. I hope to present one thing back and help others like you helped me.

  33. Hello, I log on to your blogs on a regular basis. Your humoristic style is awesome, keep it up!

  34. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up!

    I’ll go ahead and bookmark your website to come back in the
    future. Many thanks

  35. We stumbled over here coming from a different web page and
    thought I might check things out. I like what I see so now
    i’m following you. Look forward to going over your web page repeatedly.

  36. Please let me know if you’re looking for a article author for your
    weblog. You have some really great posts and I believe
    I would be a good asset. If you ever want to take some of
    the load off, I’d absolutely love to write some content for your blog in exchange for a link back to mine.
    Please send me an email if interested. Cheers!

  37. These new PlayStation two games are extremely lifelike.

    Have a look at my site … 리니지프리서버

  38. I conceive you have remarked some very interesting points, regards
    for the post.

  39. I genuinely enjoy reading on this web site, it has wonderful articles.

  40. My husband and i felt so thankful John could finish up his preliminary research
    using the precious recommendations he got out of your web site.
    It is now and again perplexing to just be giving freely ideas that the
    rest might have been making money from. And we grasp we have
    you to give thanks to because of that. All of the illustrations you
    made, the easy site navigation, the friendships you can aid to create – it’s all remarkable, and it’s aiding our son in addition to the family consider
    that the subject matter is interesting, which is certainly
    seriously pressing. Thank you for all the pieces!

  41. I’m not sure where you are getting your info, but great topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for wonderful information I was looking for this information for my mission.

  42. Hello to every body, it’s my first pay a
    visit of this web site; this webpage carries awesome and truly excellent stuff for visitors.

  43. Wow, that’s what I was seeking for, what a data! existing here at this website, thanks admin of this
    site.

Leave a Reply to Normand Cancel reply

(required)

(required)

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