package example.u2ware.springfield.part2.step2;
import lombok.Getter;
import lombok.Setter;
import com.u2ware.springfield.config.Springfield;
import com.u2ware.springfield.config.Springfield.Strategy;
@Springfield(
strategy=Strategy.DTO,
methodLevelMapping={
"*","*.do",
"findForm.json","findForm.xml","findForm.xls",
"read.json","read.xml","read.xls"
},
identity={"code"},
attributesCSV=
"webmvc.view.method.findForm={custom}," +
"webmvc.view.extension.none={jstlView}," +
"webmvc.view.extension.do={thymeleafView}"
//"webmvc.view.springfield={springfield3}"
)
public class ViewBean {
private @Getter @Setter Integer code;
private @Getter @Setter String name;
}
Springfield 의 EntityController 의 각 메소드는 다음과 같은 규칙으로 View Name 을 리턴한다.
/{topLevelMapping}/{methodName}[.{extension}]
| HTTP | Method | 예제 매핑 경로 | 리턴된 view name |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
| GET | findForm | /part2/step2 | "/part2/step2/findForm" |
| GET | findForm | /part2/step2.do | "/part2/step2/findForm.do" |
| GET | findForm | /part2/step2.json | "/part2/step2/findForm.json" |
| GET | findForm | /part2/step2.xml | "/part2/step2/findForm.xml" |
| GET | findForm | /part2/step2.xls | "/part2/step2/findForm.xls" |
| POST | find | /part2/step2 | "/part2/step2/find" |
| POST | find | /part2/step2.do | "/part2/step2/find.do" |
| GET | read | /part2/step2/7 | "/part2/step2/read" |
| GET | read | /part2/step2/7.do | "/part2/step2/read.do" |
| GET | read | /part2/step2/7.json | "/part2/step2/read.json" |
| GET | read | /part2/step2/7.xml | "/part2/step2/read.xml" |
| GET | read | /part2/step2/7.xls | "/part2/step2/read.xls" |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
Springfield 가 제공하는 각 ViewResolver 들은 먼저, EntityController 로 부터 결정된 View Name 을 설정에 맞게 변경한다.
@Springfield 의 attributesCSV 속성에서 선언된 webmvc.view.method.XXX 값중 해당 View Name 에서 매치하여 변경한다.
| HTTP | Method | 예제 매핑 경로 | 변경된 view name |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
| GET | findForm | /part2/step2 | "/part2/step2/custom" |
| GET | findForm | /part2/step2.do | "/part2/step2/custom.do" |
| GET | findForm | /part2/step2.json | "/part2/step2/custom.json" |
| GET | findForm | /part2/step2.xml | "/part2/step2/custom.xml" |
| GET | findForm | /part2/step2.xls | "/part2/step2/custom.xls" |
| POST | find | /part2/step2 | "/part2/step2/list" |
| POST | find | /part2/step2.do | "/part2/step2/list.do" |
| GET | read | /part2/step2/7 | "/part2/step2/edit" |
| GET | read | /part2/step2/7.do | "/part2/step2/edit.do" |
| GET | read | /part2/step2/7.json | "/part2/step2/edit.json" |
| GET | read | /part2/step2/7.xml | "/part2/step2/edit.xml" |
| GET | read | /part2/step2/7.xls | "/part2/step2/edit.xls" |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
attributesCSV 에 선언하지 않으면 @Springfield 의 기본설정을 따른다.
webmvc.view.method.home=home
webmvc.view.method.findForm=list
webmvc.view.method.find=list
webmvc.view.method.createForm=edit
webmvc.view.method.create=refresh
webmvc.view.method.read=edit
webmvc.view.method.updateForm=edit
webmvc.view.method.update=refresh
webmvc.view.method.delete=refresh
Springfield 가 제공하는 각 ViewResolver 들은 확장자가 일치하면 Rendering 한다.
@Springfield 의 attributesCSV 속성에서 선언된 속성에서 선언된 webmvc.view.extension.XXX 값중 해당 확장자와 매치하여 View Resolver 를 연결한다.
| HTTP | Method | 예제 매핑 경로 | 결정된 view resolver |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
| GET | findForm | /part2/step2 | jstlView |
| GET | findForm | /part2/step2.do | thymeleafView |
| GET | findForm | /part2/step2.json | jsonView |
| GET | findForm | /part2/step2.xml | xmlView |
| GET | findForm | /part2/step2.xls | xlsView |
| POST | find | /part2/step2 | jstlView |
| POST | find | /part2/step2.do | thymeleafView |
| GET | read | /part2/step2/7 | jstlView |
| GET | read | /part2/step2/7.do | thymeleafView |
| GET | read | /part2/step2/7.json | jsonView |
| GET | read | /part2/step2/7.xml | xmlView |
| GET | read | /part2/step2/7.xls | xlsView |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
attributesCSV 에 선언하지 않으면 @Springfield 의 기본설정을 따른다.
webmvc.view.extension.none=tilesView
webmvc.view.extension.download=downloadView
webmvc.view.extension.stream=streamView
webmvc.view.extension.json=jsonView
webmvc.view.extension.xml=xmlView
webmvc.view.extension.xls=xlsView
webmvc.view.extension.jstl=jstlView
webmvc.view.extension.tiles=tilesView
webmvc.view.extension.thymeleaf=thymeleafView