NutzCN Logo
问答 Nb的静态资源只能放在template下嘛?
发布于 2311天前 作者 蛋蛋的忧伤 1635 次浏览 复制 上一个帖子 下一个帖子
标签:

默认demo里的静态资源放在了template,没问题,正常可以访问,但是我将template改名为static就报错了,是必须放在template下嘛?

[DEBUG] 10:33:58.447 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/index : MainLauncher.index(MainLauncher.java:15)
[DEBUG] 10:33:58.448 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:163) - Get 'mainLauncher'<class io.nutz.demo.simple.MainLauncher>
TEMPLATE_LOAD_ERROR
	at org.beetl.core.resource.ClasspathResource.openReader(ClasspathResource.java:74)
	at org.beetl.core.GroupTemplate.loadTemplate(GroupTemplate.java:633)
	at org.beetl.core.GroupTemplate.getTemplateByLoader(GroupTemplate.java:583)
	at org.beetl.core.GroupTemplate.getTemplate(GroupTemplate.java:547)
	at org.beetl.ext.web.WebRender.render(WebRender.java:85)
	at org.beetl.ext.nutz.BeetlView.render(BeetlView.java:28)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:159)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:530)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
	at java.lang.Thread.run(Thread.java:748)
[DEBUG] 10:33:58.455 org.beetl.ext.nutz.LogErrorHandler.processExcption(LogErrorHandler.java:32) - null
>>10:33:58:错找不到指定模板或者加载错(TEMPLATE_LOAD_ERROR): 位于0行 资源:/index.html
ClassLoader:sun.misc.Launcher$AppClassLoader@18b4aac2 Path:template


18 回复

静态资源是 static目录, template是模板目录

为啥https://get.nutz.io/ 的代码里的模板页面都放在static里了呢...

做maker的时候, 一个模板引擎都还没有, 忘记改了

是不是想访问某个页面都必须写一个入口方法做中转?但是index.html除外是吧

放在 static下面的文件都能直接访问的

我想使用哪个starter就直接引入包就可以了,不需要其他配置对吧? 当然排除application.properties里的一些配置,还有shiro.ini ?

shiro.ini也不是必须的

那指定shiro采用什么session缓存,怎么生成sessionid,怎么配置几个url啥的,不在shiro.ini还能在哪里?

我看到可以搞定Realm

subject.login(new SimpleShiroToken(user.getId()));

那有没有办法搞定其他的呀?

new NbApp().setPrintProcDoc(true).run();

你会看到很多配置项

话说... urls节点忘记做了

这些都是在application.preperties里配置的嘛? 怎么没看到shiro的?

[INFO ] 11:35:31.597 org.nutz.boot.NbApp._run(NbApp.java:182) - Configure Manual:
|id  |key                                     |required  |Possible Values     |Default   |Description         |                                starters|
|----|----------------------------------------|----------|--------------------|----------|--------------------|----------------------------------------|
|0   |druid.web.filter.exclusions             |no        |                    |          |需要排除的路径             |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|1   |druid.web.filter.principalCookieName    |no        |                    |          |用户权限信息的cookie属性名称   |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|2   |druid.web.filter.principalSessionName   |no        |                    |          |用户权限信息的session属性名称  |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|3   |druid.web.filter.profileEnable          |no        |                    |          |是否开启性能监控            |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|4   |druid.web.filter.realIpHeader           |no        |                    |          |Header中ReadIp对应的key |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|5   |druid.web.filter.sessionStatEnable      |no        |                    |true      |是否开启session状态监控     |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|6   |druid.web.filter.sessionStatMaxCount    |no        |                    |          |session最大状态数量       |org.nutz.boot.starter.jdbc.DruidWebStatFilterStarter|
|7   |druid.web.servlet.allow                 |no        |                    |          |允许访问的ip列表           |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|8   |druid.web.servlet.deny                  |no        |                    |          |禁止访问的ip列表           |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|9   |druid.web.servlet.jmxPassword           |no        |                    |          |JMX的密码              |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|10  |druid.web.servlet.jmxUrl                |no        |                    |          |读取JMX信息的URL         |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|11  |druid.web.servlet.jmxUsername           |no        |                    |          |JMX的用户名             |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|12  |druid.web.servlet.loginPassword         |no        |                    |随机值,打印在日志中|访问monitor页面的密码      |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|13  |druid.web.servlet.loginUsername         |no        |                    |driud     |访问monitor页面的用户名     |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|14  |druid.web.servlet.resetEnable           |no        |                    |true      |是否允许重置统计结果          |org.nutz.boot.starter.jdbc.DruidWebStatServletStarter|
|15  |jdbc.password                           |no        |                    |          |数据库密码               |org.nutz.boot.starter.jdbc.DataSourceStarter|
|16  |jdbc.type                               |no        |druid,simple        |druid     |连接池类型               |org.nutz.boot.starter.jdbc.DataSourceStarter|
|17  |jdbc.url                                |yes       |                    |          |JDBC URL            |org.nutz.boot.starter.jdbc.DataSourceStarter|
|18  |jdbc.username                           |no        |                    |          |数据库用户名              |org.nutz.boot.starter.jdbc.DataSourceStarter|
|19  |jetty.contextPath                       |no        |                    |/         |上下文路径               |org.nutz.boot.starter.jetty.JettyStarter|
|20  |jetty.host                              |no        |                    |0.0.0.0   |监听的ip地址             |org.nutz.boot.starter.jetty.JettyStarter|
|21  |jetty.http.idleTimeout                  |no        |                    |300000    |空闲时间,单位毫秒           |org.nutz.boot.starter.jetty.JettyStarter|
|22  |jetty.maxFormContentSize                |no        |                    |1gb       |表单最大尺寸              |org.nutz.boot.starter.jetty.JettyStarter|
|23  |jetty.port                              |no        |                    |8080      |监听的端口               |org.nutz.boot.starter.jetty.JettyStarter|
|24  |jetty.threadpool.idleTimeout            |no        |                    |60000     |线程池idleTimeout,单位毫秒 |org.nutz.boot.starter.jetty.JettyStarter|
|25  |jetty.threadpool.maxThreads             |no        |                    |500       |线程池最大线程数maxThreads  |org.nutz.boot.starter.jetty.JettyStarter|
|26  |jetty.threadpool.minThreads             |no        |                    |200       |线程池最小线程数minThreads  |org.nutz.boot.starter.jetty.JettyStarter|
|27  |nutz.dao.interceptor.cache.cache4Null   |no        |                    |true      |是否缓存null结果          |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|28  |nutz.dao.interceptor.cache.debug        |no        |                    |false     |打印daocache详细调试日志    |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|29  |nutz.dao.interceptor.cache.enable       |no        |                    |false     |是否使用daocache        |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|30  |nutz.dao.interceptor.cache.enableWhenTrans|no        |                    |false     |事务内是否启用daocache     |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|31  |nutz.dao.interceptor.cache.provider.ioc.name|no        |                    |daoCacheProvider|daocache提供者DaoCacheProvider的IocBean名称|org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|32  |nutz.dao.interceptor.cache.provider.memory.cacheSize|no        |                    |          |daocache提供者MemoryDaoCacheProvider的默认缓存大小|org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|33  |nutz.dao.interceptor.cache.provider.type|no        |memory,ehcache,jedis,ioc|memory    |daocache提供者         |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|34  |nutz.dao.interceptor.cache.table.names  |no        |                    |          |需要缓存的表名称,英文逗号分隔     |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|35  |nutz.dao.interceptor.cache.table.pattern|no        |                    |          |需要缓存的表名称的正则表达式      |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|36  |nutz.dao.interceptor.log.enable         |no        |                    |true      |是否打印dao的SQL日志       |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|37  |nutz.dao.interceptor.time.enable        |no        |                    |false     |是否打印dao的SQL耗时日志     |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
|38  |nutz.dao.sqls.path                      |no        |                    |sqls/     |sql目录               |org.nutz.boot.starter.nutz.dao.NutDaoStarter|
[INFO ] 11:35:31.668 org.eclipse.jetty.util.log.Log.initialized(Log.java:192) - Logging initialized @1353ms to org.eclipse.jetty.util.log.Slf4jLog
[DEBUG] 11:35:32.236 org.nutz.resource.Scans.scan(Scans.java:280) - Found 3 resource by src( io/nutz/demo/simple/ ) , regex( ^.+[.]class$ )

那就忘记写@ProcDoc了, 到你发挥的时候了..

啊哈哈,我可以试一下,反正大叔也不嫌弃我 (。・ω・。)

参考JettyStarter就知道怎么写了

我给 ShiroEnvStarter类里加上了 @PropDoc注解,但是启动时怎么还是不打印....是需要实现某接口嘛?

没install?

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部