/*
 * Copyright 2015-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.docksidestage.app.web.wx.response.json;

import java.time.LocalDate;

import javax.annotation.Resource;

import org.docksidestage.app.web.base.FortressBaseAction;
import org.docksidestage.app.web.base.view.DisplayAssist;
import org.lastaflute.web.Execute;
import org.lastaflute.web.login.AllowAnyoneAccess;
import org.lastaflute.web.response.JsonResponse;
import org.lastaflute.web.validation.Required;

/**
 * @author jflute
 */
@AllowAnyoneAccess
public class WxResponseJsonAction extends FortressBaseAction {

    @Resource
    private DisplayAssist displayAssist;

    // http://localhost:8151/fortress/wx/response/json
    @Execute
    public JsonResponse<MyBasicJsonBean> index() {
        return asJson(new MyBasicJsonBean(3, "sea", displayAssist.toDate("2001-09-06").get()));
    }

    // http://localhost:8151/fortress/wx/response/json/emptybody
    @Execute
    public JsonResponse<Void> emptybody() {
        return JsonResponse.asEmptyBody();
    }

    public static class MyBasicJsonBean {

        @Required
        public final Integer memberId;
        @Required
        public final String memberName;
        public final LocalDate birthdate;

        public MyBasicJsonBean(Integer memberId, String memberName, LocalDate birthdate) {
            this.memberId = memberId;
            this.memberName = memberName;
            this.birthdate = birthdate;
        }
    }
}

@@ -1584,24 +1584,395 @@
 y();%0A    %7D%0A%0A
+    // http://localhost:8151/fortress/wx/response/json/strval%0A    @Execute%0A    public JsonResponse%3CString%3E strval() %7B // contentType=application/json%0A        return asJson(%22sea%22);%0A    %7D%0A%0A    // http://localhost:8151/fortress/wx/response/json/intval%0A    @Execute%0A    public JsonResponse%3CInteger%3E intval() %7B // contentType=application/json%0A        return asJson(7);%0A    %7D%0A%0A
     public s

add strval()