<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 48, comments - 13, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    tapestry5中中文問題

    Posted on 2009-03-04 10:38 董銳 閱讀(900) 評論(1)  編輯  收藏
    <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>加上面這句才支持中文</title>
    </head>
    <body>
    加上面這句才支持中文
    </body>
    </html>


    /////////////////////////////////


    import java.io.IOException;

    import org.apache.tapestry5.*;
    import org.apache.tapestry5.ioc.MappedConfiguration;
    import org.apache.tapestry5.ioc.OrderedConfiguration;
    import org.apache.tapestry5.ioc.ServiceBinder;
    import org.apache.tapestry5.ioc.annotations.Local;
    import org.apache.tapestry5.services.Request;
    import org.apache.tapestry5.services.RequestFilter;
    import org.apache.tapestry5.services.RequestHandler;
    import org.apache.tapestry5.services.Response;
    import org.slf4j.Logger;

    /**
     * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
     * configure and extend Tapestry, or to place your own service definitions.
     */
    public class AppModule
    {
        public static void bind(ServiceBinder binder)
        {
            // binder.bind(MyServiceInterface.class, MyServiceImpl.class);
           
            // Make bind() calls on the binder object to define most IoC services.
            // Use service builder methods (example below) when the implementation
            // is provided inline, or requires more initialization than simply
            // invoking the constructor.
        }
       
       
        public static void contributeApplicationDefaults(
                MappedConfiguration<String, String> configuration)
        {
            // Contributions to ApplicationDefaults will override any contributions to
            // FactoryDefaults (with the same key). Here we're restricting the supported
            // locales to just "en" (English). As you add localised message catalogs and other assets,
            // you can extend this list of locales (it's a comma separated series of locale names;
            // the first locale name is the default when there's no reasonable match).
           
            configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,zh_cn");

            // The factory default is true but during the early stages of an application
            // overriding to false is a good idea. In addition, this is often overridden
            // on the command line as -Dtapestry.production-mode=false
            configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
           
            configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "false");
            configuration.add(SymbolConstants.CHARSET, "UTF-8");//有了這句不知是不是可以不要用上面那句了,還沒試過
            
        }
       

        /**
         * This is a service definition, the service will be named "TimingFilter". The interface,
         * RequestFilter, is used within the RequestHandler service pipeline, which is built from the
         * RequestHandler service configuration. Tapestry IoC is responsible for passing in an
         * appropriate Logger instance. Requests for static resources are handled at a higher level, so
         * this filter will only be invoked for Tapestry related requests.
         *
         * <p>
         * Service builder methods are useful when the implementation is inline as an inner class
         * (as here) or require some other kind of special initialization. In most cases,
         * use the static bind() method instead.
         *
         * <p>
         * If this method was named "build", then the service id would be taken from the
         * service interface and would be "RequestFilter".  Since Tapestry already defines
         * a service named "RequestFilter" we use an explicit service id that we can reference
         * inside the contribution method.
         */   
        public RequestFilter buildTimingFilter(final Logger log)
        {
            return new RequestFilter()
            {
                public boolean service(Request request, Response response, RequestHandler handler)
                        throws IOException
                {
                    long startTime = System.currentTimeMillis();

                    try
                    {
                        // The responsibility of a filter is to invoke the corresponding method
                        // in the handler. When you chain multiple filters together, each filter
                        // received a handler that is a bridge to the next filter.
                       
                        return handler.service(request, response);
                    }
                    finally
                    {
                        long elapsed = System.currentTimeMillis() - startTime;

                        log.info(String.format("Request time: %d ms", elapsed));
                    }
                }
            };
        }

        /**
         * This is a contribution to the RequestHandler service configuration. This is how we extend
         * Tapestry using the timing filter. A common use for this kind of filter is transaction
         * management or security. The @Local annotation selects the desired service by type, but only
         * from the same module.  Without @Local, there would be an error due to the other service(s)
         * that implement RequestFilter (defined in other modules).
         */
        public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
                @Local
                RequestFilter filter)
        {
            // Each contribution to an ordered configuration has a name, When necessary, you may
            // set constraints to precisely control the invocation order of the contributed filter
            // within the pipeline.
           
            configuration.add("Timing", filter);
        }
    }


    評論

    # re: tapestry5中中文問題  回復(fù)  更多評論   

    2013-03-15 13:46 by suifeng
    tapetry5 中 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    經(jīng)過測試上面這個語句是必須加的。。
    并且還不能在注釋中加中文 若加了 照樣報錯

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 免费吃奶摸下激烈视频| 黄网址在线永久免费观看 | 久久久久久国产精品免费免费男同 | 久久乐国产综合亚洲精品| 96免费精品视频在线观看| 亚洲国产综合精品中文第一区 | 美女黄色免费网站| 日韩免费a级在线观看| 亚洲色精品三区二区一区| 天天摸天天碰成人免费视频| 亚洲欧美国产国产一区二区三区| 天天操夜夜操免费视频| 国产成人va亚洲电影| 亚洲一级特黄大片无码毛片| 国产99久久久久久免费看| 亚洲精品无码MV在线观看| 国产好大好硬好爽免费不卡| 亚洲高清视频在线播放| 成人毛片免费视频| 日本中文字幕免费看| 亚洲国产AV无码专区亚洲AV| 最近免费中文在线视频| 久久精品国产亚洲AV忘忧草18| 日韩视频免费在线| 一本久久A久久免费精品不卡| 国产AV无码专区亚洲精品| 亚洲黄色免费电影| 亚洲国产高清国产拍精品| 亚洲裸男gv网站| 久久久久久久岛国免费播放| 亚洲一级免费毛片| 亚洲av无码成人精品区| 十八禁视频在线观看免费无码无遮挡骂过 | 国产a不卡片精品免费观看| 久久一区二区三区免费| 91亚洲国产成人久久精品网站| 男人的好看免费观看在线视频| 黄床大片30分钟免费看| 亚洲丝袜美腿视频| 国产成人精品高清免费| 最近2019中文免费字幕在线观看|