- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个基于 Spring Web model-view-controller (Spring MVC 3.2.8) 的应用程序,我想使用 FTP SessionFactory 的默认实现来与 FTP 集成。
我有这段代码
private void performImport() throws Exception {
String fileNamePattern="*.txt";
ftpInboundFileSynchronizer = new FtpInboundFileSynchronizer(myFtpSessionFactory );
((FtpInboundFileSynchronizer) ftpInboundFileSynchronizer).setFilter(new FtpSimplePatternFileListFilter(fileNamePattern));
ftpInboundFileSynchronizer.setRemoteDirectory(remoteDirectory);
deleteLocalFiles();
System.out.println ("before synchronize");
ftpInboundFileSynchronizer.synchronizeToLocalDirectory(localDirectory);
System.out.println ("after synchronize");
}
这是我在控制台中看到的:
before synchronize
after synchronize
在 FTP 中,我有一个 test.txt
文件,但该文件未传输,并且我没有错误/异常
我也尝试过使用 fileNamePattern="*.*";
但它也不起作用
这是我的配置文件:
@Configuration
@PropertySource("classpath:/config/application.properties")
public class FtpConfiguration {
@Autowired
private SessionFactory myFtpSessionFactory;
@Bean
@Scope(value="step")
public FtpGetRemoteFilesTasklet myFtpGetRemoteFilesTasklet()
{
FtpGetRemoteFilesTasklet ftpTasklet = new FtpGetRemoteFilesTasklet();
ftpTasklet.setRetryIfNotFound(true);
ftpTasklet.setDownloadFileAttempts(3);
ftpTasklet.setRetryIntervalMilliseconds(10000);
ftpTasklet.setFileNamePattern("README");
//ftpTasklet.setFileNamePattern("TestFile");
ftpTasklet.setRemoteDirectory("/");
ftpTasklet.setLocalDirectory(new File(System.getProperty("java.io.tmpdir")));
ftpTasklet.setSessionFactory(myFtpSessionFactory);
return ftpTasklet;
}
@Bean
public SessionFactory myFtpSessionFactory()
{
DefaultFtpSessionFactory ftpSessionFactory = new DefaultFtpSessionFactory();
ftpSessionFactory.setHost("myhost.com");
ftpSessionFactory.setClientMode(0);
ftpSessionFactory.setFileType(FTP.ASCII_FILE_TYPE);
ftpSessionFactory.setPort(1029);
ftpSessionFactory.setUsername("some_username");
ftpSessionFactory.setPassword("really-private-password");
return ftpSessionFactory;
}
}
并且服务器日志文件中没有与 FTP 相关的内容
(self-tuning)'> <<WLS Kernel>> <> <> <1500554849537> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/LHheader.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849554> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/popupHeader.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849575> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/PopupTemplate.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849596> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/Template.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849612> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/defaultMenuBody.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849626> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/logoutBody.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849643> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/welcome.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849663> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/welcomeBody.jsp>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849839> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_NEW to STATE_PREPARED on server myserver.>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <WebLogicServer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849861> <BEA-000256> <Invoking weblogic.transaction.internal.StartupClass.main(null)>
####<20-Jul-2017 14:47:29 o'clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554849872> <BEA-149059> <Module devices of application ecolabelEar is transitioning from STATE_PREPARED to STATE_ADMIN on server myserver.>
####<20-Jul-2017 14:47:30 o'clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554850444> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.>
####<20-Jul-2017 14:47:30 o'clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554850447> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_PREPARED to STATE_ADMIN on server myserver.>
####<20-Jul-2017 14:47:30 o'clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1500554850652> <BEA-000000> <Initializing Spring root WebApplicationContext>
####<20-Jul-2017 14:47:40 o'clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1500554860329> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.>
####<20-Jul-2017 14:47:40 o'clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1500554860918> <BEA-000000> <Initializing log4j from [classpath:com/devices//log4j.properties]>
####<20-Jul-2017 14:47:41 o'clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554861044> <BEA-000000> <EcasServletAuthenticationFilter@11e13f4 : init weblogic.security.service.internal.ServletAuthenticationFilterServiceImpl$FilterConfigImpl@ec4bb2 for context: ServletContext@13293236[app:ecolabelEar module:devices path:/devices spec-version:3.0]>
####<20-Jul-2017 14:47:41 o'clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554861496> <BEA-000000> <Registered JASPIC AuthConfigProvider for application.>
####<20-Jul-2017 14:47:41 o'clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1500554861542> <BEA-000000> <Initializing Spring FrameworkServlet 'ecolabelWeb'>
####<20-Jul-2017 14:47:42 o'clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1500554862961> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Diagnostics> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866282> <BEA-320000> <The Diagnostics subsystem is initializing on Server myserver.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866314> <BEA-170025> <Initialized Domain Logging. Domain log events will be written to C:\Development\Domains\devices\servers\myserver\logs/mydomain.log.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866315> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Diagnostics> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866401> <BEA-320077> <Initialized the Diagnostic Accessor Service.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866436> <BEA-170031> <The default Server Logging bridge has been initialized successfully.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866456> <BEA-000365> <Server state changed to ADMIN.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866537> <BEA-000365> <Server state changed to RESUMING.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866541> <BEA-149059> <Module devices of application ecolabelEar is transitioning from STATE_ADMIN to STATE_ACTIVE on server myserver.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866542> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_ADMIN to STATE_ACTIVE on server myserver.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866549> <BEA-141052> <The auto deployment poller has started.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Info> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866563> <BEA-002610> <Dynamic Listener Service initialized.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866564> <BEA-002613> <Channel "Default" is now listening on 158.166.167.112:7001 for protocols iiop, t3, ldap, snmp, http.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Warning> <Server> <D02DI1350859ENV> <myserver> <DynamicListenThread[Default]> <<WLS Kernel>> <> <> <1500554866564> <BEA-002611> <The hostname "D02DI1350859ENV.net8.pep.ant", maps to multiple IP addresses: 158.166.167.112, 0:0:0:0:0:0:0:1.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866564> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866565> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866565> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866595> <BEA-000365> <Server state changed to RUNNING.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866596> <BEA-000360> <The server started in RUNNING mode.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866645> <BEA-000000> <Beginning getServletAuthenticationFilters.>
####<20-Jul-2017 14:47:46 o'clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554866645> <BEA-000000> <PrincipalAuthenticator.getServletAuthenticationFilters will use WLS-specific security service>
####<20-Jul-2017 14:47:48 o'clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554868336> <BEA-010009> <EJB deployed EJB with JNDI name ejb.mgmt.MEJB.>
####<20-Jul-2017 14:47:48 o'clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:module/Mejb!javax.management.j2ee.ManagementHome.>
####<20-Jul-2017 14:47:48 o'clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:global/mejb/Mejb!javax.management.j2ee.ManagementHome.>
####<20-Jul-2017 14:47:48 o'clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:app/mejb/Mejb!javax.management.j2ee.ManagementHome.>
####<20-Jul-2017 14:47:48 o'clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1500554868337> <BEA-014021> <The EJB Mejb(Application: mejb, EJBComponent: mejb.jar) has been successfully deployed. The following remote interfaces have been bound into JNDI with the specified JNDI names:>
####<20-Jul-2017 14:48:46 o'clock CEST> <Info> <Health> <D02DI1350859ENV> <myserver> <weblogic.GCMonitor> <<anonymous>> <> <> <1500554926432> <BEA-310002> <50% of the total memory in the server is free.>
这里是配置文件:
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
">
<!-- Use annotations to inject stuff -->
<context:annotation-config />
<mvc:annotation-driven />
<!-- Scan for controllers -->
<context:component-scan base-package="com.no.en.tenim.ni.cinc.controller.image" />
<context:component-scan base-package="com.no.en.tenim.ni.cinc.controller" />
<context:component-scan base-package="com.no.en.tenim.ni.cinc.audit" />
<context:component-scan base-package="com.no.en.tenim.ni.cinc.domain.formBeans" />
<context:component-scan base-package="com.no.en.tenim.ni.cinc.utils" />
<bean id="resultDecider" class="com.no.en.tenim.ni.cinc.audit.DevicesResultDecider"/>
<bean id="userLocator" class="com.no.en.tenim.ni.cinc.audit.BaseContextUserLocator"/>
<!-- automatically import all controller beans -->
<import resource="classpath:com/nicinc/Devices/controller/**/*Controller.xml" />
<!-- The multipartResolver specifies in what way a multi part request should be treated. This enables file upload capabilities. -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
</bean>
<bean name="viewBasenames"
factory-bean="classpathBasenamePatternresolver"
factory-method="resolve">
<constructor-arg>
<list>
<value>views.**</value>
</list>
</constructor-arg>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basenames" ref="viewBasenames" />
</bean>
<!-- Maps incoming URLs to classnames -->
<bean name="controllerHandler" class="springext.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="basePackage" value="com.no.en.tenim.ni.cinc.controller" />
<property name="interceptors">
<list>
<!-- Checks a specific request parameter if the locale is changed. -->
<ref bean="localeChangeInterceptor" />
<ref bean="sessionInterceptor" />
</list>
</property>
</bean>
<!-- Action URL mappings to controllers. -->
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="interceptors">
<list>
<!-- Checks a specific request parameter if the locale is changed. -->
<ref bean="localeChangeInterceptor"/>
<ref bean="sessionInterceptor"/>
</list>
</property>
</bean>
<bean name="formController" abstract="true">
<property name="bindOnNewForm" value="true" />
<property name="sessionForm" value="true" />
<property name="synchronizeOnSession" value="true" />
<property name="propertyEditorRegistrar" ref="propertyEditorRegistrar" />
</bean>
<!-- Resolves view name to template & body -->
<bean name="templateViewResolver" class="springext.web.servlet.mvc.support.TemplateViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="templateMap">
<bean class="springext.web.servlet.mvc.support.TemplateMapFactory">
<property name="templateDir" value="/WEB-INF/jsp/template/" />
<property name="templateSuffix" value="Template.jsp" />
<property name="bodySuffix" value="Body.jsp" />
</bean>
</property>
</bean>
</beans>
和其他
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">
<!-- As of Spring Security 4.0, CSRF protection is enabled by default with XML configuration -->
<security:global-method-security secured-annotations="enabled" />
<security:http auto-config="true">
<security:csrf/>
<security:intercept-url pattern="/**" access="permitAll" />
</security:http>
<security:authentication-manager/>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.util.List">
<bean class="com.no.en.tenim.ni.cinc.support.beans.ListPropertyEditor" />
</entry>
</map>
</property>
</bean>
<bean id="sessionInterceptor" class="com.no.en.tenim.ni.cinc.support.context.SessionInterceptor" />
<!-- The locale resolver determines the locale of a request. -->
<!-- In this example a cookie is used to store the chosen language. -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en_GB" />
<!-- <property name="paramName" value="language" /> -->
</bean>
<!-- The locale change interceptor checks a specific request parameter if the locale is changed. -->
<!-- In this example the request parameter called 'locale' is checked. -->
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
<bean name="classpathBasenamePatternresolver"
class="com.no.en.tenim.ni.cinc.support.resource.ClassPathBaseNamePatternResolver">
</bean>
<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list><value>classpath:config/application.properties</value></list>
</property>
</bean>
<!-- used for internationalized messages, e.g.: validation errors or instant help text. -->
<bean id="messageSource" class="com.no.en.tenim.ni.cinc.support.context.EnglishMessageSource">
<property name="dao">
<ref bean="databaseMessageSourceDao" />
</property>
<property name="defaultLanguage">
<value>en</value>
</property>
<property name="useCache">
<value>false</value>
</property>
</bean>
<bean name="dateFormat" class="java.text.SimpleDateFormat">
<constructor-arg value="dd/MM/yyyy" />
</bean>
<bean name="customDateEditor" class="org.springframework.beans.propertyeditors.CustomDateEditor">
<constructor-arg ref="dateFormat" />
<constructor-arg value="true" />
</bean>
<bean name="CustomDictionaryEditor"
class="com.no.en.tenim.ni.cinc.support.controller.CustomDictionaryEditor">
</bean>
<bean id="propertyEditorRegistrar"
class="com.no.en.tenim.ni.cinc.support.controller.CustomPropertyEditorRegistrar">
<property name="editors">
<map>
<entry key="java.util.Date" value-ref="customDateEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.ProductGroup" value-ref="CustomDictionaryEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.ServiceGroup" value-ref="CustomDictionaryEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.CompetentBody" value-ref="CustomDictionaryEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.Country" value-ref="countryReferencePropertyEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.ApplicationSignatory"
value-ref="CustomDictionaryEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.Description"
value-ref="descriptionReferencePropertyEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.Language"
value-ref="languageReferencePropertyEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.ServiceRating"
value-ref="serviceRatingReferencePropertyEditor" />
<entry key="com.no.en.tenim.ni.cinc.domain.AccomodationType"
value-ref="accomodationTypeReferencePropertyEditor" />
</map>
</property>
</bean>
<bean id="exceptionResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<value>
com.no.en.tenim.ni.cinc.domain.security.SessionExpiredException=noSessionView
com.no.en.tenim.ni.cinc.domain.security.NoSufficientRoleException=noRoleView
com.no.en.tenim.ni.cinc.domain.security.NoAccessException=noRoleView
com.no.en.tenim.ni.cinc.domain.security.NoUserException=noUserView
</value>
</property>
</bean>
<bean id="sessionHelper" class="com.no.en.tenim.ni.cinc.controller.util.SessionHelper">
</bean>
<bean id="userMessagesManager" class="com.no.en.tenim.ni.cinc.support.controller.UserMessagesManager" scope="session">
<aop:scoped-proxy/>
</bean>
</beans>
最佳答案
你好,试试这个 FTP 连接的配置设置。希望它能解决你的问题。
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.MessagingGateway;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.interceptor.WireTap;
import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Option;
import org.springframework.integration.ftp.gateway.FtpOutboundGateway;
import org.springframework.integration.ftp.session.DefaultFtpSessionFactory;
import org.springframework.integration.handler.LoggingHandler;
import org.springframework.integration.handler.LoggingHandler.Level;
import org.springframework.messaging.MessageChannel;
@Configuration
public class FtpConfiguration {
@ServiceActivator(inputChannel = "ftpLS")
@Bean
public FtpOutboundGateway getGW() {
FtpOutboundGateway gateway = new FtpOutboundGateway(sf(), "ls", "payload");
gateway.setOption(Option.NAME_ONLY);
gateway.setOutputChannelName("results");
return gateway;
}
@Bean
public MessageChannel results() {
DirectChannel channel = new DirectChannel();
channel.addInterceptor(tap());
return channel;
}
@Bean
public WireTap tap() {
return new WireTap("logging");
}
@ServiceActivator(inputChannel = "logging")
@Bean
public LoggingHandler logger() {
LoggingHandler logger = new LoggingHandler(Level.INFO);
logger.setLogExpressionString("'Files:' + payload");
return logger;
}
@Bean
public DefaultFtpSessionFactory sf() {
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost("localhost");
sf.setPort(2121);
sf.setUsername("anonymous");
sf.setPassword("");
return sf;
}
@MessagingGateway(defaultRequestChannel = "ftpLS", defaultReplyChannel = "results")
public interface Gate {
List list(String directory);
}
}
关于java - Spring MVC 3.2.8 : FtpInboundFileSynchronizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45028610/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!