NutzCN Logo
问答 关于接口名字的问题。。。。
发布于 2592天前 作者 yangeejgs 1462 次浏览 复制 上一个帖子 下一个帖子
标签:
   <filter>
        <filter-name>nutz</filter-name>
        <filter-class>org.nutz.mvc.NutFilter</filter-class>
        <init-param>
            <param-name>modules</param-name>
            <param-value>org.nutz.MainModule</param-value>
        </init-param>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>/rs/*,/druid/*</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>*.action</url-pattern>
        <url-pattern>*.aspx</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

这样配置之后访问可以使用.action和.aspx
但是还想使用直接/的请求,可以兼容么?如何兼容

6 回复

filter-mapping可以写多个

@wendal 大神。。

 <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>*.action</url-pattern>
        <url-pattern>*.aspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

这样么配了以后直接用 / 访问还是404,去掉 *.action
*.aspx才会好,可是.action和.aspx也需要用。。。。

404?贴日志看看

welcome file写了什么?对应的文件加了没?

@wendal

E:\apache-tomcat-8.5.23\bin\catalina.bat run
[2017-11-17 09:55:49,463] Artifact monitor:war: Server is not connected. Deploy is not available.
Using CATALINA_BASE:   "C:\Users\yangyang\.IntelliJIdea2017.1\system\tomcat\Unnamed_monitor_4"
Using CATALINA_HOME:   "E:\apache-tomcat-8.5.23"
Using CATALINA_TMPDIR: "E:\apache-tomcat-8.5.23\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.8.0_151"
Using CLASSPATH:       "E:\apache-tomcat-8.5.23\bin\bootstrap.jar;E:\apache-tomcat-8.5.23\bin\tomcat-juli.jar"
Connected to the target VM, address: '127.0.0.1:63815', transport: 'socket'
17-Nov-2017 21:55:50.800 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.23
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Sep 28 2017 10:30:11 UTC
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.23.0
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_151\jre
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_151-b12
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\yangyang\.IntelliJIdea2017.1\system\tomcat\Unnamed_monitor_4
17-Nov-2017 21:55:50.803 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         E:\apache-tomcat-8.5.23
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\yangyang\.IntelliJIdea2017.1\system\tomcat\Unnamed_monitor_4\conf\logging.properties
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63815,suspend=y,server=n
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\yangyang\.IntelliJIdea2017.1\system\tomcat\Unnamed_monitor_4
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=E:\apache-tomcat-8.5.23
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=E:\apache-tomcat-8.5.23\temp
17-Nov-2017 21:55:50.804 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_151\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;D:\app\oracle32;D:\app\oracle\product\12.1.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jre7\bin;E:\software\Maven\apache-maven-3.2.5\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;E:\Git\cmd;C:\Users\yangyang\AppData\Local\Microsoft\WindowsApps;;.]
17-Nov-2017 21:55:50.929 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8888"]
17-Nov-2017 21:55:50.950 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
17-Nov-2017 21:55:50.962 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
17-Nov-2017 21:55:50.964 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
17-Nov-2017 21:55:50.965 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 567 ms
17-Nov-2017 21:55:50.998 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
17-Nov-2017 21:55:50.998 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
17-Nov-2017 21:55:51.021 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8888"]
17-Nov-2017 21:55:51.042 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
17-Nov-2017 21:55:51.047 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 82 ms
Connected to server
[2017-11-17 09:55:51,059] Artifact monitor:war: Artifact is being deployed, please wait...
17-Nov-2017 21:55:52.977 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2017-11-17 21:55:53,163 org.nutz.mvc.NutFilter._init(NutFilter.java:85) INFO  - NutFilter[nutz] starting ...
2017-11-17 21:55:53,204 org.nutz.resource.Scans.printLocations(Scans.java:521) DEBUG - Locations count=4 time use 7ms
2017-11-17 21:55:53,211 org.nutz.resource.Scans.printLocations(Scans.java:521) DEBUG - Locations count=10 time use 5ms
2017-11-17 21:55:53,351 org.nutz.castor.Castors.reload(Castors.java:115) DEBUG - Using 95 castor for Castors
2017-11-17 21:55:53,394 org.nutz.mvc.config.AbstractNutConfig.createLoading(AbstractNutConfig.java:59) DEBUG - Loading by class org.nutz.mvc.impl.NutLoading
2017-11-17 21:55:53,397 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:55) INFO  - Nutz Version : 1.r.62 
2017-11-17 21:55:53,397 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:56) INFO  - Nutz.Mvc[nutz] is initializing ...
2017-11-17 21:55:53,397 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:60) DEBUG - Web Container Information:
2017-11-17 21:55:53,399 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:61) DEBUG -  - Default Charset : GBK
2017-11-17 21:55:53,399 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:62) DEBUG -  - Current . path  : E:\apache-tomcat-8.5.23\bin\.
2017-11-17 21:55:53,399 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:63) DEBUG -  - Java Version    : 1.8.0_151
2017-11-17 21:55:53,400 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:64) DEBUG -  - File separator  : \
2017-11-17 21:55:53,400 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:65) DEBUG -  - Timezone        : Asia/Shanghai
2017-11-17 21:55:53,400 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:66) DEBUG -  - OS              : Windows 10 amd64
2017-11-17 21:55:53,400 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:67) DEBUG -  - ServerInfo      : Apache Tomcat/8.5.23
2017-11-17 21:55:53,400 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:68) DEBUG -  - Servlet API     : 3.1
2017-11-17 21:55:53,402 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:73) DEBUG -  - ContextPath     : 
2017-11-17 21:55:53,402 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:74) DEBUG -  - context.tempdir : C:\Users\yangyang\.IntelliJIdea2017.1\system\tomcat\Unnamed_monitor_4\work\Catalina\localhost\ROOT
2017-11-17 21:55:53,402 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:75) DEBUG -  - MainModule      : org.nutz.MainModule
2017-11-17 21:55:53,403 org.nutz.mvc.impl.NutLoading.createContext(NutLoading.java:235) DEBUG - >> app.root = E:/apache-tomcat-8.5.23/webapps/ROOT
2017-11-17 21:55:53,409 org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:376) DEBUG - @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*anno", "org.nutz", "*tx", "*async"],init=[])
2017-11-17 21:55:53,565 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2017-11-17 21:55:53,565 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) DEBUG - loading [dao.js]
2017-11-17 21:55:53,574 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:57) DEBUG - Loaded 3 bean define from path=[ioc/] --> [conf, dao, dataSource]
2017-11-17 21:55:53,881 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1222 resource by src( org/nutz/ ) , regex( ^.+[.]class$ )
2017-11-17 21:55:55,238 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.Android_DetectionHistoryDataModule
2017-11-17 21:55:55,255 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.BreedingShed
2017-11-17 21:55:55,257 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.FarmProduct
2017-11-17 21:55:55,258 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.GrassLand
2017-11-17 21:55:55,259 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.RecordModule
2017-11-17 21:55:55,260 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.module.UserModule
2017-11-17 21:55:55,263 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.test.TestModule
2017-11-17 21:55:55,264 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:76) DEBUG - Found @IocBean : class org.nutz.utils.DateUtil
2017-11-17 21:55:55,265 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:52) INFO  - Found 8 classes in 1 base-packages!
beans = ["grassLand", "android_DetectionHistoryDataModule", "recordModule", "farmProduct", "userModule", "dateUtil", "breedingShed", "testModule"]
2017-11-17 21:55:55,282 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:40) DEBUG - Loaded 5 bean define from reader --
[txREPEATABLE_READ, txSERIALIZABLE, txNONE, txREAD_UNCOMMITTED, txREAD_COMMITTED]
2017-11-17 21:55:55,328 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) DEBUG - Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader
2017-11-17 21:55:55,329 org.nutz.ioc.impl.NutIoc.<init>(NutIoc.java:98) INFO  - NutIoc init begin ...
2017-11-17 21:55:55,330 org.nutz.ioc.impl.NutIoc.<init>(NutIoc.java:115) INFO  - ... NutIoc init complete
2017-11-17 21:55:55,331 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:159) INFO  - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2017-11-17 21:55:55,332 org.nutz.mvc.impl.NutLoading.createViewMakers(NutLoading.java:366) DEBUG - @Views(DefaultViewMaker.class)
2017-11-17 21:55:55,338 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1 resource by src( mvc/nutzbook-mvc-chain.js ) , regex( ^(.+[.])(js|json)$ )
2017-11-17 21:55:55,344 org.nutz.mvc.impl.chainconfig.JsonActionChainMakerConfiguretion.<init>(JsonActionChainMakerConfiguretion.java:37) DEBUG - ActionChain Config:
{
   "default": {
      "ps": ["org.nutz.mvc.LogTimeProcessor", "org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor", "org.nutz.mvc.impl.processor.EncodingProcessor", "org.nutz.mvc.impl.processor.ModuleProcessor", "!org.nutz.integration.shiro.NutShiroProcessor", "org.nutz.mvc.impl.processor.ActionFiltersProcessor", "org.nutz.mvc.impl.processor.AdaptorProcessor", "org.nutz.mvc.impl.processor.MethodInvokeProcessor", "org.nutz.mvc.impl.processor.ViewProcessor"],
      "error": "org.nutz.mvc.impl.processor.FailProcessor"
   }
}
2017-11-17 21:55:55,344 org.nutz.mvc.impl.NutLoading.createChainMaker(NutLoading.java:263) DEBUG - @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2017-11-17 21:55:55,347 org.nutz.mvc.impl.Loadings.scanModules(Loadings.java:154) DEBUG - module class location 'file:/E:/apache-tomcat-8.5.23/webapps/ROOT/WEB-INF/classes/'
2017-11-17 21:55:55,348 org.nutz.mvc.impl.Loadings.scanModuleInPackage(Loadings.java:184) DEBUG -  > scan 'org.nutz'
2017-11-17 21:55:55,667 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1222 resource by src( org/nutz/ ) , regex( ^.+[.]class$ )
2017-11-17 21:55:55,919 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.Android_DetectionHistoryDataModule'
2017-11-17 21:55:55,920 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.BreedingShed'
2017-11-17 21:55:55,920 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.FarmProduct'
2017-11-17 21:55:55,920 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.GrassLand'
2017-11-17 21:55:55,920 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.RecordModule'
2017-11-17 21:55:55,921 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.module.UserModule'
2017-11-17 21:55:55,927 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:199) DEBUG -    >> add 'org.nutz.test.TestModule'
2017-11-17 21:55:55,967 org.nutz.mvc.impl.NutActionChainMaker.getProcessorByName(NutActionChainMaker.java:72) INFO  - Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
2017-11-17 21:55:56,038 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/sysaspx/apk'              >> (RecordModule.java:30).addrecord      : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,040 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/test/count'               >> (TestModule.java:34).count            : Integer    | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,041 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/test/testconnection'      >> (TestModule.java:28).testConnection   : List       | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,043 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/api/breedingShed/realtime' >> (BreedingShed.java:33).realTime       : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,045 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/'                    >> (UserModule.java:53).index            : void       | @Ok(jsp:jsp.user.list) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,219 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/add'                 >> (UserModule.java:77).add              : NutMap     | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,221 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/update'              >> (UserModule.java:92).update           : NutMap     | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,227 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/delete'              >> (UserModule.java:106).delete          : NutMap     | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,228 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/gettime'             >> (UserModule.java:155).getTime         : long       | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,229 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/login'               >> (UserModule.java:57).login            : Boolean    | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,233 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/logout'              >> (UserModule.java:69).logout           : void       | @Ok(>>:/ ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,243 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/user/queryuserbyname'     >> (UserModule.java:160).queryUserByName : QueryResult | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,245 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/api/grassland/realtime'   >> (GrassLand.java:47).realTime          : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,246 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/api/grassland/history'    >> (GrassLand.java:67).history           : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,252 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/api/farmProduct/realtime' >> (FarmProduct.java:46).realTime        : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,253 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/api/farmProduct/history'  >> (FarmProduct.java:67).history         : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,259 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) DEBUG -    '/fdfcp/external//savedetectionhistorydata' >> (Android_DetectionHistoryDataModule.java:29).saveDetectionHistoryData : NutMap     | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-11-17 21:55:56,260 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:217) INFO  - Found 17 module methods
2017-11-17 21:55:56,260 org.nutz.mvc.impl.NutLoading.evalLocalization(NutLoading.java:303) DEBUG - Localization: org.nutz.mvc.impl.NutMessageLoader('msg/')  dft<zh-CN>
2017-11-17 21:55:56,272 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1 resource by src( msg/ ) , regex( ^.+[.]properties$ )
2017-11-17 21:55:56,272 org.nutz.mvc.impl.NutMessageLoader.load(NutMessageLoader.java:27) DEBUG - Load Messages in 1 resource : [[File[E:\apache-tomcat-8.5.23\webapps\ROOT\WEB-INF\classes\msg\zh-CN\user.properties]]]
2017-11-17 21:55:56,273 org.nutz.mvc.impl.NutMessageLoader.load(NutMessageLoader.java:95) DEBUG - Message Loaded, size = 2
2017-11-17 21:55:56,274 org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:271) INFO  - Setup application...
2017-11-17 21:55:56,279 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2017-11-17 21:55:56,279 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get '$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-11-17 21:55:56,280 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=$aop_async
2017-11-17 21:55:56,281 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject($aop_async) in AsyncAopIocLoader@584351584
2017-11-17 21:55:56,281 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-11-17 21:55:56,282 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object '$aop_async' to [app] 
2017-11-17 21:55:56,285 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) DEBUG - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2017-11-17 21:55:56,285 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=dao
2017-11-17 21:55:56,286 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dao
2017-11-17 21:55:56,286 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2017-11-17 21:55:56,287 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'dao'<interface org.nutz.dao.Dao>
2017-11-17 21:55:56,287 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.dao.impl.NutDao without AOP
2017-11-17 21:55:56,287 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'dao' to [app] 
2017-11-17 21:55:56,288 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dataSource'<>
2017-11-17 21:55:56,288 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=dataSource
2017-11-17 21:55:56,288 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dataSource
2017-11-17 21:55:56,325 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2017-11-17 21:55:56,327 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'dataSource'<>
2017-11-17 21:55:56,373 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class com.alibaba.druid.pool.DruidDataSource without AOP
2017-11-17 21:55:56,374 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'dataSource' to [app] 
2017-11-17 21:55:56,375 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-11-17 21:55:56,375 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=conf
2017-11-17 21:55:56,375 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=conf
2017-11-17 21:55:56,394 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2017-11-17 21:55:56,395 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'conf'<>
2017-11-17 21:55:56,395 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2017-11-17 21:55:56,395 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'conf' to [app] 
2017-11-17 21:55:56,553 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 1 resource by src( custom/ ) , regex( ^.+[.]properties$ )
2017-11-17 21:55:56,554 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:113) DEBUG - load properties from File[E:\apache-tomcat-8.5.23\webapps\ROOT\WEB-INF\classes\custom\db.properties]
2017-11-17 21:55:57,208 com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:715) INFO  - {dataSource-1} inited
2017-11-17 21:55:57,209 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dataSource'<>
2017-11-17 21:55:57,651 org.nutz.dao.jdbc.Jdbcs.<clinit>(Jdbcs.java:90) DEBUG - Jdbcs init complete
2017-11-17 21:55:57,651 org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:103) INFO  - Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-11-17 21:55:58,064 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:188) DEBUG - select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2017-11-17 21:55:58,068 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:199) DEBUG - JDBC Driver --> mysql-connector-java-5.1.40 ( Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6 )
2017-11-17 21:55:58,069 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:200) DEBUG - JDBC Name   --> MySQL Connector Java
2017-11-17 21:55:58,069 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:202) DEBUG - JDBC URL    --> jdbc:mysql://47.94.245.80:3306/nutz?useUnicode=true&characterEncoding=UTF-8
2017-11-17 21:55:58,211 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_client=utf8
2017-11-17 21:55:58,212 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_connection=utf8
2017-11-17 21:55:58,212 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_database=utf8
2017-11-17 21:55:58,212 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_filesystem=binary
2017-11-17 21:55:58,212 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_results=
2017-11-17 21:55:58,212 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_server=latin1
2017-11-17 21:55:58,213 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_set_system=utf8
2017-11-17 21:55:58,213 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:206) DEBUG - Mysql : character_sets_dir=/usr/share/mysql/charsets/
2017-11-17 21:55:58,220 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:213) DEBUG - Mysql : binlog_format=STATEMENT
2017-11-17 21:55:58,226 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:220) DEBUG - Mysql : database=nutz
2017-11-17 21:55:58,231 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:226) DEBUG - Mysql : user=yangee@111.199.186.44
2017-11-17 21:55:58,302 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:221) DEBUG - Database info --> MYSQL:[MySQL - 5.6.38]
2017-11-17 21:55:58,305 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 4 resource by src( org/nutz/bean/ ) , regex( ^.+[.]class$ )
2017-11-17 21:55:58,355 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT COUNT(*) FROM t_user 
2017-11-17 21:55:58,366 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:141) INFO  - Nutz.Mvc[nutz] is up in 4964ms
2017-11-17 21:55:58,369 org.nutz.mvc.NutFilter._init(NutFilter.java:117) INFO  - exclusionsPrefix  = ^(/rs/|/druid/)
[2017-11-17 09:55:58,405] Artifact monitor:war: Artifact is deployed successfully
[2017-11-17 09:55:58,405] Artifact monitor:war: Deploy took 7,346 milliseconds
17-Nov-2017 21:56:01.026 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [E:\apache-tomcat-8.5.23\webapps\manager]
17-Nov-2017 21:56:01.083 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [E:\apache-tomcat-8.5.23\webapps\manager] has finished in [57] ms

这个是启动的完整日志,项目是起来了

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
    <display-name>nutzbook</display-name>

    <filter>
        <filter-name>DruidWebStatFilter</filter-name>
        <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,/rs/*</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>DruidWebStatFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>nutz</filter-name>
        <filter-class>org.nutz.mvc.NutFilter</filter-class>
        <init-param>
            <param-name>modules</param-name>
            <param-value>org.nutz.MainModule</param-value>
        </init-param>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>/rs/*,/druid/*</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>*.action</url-pattern>
        <url-pattern>*.aspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>/api/*</url-pattern>
    </filter-mapping>

    <error-page>
        <error-code>500</error-code>
        <location>/WEB-INF/jsp/500.jsp</location>
    </error-page>

    <servlet>
        <servlet-name>DruidStatView</servlet-name>
        <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>DruidStatView</servlet-name>
        <url-pattern>/druid/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>
package org.nutz.module;

import com.mysql.jdbc.StringUtils;
import org.nutz.bean.User;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.Date;

/**
 * Created by yangyang7 on 2017/11/11.
 */

@IocBean
@At("/user")
@Ok("json:{locked:'password|salt',ignoreNull:true}")
@Fail("http:500")
public class UserModule {

    @Inject
    protected Dao dao;

//    @Inject
//    protected MyWebsocket myWebsocket;

    // 按业务需要,调用myWebsocket提供的各种api
//    public void send_job_notify(String room, final String from) {
//        myWebsocket.each(room, new Each<Session>() {
//            public void invoke(int index, Session ele, int length) {
//                myWebsocket.sendJson(ele.getId(), new NutMap("action", "layer").setv("notify", "你有新的待办事宜,请查看收件箱 from=" + from));
//            }
//        });
//    }

//    @At
//    public Integer count(HttpSession httpSession) {
//        send_job_notify("wsroom:home", "Hello Socket");
//        System.out.println("接受接受~");
//        return this.dao.count(User.class);
//    }

    @At("/")
    @Ok("jsp:jsp.user.list") // 真实路径是 /WEB-INF/jsp/user/list.jsp
    public void index() {
    }

    @At
    public Boolean login(@Param("username") String name, @Param("password") String password, HttpSession session) {
        User user = this.dao.fetch(User.class, Cnd.where("name", "=", name).and("password", "=", password));
        if (null == user) {
            return false;
        } else {
            session.setAttribute("userId", user.getId());
            return true;
        }
    }

    @At
    @Ok(">>:/")
    public void logout(HttpSession session) {
        session.invalidate();
    }

    @At
    public NutMap add(@Param("..") User user) {

//        send_job_notify("wsroom:home", user.toString());

        NutMap re = new NutMap();

        String flag = this.checkUser(user, true);
        if (flag != null) {
            return re.setv("ok", false).setv("msg", flag);
        }

        user.setCreateDateTime(new Date());
        user.setUpdateDateTime(new Date());
        user = dao.insert(user);
        return re.setv("ok", true).setv("data", user);
    }

    @At
    public NutMap update(@Param("..") User user) {
        NutMap re = new NutMap();
        String msg = this.checkUser(user, false);
        if (msg != null) {
            return re.setv("ok", false).setv("msg", msg);
        }
        user.setName(null);
        user.setCreateDateTime(null);
        user.setUpdateDateTime(new Date());
        dao.updateIgnoreNull(user);
        return re.setv("ok", true);
    }

    @At
    public NutMap delete(@Param("id") Integer id, @Attr("userId") Integer userId) {
        if (userId == id) {
            return new NutMap().setv("ok", false).setv("msg", "不能删除当前用户");
        }
        int i = dao.delete(User.class, id);
        if (i == 0) {
            return new NutMap().setv("ok", false).setv("msg", "不能删除当前用户");
        }
        return new NutMap().setv("ok", true);
    }

    private String checkUser(User user, Boolean create) {
        if (null == user) {
            return "用户对象为空";
        }
        if (create) {
            if (StringUtils.isNullOrEmpty(user.getName()) || StringUtils.isNullOrEmpty(user.getPassword())) {
                return "用户名/密码不能为空";
            }
        } else {
            if (StringUtils.isNullOrEmpty(user.getPassword())) {
                return "密码不能为空";
            }
        }

        String password = user.getPassword().trim();
        if (6 > password.length() || 12 < password.length()) {
            return "密码长度错误";
        }
        user.setPassword(password);

        if (create) {
            Integer count = this.dao.count(User.class, Cnd.where("name", "=", user.getName()));
            if (count != 0) {
                return "用户名已存在";
            }
        } else {
            if (user.getId() < 1) {
                return "用户id非法";
            }
        }

        if (null != user.getName()) {
            user.setName(user.getName().trim());
        }
        return null;
    }

    @At
    public long getTime() {
        return new Date().getTime();
    }

    @At
    public QueryResult queryUserByName(@Param("name") String name, @Param("..") Pager pager) {
        Cnd cnd = Strings.isBlank(name) ? null : Cnd.where("name", "like", "%" + name + "%");
        QueryResult qr = new QueryResult();
        qr.setList(dao.query(User.class, cnd, pager));
        pager.setRecordCount(dao.count(User.class, cnd));
        qr.setPager(pager);
        return qr;
    }

}

这个module中
我用http://localhost:8888/user.action可以请求服务
http://localhost:8888/user 这样就不行了
之前没有
*.action
*.aspx
的时候是可以直接http://localhost:8888/user 的

那直接/*就可以啦,带后缀一样能访问的

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