<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 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
    本來(lái)tapesty5有很精確的錯(cuò)誤提示,但是我的怎么就沒(méi)有了呢?
    后來(lái)在網(wǎng)上找到這樣一句話:
    tapestry5有個(gè)production-mode,默認(rèn)的為true,可以在作為產(chǎn)品發(fā)布時(shí),提供精簡(jiǎn)的錯(cuò)誤信息,在開發(fā)時(shí),異常信息當(dāng)然是越精確越好,而且精確的異常信息也是tapestry的強(qiáng)項(xiàng),可以很準(zhǔn)確的告訴您錯(cuò)誤出在哪里,所以在開發(fā)時(shí)這個(gè)選項(xiàng)要關(guān)掉,選中運(yùn)行配置中的arguments標(biāo)簽,在vm
    arguments中添加-Dtapestry.production-mode=false

    出處:http://tapestry.javaeye.com/blog/191803

    我于是在jvm arguments中添加了-Dtapestry.production-mode=false,果然可以了!!謝謝這位仁兄!



    //////////////////////////////////////////////////////////////////////////////////
    上述問(wèn)題的另外解決方法:不在jvm中添加參數(shù),而是在service包下增加下面這個(gè)文件:


    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");//有了這句就不用加jvm arguments了
            
            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);
        }
    }



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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 久久亚洲精品无码av| 亚洲国产美女福利直播秀一区二区| 国产精品亚洲一区二区麻豆| 99国产精品视频免费观看| 亚洲Av无码专区国产乱码DVD| 亚欧乱色国产精品免费视频| 久久久久一级精品亚洲国产成人综合AV区| 亚洲hairy多毛pics大全| 国产精品二区三区免费播放心| 亚洲熟妇AV乱码在线观看| 免费鲁丝片一级在线观看| 最新亚洲卡一卡二卡三新区| 热久久精品免费视频| 国产亚洲美女精品久久| 日韩亚洲精品福利| 久久精品成人免费观看97| 好看的电影网站亚洲一区| 99久在线国内在线播放免费观看| 亚洲视频免费一区| 中文字幕无码成人免费视频| 亚洲熟妇无码一区二区三区| 国产91久久久久久久免费| 男女拍拍拍免费视频网站| 久久噜噜噜久久亚洲va久| xxxxx免费视频| 亚洲精品自偷自拍无码| 亚洲高清免费视频| 久久国产免费一区二区三区| 亚洲中文字幕无码av在线| 国产在线19禁免费观看国产| igao激情在线视频免费| 亚洲专区先锋影音| 免费特级黄毛片在线成人观看| 曰韩无码AV片免费播放不卡| 亚洲日本中文字幕| 国产精品国产午夜免费福利看| 中文字字幕在线高清免费电影| 亚洲人成片在线观看| 亚洲精品人成无码中文毛片 | 国产成人亚洲综合a∨| 亚洲日本va在线视频观看|