Merge pull request #70 from ghillert/INTSAMPLES-98
INTSAMPLES-98 - Fix Typos in Mail and Multipart Sample
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
/**
|
||||
*
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.mail.imapidle;
|
||||
|
||||
@@ -18,7 +30,7 @@ import org.springframework.integration.core.MessageHandler;
|
||||
public class GmailInboundImapIdleAdapterTestApp {
|
||||
private static Logger logger = Logger.getLogger(GmailInboundImapIdleAdapterTestApp.class);
|
||||
|
||||
|
||||
|
||||
public static void main (String[] args) throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-imap-idle-config.xml");
|
||||
DirectChannel inputChannel = ac.getBean("recieveChannel", DirectChannel.class);
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
/**
|
||||
*
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.mail.imapidle;
|
||||
|
||||
@@ -18,10 +30,10 @@ import org.springframework.integration.core.MessageHandler;
|
||||
public class GmailInboundPop3AdapterTestApp {
|
||||
|
||||
private static Logger logger = Logger.getLogger(GmailInboundPop3AdapterTestApp.class);
|
||||
|
||||
|
||||
public static void main (String[] args) throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-pop3-config.xml");
|
||||
DirectChannel inputChannel = ac.getBean("recieveChannel", DirectChannel.class);
|
||||
DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class);
|
||||
inputChannel.subscribe(new MessageHandler() {
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
logger.info("Message: " + message);
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
|
||||
xmlns:util="http://www.springframework.org/schema/util">
|
||||
|
||||
<int:channel id="recieveChannel" />
|
||||
<int:channel id="receiveChannel" />
|
||||
<!-- replace 'userid and 'password' wit the real values -->
|
||||
<int-mail:imap-idle-channel-adapter id="customAdapter"
|
||||
store-uri="imaps://[userid]:[pasword]@imap.gmail.com:993/inbox"
|
||||
channel="recieveChannel"
|
||||
channel="receiveChannel"
|
||||
auto-startup="true"
|
||||
should-delete-messages="false"
|
||||
should-mark-messages-as-read="false"
|
||||
java-mail-properties="javaMailProperties"/>
|
||||
|
||||
|
||||
<util:properties id="javaMailProperties">
|
||||
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
|
||||
<prop key="mail.imap.socketFactory.fallback">false</prop>
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
|
||||
xmlns:util="http://www.springframework.org/schema/util">
|
||||
|
||||
<int:channel id="recieveChannel" />
|
||||
<int:channel id="receiveChannel" />
|
||||
<!-- replace 'userid and 'password' wit the real values -->
|
||||
<int-mail:inbound-channel-adapter id="pop3ShouldDeleteTrue"
|
||||
store-uri="pop3://[userid]:[password]@pop.gmail.com/INBOX"
|
||||
channel="recieveChannel"
|
||||
should-delete-messages="true"
|
||||
auto-startup="true"
|
||||
<int-mail:inbound-channel-adapter id="pop3ShouldDeleteTrue"
|
||||
store-uri="pop3://[userid]:[password]@pop.gmail.com/INBOX"
|
||||
channel="receiveChannel"
|
||||
should-delete-messages="true"
|
||||
auto-startup="true"
|
||||
java-mail-properties="javaMailProperties">
|
||||
<!-- Will poll every 20 seconds -->
|
||||
<!-- Will poll every 20 seconds -->
|
||||
<int:poller fixed-rate="20000"/>
|
||||
|
||||
|
||||
</int-mail:inbound-channel-adapter>
|
||||
|
||||
<util:properties id="javaMailProperties">
|
||||
|
||||
@@ -17,13 +17,13 @@ The Server is Spring Integration's HTTP endpoint configuration.
|
||||
|
||||
To run this sample:
|
||||
|
||||
1. Deploy project
|
||||
1. Deploy project
|
||||
* If you are using STS and project is imported as Eclipse project in your workspace you can just execute **Run on Server**
|
||||
* You can also run **mvn clean install** and generate the WAR file that you can deploy the conventional way
|
||||
2. run the simple test client program: **org.springframework.integration.samples.multipart.MultipartClient**
|
||||
|
||||
|
||||
You should see the following output from the server:
|
||||
|
||||
INFO : ...MultipartClient - Successfully recieved multipart request: {company=[[Ljava.lang.String;@147e8bd9], company-logo=[org.springframework.integration.http.UploadedMultipartFile@f5e12]}
|
||||
|
||||
INFO : ...MultipartClient - Successfully received multipart request: {company=[[Ljava.lang.String;@147e8bd9], company-logo=[org.springframework.integration.http.UploadedMultipartFile@f5e12]}
|
||||
INFO : ...MultipartClient - company - SpringSource
|
||||
INFO : org.springframework.integration.samples.multipart.MultipartClient - company-logo - as UploadedMultipartFile: spring09_logo.png
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,12 +24,12 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class MultipartReceiever {
|
||||
private static Logger logger = Logger.getLogger(MultipartReceiever.class);
|
||||
public class MultipartReceiver {
|
||||
private static Logger logger = Logger.getLogger(MultipartReceiver.class);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void recieve(LinkedMultiValueMap<String, Object> multipartRequest){
|
||||
logger.info("Successfully recieved multipart request: " + multipartRequest);
|
||||
public void receive(LinkedMultiValueMap<String, Object> multipartRequest){
|
||||
logger.info("Successfully received multipart request: " + multipartRequest);
|
||||
for (String elementName : multipartRequest.keySet()) {
|
||||
if (elementName.equals("company")){
|
||||
LinkedList value = (LinkedList)multipartRequest.get("company");
|
||||
@@ -38,7 +38,7 @@ public class MultipartReceiever {
|
||||
logger.info(elementName + " - " + companyName);
|
||||
}
|
||||
} else if (elementName.equals("company-logo")){
|
||||
logger.info(elementName + " - as UploadedMultipartFile: "
|
||||
logger.info(elementName + " - as UploadedMultipartFile: "
|
||||
+ ((UploadedMultipartFile) multipartRequest.getFirst("company-logo")).getOriginalFilename());
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<int:channel id="receiveChannel"/>
|
||||
|
||||
<int:service-activator id="multipartReceiver" input-channel="receiveChannel">
|
||||
<bean class="org.springframework.integration.samples.multipart.MultipartReceiever"/>
|
||||
<bean class="org.springframework.integration.samples.multipart.MultipartReceiver"/>
|
||||
</int:service-activator>
|
||||
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
|
||||
|
||||
Reference in New Issue
Block a user