사실 심심하지는 않다. 스프링 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. What’s up, I check your blogs on a regular basis. Your
    writing style is witty, keep doing what
    you’re doing!

  2. What’s up colleagues, how is the whole thing, and what you want
    to say about this paragraph, in my view its actually remarkable in support of me.

  3. Hi there very nice site!! Man .. Beautiful .. Superb .. I’ll bookmark your web site and take the feeds also…I’m satisfied to find so many useful info right here in the put up, we need work out more strategies in this regard, thanks for sharing. . . . . .

  4. A person necessarily help to make seriously articles I
    would state. That is the first time I frequented your web page
    and so far? I surprised with the analysis you made
    to create this particular put up extraordinary. Great process!

    My website :: download s128 apk

  5. Heya i am for the first time here. I came across this board and I
    find It truly useful & it helped me out much.

    I hope to give something back and aid others like you helped
    me.

  6. Wow, amazing weblog layout! How long have you ever
    been running a blog for? you make blogging glance easy. The overall look of
    your website is excellent, let alone the content!

  7. Just want to say your article is as surprising. The clearness in your post is just nice
    and i can assume you are an expert on this subject.
    Well with your permission allow me to grab your feed to keep updated with forthcoming post.

    Thanks a million and please keep up the rewarding work.

  8. hey there and thank you for your info – I’ve certainly picked up anything
    new from right here. I did however expertise a few technical points using this
    site, as I experienced to reload the site a lot of times previous to
    I could get it to load correctly. I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will sometimes affect your placement
    in google and could damage your high-quality score if advertising and marketing
    with Adwords. Well I’m adding this RSS to my e-mail and can look out for much more of your
    respective intriguing content. Ensure that you update this again soon.

  9. Suknia którą kupiłam na uroczystość ślubna była moją wymarzoną.

  10. Very energetic post, I enjoyed that a lot. Will there be a part 2?

  11. Hi there, constantly i used to check blog posts here in the early hours in the break of day, because i
    love to learn more and more.

  12. you’re in reality a good webmaster. The site loading velocity is amazing.
    It sort of feels that you’re doing any distinctive trick. In addition,
    The contents are masterpiece. you’ve performed a wonderful activity on this topic!

  13. below youll come across the link to some web-sites that we believe you ought to visit

  14. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get bought an edginess over that you wish
    be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly very often inside case you shield this hike.

  15. excellent points altogether, you just gained a new reader.
    What would you suggest about your submit that you simply made some
    days ago? Any certain?

  16. here are some links to web-sites that we link to for the reason that we assume they are really worth visiting

  17. Hey there, You have performed a great job. I’ll definitely digg it and personally suggest to
    my friends. I’m sure they will be benefited from this web site.

    Also visit my web-site; Wonderfull Keto Diet

  18. Great post. I was checking continuously this blog and I’m impressed!
    Very useful information specifically the last part :
    ) I care for such info much. I was seeking this particular information for a very long
    time. Thank you and best of luck.

    my web-site – Prache Anti Aging Cream

  19. Hi would you mind sharing which blog platform you’re using?
    I’m going to start my own blog soon but I’m having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and I’m looking for
    something completely unique. P.S Sorry for being off-topic but I had
    to ask!

  20. Asking questions are genuinely good thing if you are not understanding something completely,
    but this post offers nice understanding yet.

  21. Excellent, what a webpage it is! This web site presents
    helpful data to us, keep it up.

  22. Самое честное онлайн-казино гарантированно выплачивает выигрыши, однако его отзывы
    положительны, а софт качественный.

    Легальные casino оnline имеют ряд прав и обязанностей.

    В таких казино нет проблем с выводом денег на
    карту. Сертифицированные заведения
    дают гарантию для безопасность личных данных и выполняют обязательства перед клиентами.

    Чтобы составления рейтинга казино непременно
    создают оглавление с контролем
    честности. В нем находятся совершенно проверенные игорные залы.
    Нормальные casino отвечают предъявленным требованиям и характеризуются наравне честные заведения, которые платят
    выигрыш.
    Онлайн-казино открывают двери
    для вас, авантюристы, искатели приключений и романтики!

    Чтобы испытать свою удачу и сорвать взятка, не обязательно кататься в Лас-Вегас.
    Азарт и счастье ходят рядом.

    Давайте рассмотрим рейтинги лучших казино онлайн 2019.

    Мы поможем вам разобраться, как работает система онлайн-казино, выбрать лучшие заведения
    с реальными возможностями получить выигрыш.
    Мы расскажем вам о правилах поведения в виртуальном казино и объясним его принцип работы.
    В нашем обзоре собрана вся хотя о моментах работы казино,
    здесь собраны ответы на постоянно вопросы относительный
    гейминге. Описание каждого интересного казино и популярного игрового автомата поможет в расстановке приоритетов именно вашего пути.

    Новичку донельзя сложно сделать подбор, в каком онлайн-казино начать забавлять на деньги.
    Ведь каждая вывеска так красива, совет щедры и зрелище интересны.
    Для того воеже сделать законный избрание, надо пропускать настоящий обзор онлайн-казино.

    Составлением таких обзоров занимается общество профи, которые изучают специфику работы виртуальных казино,
    основываясь для отзывах игроков.
    Форум является местом общения игроков всего мира, благодаря чему о случае некачественной работы
    заведения alias обмана одновременно же
    станет известно огромному числу пользователей сети.

    Новичкам лучше забавлять для проверенных сайтах.

    Чтобы этого следует ввести в поиск запрос о топ онлайн-казино 2019 и выбрать план своего
    движения в пространстве и
    времени. Рейтинг заведений является главной направляющей в поиске честного онлайн-казино.
    Ради любителей программного обеспечения интересно довольно посетить казино с безупречной репутацией

  23. This is my first time go to see at here and i am really pleassant to read everthing at single place.

    Also visit my blog post … Sure Cleanse Keto

  24. This text is invaluable. When can I find out more?

  25. It is really a great and helpful piece of info. I am glad
    that you simply shared this useful information with us.
    Please keep us informed like this. Thanks for
    sharing.

  26. Hey I know this is off topic but I was wondering if you
    knew of any widgets I could add to my blog that automatically
    tweet my newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with
    something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your
    new updates.

  27. I have been browsing online greater than three hours lately, yet I by
    no means discovered any fascinating article like yours.
    It is beautiful worth enough for me. In my view, if all webmasters
    and bloggers made good content material as you probably did, the net will probably be much more helpful than ever before.

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

  29. I got this site from my pal who told me concerning
    this site and now this time I am browsing this website and reading very
    informative articles or reviews at this place.

  30. You could definitely see your expertise in the work you write.

    The world hopes for more passionate writers such as you who
    aren’t afraid to say how they believe. Always follow
    your heart.

  31. I’m not sure exactly why but this website is loading extremely slow for me.
    Is anyone else having this issue or is it a issue on my end?

    I’ll check back later on and see if the problem still exists.

Leave a 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