package com.lnwazg.main.ctrl;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.CharEncoding;

import com.lnwazg.httpkit.anno.BasePath;
import com.lnwazg.httpkit.controller.Controller;
import com.lnwazg.httpkit.mime.MimeMappingMap;

@BasePath("/base")
public class FirstController extends Controller
{
    void index()
    {
        Person person = new Person();
        person.age = "18";
        person.name = "hudson";
        List<Person> list = new ArrayList<>();
        for (int i = 0; i < 5; i++)
        {
            list.add(person);
        }
        person = new Person();
        person.name = getParam("fff");
        list.add(person);
        
        //        okJson(GsonHelper.gson.toJson(list));
        //        okJson(list);
        //        okJson(new FrontObj().success().setData(list));
        //        okJson(success(list));
        //        okJson(fail(list));
        //        okJson(fail(list,10002,"转换错误"));
        okJson(fail(10002, "转换错误"));
        //        okJson(fail(10003));
    }
    
    void index2()
    {
        okFile(new File("c:\\1.jpg"));
    }
    
    void index3()
    {
        ok("index3");
    }
    
    void index4()
    {
        okJson(MimeMappingMap.mimeMap);
    }
    
    void index5()
    {
        okJson(CharEncoding.UTF_8);
    }
    
    public static class Person
    {
        String name;
        
        String age;
    }
}

@@ -730,32 +730,63 @@
 on);%0D%0A        %0D%0A
+        ok(%22You are great!%22);%0D%0A
         //      
@@ -1051,32 +1051,42 @@
 0002,%22%E8%BD%AC%E6%8D%A2%E9%94%99%E8%AF%AF%22));%0D%0A
+        //
         okJson(f

Update FirstController.java