From db5a2a379cde5fac8a02e32f022175e2d9fe0d41 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 16 Sep 2010 10:05:25 -0400 Subject: [PATCH] INT-1380, migrating multipart-http sample --- cook-books/multipart-http/.classpath | 15 ++++ cook-books/multipart-http/.project | 48 +++++++++++++ .../multipart-http/.settings/.jsdtscope | 12 ++++ .../com.springsource.sts.config.flow.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 12 ++++ .../org.eclipse.wst.common.component | 11 +++ ....eclipse.wst.common.project.facet.core.xml | 7 ++ ...rg.eclipse.wst.jsdt.ui.superType.container | 1 + .../org.eclipse.wst.jsdt.ui.superType.name | 1 + .../.settings/org.maven.ide.eclipse.prefs | 9 +++ ...org.springframework.ide.eclipse.core.prefs | 68 ++++++++++++++++++ cook-books/multipart-http/.springBeans | 13 ++++ cook-books/multipart-http/pom.xml | 58 +++++++++++++++ cook-books/multipart-http/readme.txt | 11 +++ .../samples/multipart/MultipartReceiever.java | 39 ++++++++++ .../samples/multipart/spring09_logo.png | Bin 0 -> 6793 bytes .../src/main/resources/log4j.xml | 26 +++++++ .../src/main/webapp/META-INF/MANIFEST.MF | 3 + .../main/webapp/WEB-INF/servlet-config.xml | 25 +++++++ .../src/main/webapp/WEB-INF/web.xml | 17 +++++ .../multipart-http/src/main/webapp/index.html | 3 + .../samples/multipart/MultipartClient.java | 59 +++++++++++++++ 22 files changed, 441 insertions(+) create mode 100644 cook-books/multipart-http/.classpath create mode 100644 cook-books/multipart-http/.project create mode 100644 cook-books/multipart-http/.settings/.jsdtscope create mode 100644 cook-books/multipart-http/.settings/com.springsource.sts.config.flow.prefs create mode 100644 cook-books/multipart-http/.settings/org.eclipse.jdt.core.prefs create mode 100644 cook-books/multipart-http/.settings/org.eclipse.wst.common.component create mode 100644 cook-books/multipart-http/.settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 cook-books/multipart-http/.settings/org.maven.ide.eclipse.prefs create mode 100644 cook-books/multipart-http/.settings/org.springframework.ide.eclipse.core.prefs create mode 100644 cook-books/multipart-http/.springBeans create mode 100644 cook-books/multipart-http/pom.xml create mode 100644 cook-books/multipart-http/readme.txt create mode 100644 cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/MultipartReceiever.java create mode 100644 cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/spring09_logo.png create mode 100644 cook-books/multipart-http/src/main/resources/log4j.xml create mode 100644 cook-books/multipart-http/src/main/webapp/META-INF/MANIFEST.MF create mode 100644 cook-books/multipart-http/src/main/webapp/WEB-INF/servlet-config.xml create mode 100644 cook-books/multipart-http/src/main/webapp/WEB-INF/web.xml create mode 100644 cook-books/multipart-http/src/main/webapp/index.html create mode 100644 cook-books/multipart-http/src/test/java/org/springframework/integration/samples/multipart/MultipartClient.java diff --git a/cook-books/multipart-http/.classpath b/cook-books/multipart-http/.classpath new file mode 100644 index 00000000..dc2be4c4 --- /dev/null +++ b/cook-books/multipart-http/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/cook-books/multipart-http/.project b/cook-books/multipart-http/.project new file mode 100644 index 00000000..1aa0542b --- /dev/null +++ b/cook-books/multipart-http/.project @@ -0,0 +1,48 @@ + + + multipart-http + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + + org.springframework.ide.eclipse.core.springnature + org.maven.ide.eclipse.maven2Nature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/cook-books/multipart-http/.settings/.jsdtscope b/cook-books/multipart-http/.settings/.jsdtscope new file mode 100644 index 00000000..b46b9207 --- /dev/null +++ b/cook-books/multipart-http/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/cook-books/multipart-http/.settings/com.springsource.sts.config.flow.prefs b/cook-books/multipart-http/.settings/com.springsource.sts.config.flow.prefs new file mode 100644 index 00000000..a365e4ff --- /dev/null +++ b/cook-books/multipart-http/.settings/com.springsource.sts.config.flow.prefs @@ -0,0 +1,3 @@ +#Thu Sep 16 09:13:09 EDT 2010 +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/multipart-http/src/main/webapp/WEB-INF/servlet-config.xml=\n\n\n\n\n\n\n\n\n\n\n\n\n\n +eclipse.preferences.version=1 diff --git a/cook-books/multipart-http/.settings/org.eclipse.jdt.core.prefs b/cook-books/multipart-http/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..316adb02 --- /dev/null +++ b/cook-books/multipart-http/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Sep 16 09:11:51 EDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/cook-books/multipart-http/.settings/org.eclipse.wst.common.component b/cook-books/multipart-http/.settings/org.eclipse.wst.common.component new file mode 100644 index 00000000..84fb939a --- /dev/null +++ b/cook-books/multipart-http/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/cook-books/multipart-http/.settings/org.eclipse.wst.common.project.facet.core.xml b/cook-books/multipart-http/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..9f1491f6 --- /dev/null +++ b/cook-books/multipart-http/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.container b/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 00000000..3bd5d0a4 --- /dev/null +++ b/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.name b/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 00000000..05bd71b6 --- /dev/null +++ b/cook-books/multipart-http/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/cook-books/multipart-http/.settings/org.maven.ide.eclipse.prefs b/cook-books/multipart-http/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 00000000..00480d5b --- /dev/null +++ b/cook-books/multipart-http/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Tue Aug 31 23:37:04 EDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=false +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/cook-books/multipart-http/.settings/org.springframework.ide.eclipse.core.prefs b/cook-books/multipart-http/.settings/org.springframework.ide.eclipse.core.prefs new file mode 100644 index 00000000..2f28119e --- /dev/null +++ b/cook-books/multipart-http/.settings/org.springframework.ide.eclipse.core.prefs @@ -0,0 +1,68 @@ +#Thu Sep 16 09:14:16 EDT 2010 +eclipse.preferences.version=1 +org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true +org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=true +org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=false +org.springframework.ide.eclipse.core.enable.project.preferences=true +org.springframework.ide.eclipse.core.validator.enable.com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.server.quickfix.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false +org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivationPolicyRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivatorRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleManifestVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.exportPackageRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.importRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.parsingProblemsRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.requireBundleRule-com.springsource.server.ide.manifest.core.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.RefElementRule-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.legacyxmlusage.jndiobjectfactory-com.springsource.sts.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importLibraryVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importPackageVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.requireBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.autowire.autowire-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.toolAnnotation-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=false diff --git a/cook-books/multipart-http/.springBeans b/cook-books/multipart-http/.springBeans new file mode 100644 index 00000000..15608f30 --- /dev/null +++ b/cook-books/multipart-http/.springBeans @@ -0,0 +1,13 @@ + + + 1 + + + + + + + + + + diff --git a/cook-books/multipart-http/pom.xml b/cook-books/multipart-http/pom.xml new file mode 100644 index 00000000..636a9c62 --- /dev/null +++ b/cook-books/multipart-http/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + org.springframework.integration.samples + multipart-http + 2.0.0 + Spring Integration HTTP Multipart Demo + war + + 2.0.0.M7 + 3.0.3.RELEASE + 1.2 + 1.3.2 + 1.2.15 + + + + org.springframework.integration + spring-integration-http + ${spring.integration.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + commons-fileupload + commons-fileupload + ${commons-fileupload} + + + org.apache.commons + commons-io + 1.3.2 + + + log4j + log4j + ${log4j.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + -Xlint:all + true + false + + + + + diff --git a/cook-books/multipart-http/readme.txt b/cook-books/multipart-http/readme.txt new file mode 100644 index 00000000..235eb5c4 --- /dev/null +++ b/cook-books/multipart-http/readme.txt @@ -0,0 +1,11 @@ +To run this sample + 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: + + ### Successfully recieved multipart request ### + company - SpringSource + company-logo - as UploadedMultipartFile: spring09_logo.png \ No newline at end of file diff --git a/cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/MultipartReceiever.java b/cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/MultipartReceiever.java new file mode 100644 index 00000000..419d9f8a --- /dev/null +++ b/cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/MultipartReceiever.java @@ -0,0 +1,39 @@ +/* + * Copyright 2002-2010 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.multipart; + +import org.apache.log4j.Logger; +import org.springframework.integration.http.UploadedMultipartFile; +import org.springframework.util.LinkedMultiValueMap; +/** + * @author Oleg Zhurakousky + * + */ +public class MultipartReceiever { + private static Logger logger = Logger.getLogger(MultipartClient.class); + + public void recieve(LinkedMultiValueMap multipartRequest){ + logger.info("Successfully recieved multipart request: " + multipartRequest); + for (String elementName : multipartRequest.keySet()) { + if (elementName.equals("company")){ + logger.info(elementName + " - " + ((String[]) multipartRequest.getFirst("company"))[0]); + } else if (elementName.equals("company-logo")){ + logger.info(elementName + " - as UploadedMultipartFile: " + + ((UploadedMultipartFile) multipartRequest.getFirst("company-logo")).getOriginalFilename()); + } + } + } +} diff --git a/cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/spring09_logo.png b/cook-books/multipart-http/src/main/java/org/springframework/integration/samples/multipart/spring09_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..36b42b0015c1f274ac34ebd60470906cd28334ff GIT binary patch literal 6793 zcmV;48g}K0P)p>L>7Gcb}dt| zRV-Zf(^vC>Bv54Pwl0VYD@~_a*{k6i3=~b#OvDAmg@YM@Vg330r`yl2A3Ce_9|<^C z>-@(6+s|$Qig&K9{!av8q&ymzFI#!))EOY7e?m8qoH}L3ojZ3qIXRg~GUe&hXFw9D z6GB2vjEo8g8U!@=-MjbAO>ICmK=$|V-vI)Mk%oy6n6Q9x2#k}{SL~^5G%#U7SU-L} zL6ZYoiJZ>RxR4YAAs;@U2v2{8$GMHjTn;uF zAo=L|B#;F!KoX+Su>j_RTMx_B)Zh~;(?t^oI z=^v;OQVK(4O?3_e-EE|~8RAw*xL_8|z~UHGB16h$FgSPJmxYBF=m#Jh=v5Y=xya!m zFPRT<^w)3KAua}jX|QSm0)QR>W>g75Da?>Y20&Rz6xnDxK}6sM0MKHHTY)(l=x$){ zg>ZrKfLVE2>YoSt6GZ_$p#bX{AbIgtMY^V9f+6jDYOgx+)-h!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|D}m?3hmRcC|ED!;zYGKN0A2pM+vR*q zdL@P*ep3PobkAE3=&2_q*TkZ-t`00gvMf1UT9myLx+ z7bug)F5ev-JOKy{WC|Rh=Z7~uB<2-Cz{}3Rip96x=>7^Zpl2}3zW~_--}<`v2ZD+< zPn(E&z`AAgHYzR;Z>uKHe3A0WyKC2ra*C#KHIbOny~LKdrluNLGosqA|AZWpt8xfV zt(<%8hd;h+^R*0trj>HOgh4;rQ)dT;}RM{fOe5A(Q0HC@;iflOivs3~AVOR=b_ zoQ`KACYd@OGzfeu76?)%cj0J)xdho38}|HeEEQ!G50fw}N8uEr z84)NXNp>nai_Ob)RWTyB&jcFuQ4j!v-QN9Rh_H1L{$8}`FD;Q+k{IKG**_z&5g*kh zG(qV$nwC-wk+k%Jh@sg-j63IK5Mu+jb+NFGoHc7#GbZ@~&6ES%{AP^l+F=sY0vhLu rjL|Z>bC~oL!n3X+$`^$>UC8u*6(M#V!IIs800000NkvXXu0mjfZ+0=O literal 0 HcmV?d00001 diff --git a/cook-books/multipart-http/src/main/resources/log4j.xml b/cook-books/multipart-http/src/main/resources/log4j.xml new file mode 100644 index 00000000..b9d92d2c --- /dev/null +++ b/cook-books/multipart-http/src/main/resources/log4j.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cook-books/multipart-http/src/main/webapp/META-INF/MANIFEST.MF b/cook-books/multipart-http/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/cook-books/multipart-http/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/cook-books/multipart-http/src/main/webapp/WEB-INF/servlet-config.xml b/cook-books/multipart-http/src/main/webapp/WEB-INF/servlet-config.xml new file mode 100644 index 00000000..b8e3b9e0 --- /dev/null +++ b/cook-books/multipart-http/src/main/webapp/WEB-INF/servlet-config.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/cook-books/multipart-http/src/main/webapp/WEB-INF/web.xml b/cook-books/multipart-http/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..43c0d51a --- /dev/null +++ b/cook-books/multipart-http/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,17 @@ + + + multipart-http + + Multipart + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/servlet-config.xml + + 1 + + + Multipart + *.htm + + \ No newline at end of file diff --git a/cook-books/multipart-http/src/main/webapp/index.html b/cook-books/multipart-http/src/main/webapp/index.html new file mode 100644 index 00000000..f60b3bbe --- /dev/null +++ b/cook-books/multipart-http/src/main/webapp/index.html @@ -0,0 +1,3 @@ +You have successfully deployed HTTP Multipart Sample. + +Now you ready to execute org.springframework.integration.samples.multipart.MultipartClient \ No newline at end of file diff --git a/cook-books/multipart-http/src/test/java/org/springframework/integration/samples/multipart/MultipartClient.java b/cook-books/multipart-http/src/test/java/org/springframework/integration/samples/multipart/MultipartClient.java new file mode 100644 index 00000000..4646e596 --- /dev/null +++ b/cook-books/multipart-http/src/test/java/org/springframework/integration/samples/multipart/MultipartClient.java @@ -0,0 +1,59 @@ +/* + * Copyright 2002-2010 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.multipart; + +import org.apache.log4j.Logger; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; +/** + * @author Oleg Zhurakousky + * + */ +public class MultipartClient { + + private static Logger logger = Logger.getLogger(MultipartClient.class); + private static String uri = "http://localhost:8080/multipart-http/inboundAdapter.htm"; + private static String resourcePath = "org/springframework/integration/samples/multipart/spring09_logo.png"; + + /** + * @param args + */ + public static void main(String[] args) throws Exception{ + RestTemplate template = new RestTemplate(); + Resource s2logo = new ClassPathResource(resourcePath); + MultiValueMap multipartMap = new LinkedMultiValueMap(); + multipartMap.add("company", "SpringSource"); + multipartMap.add("company-logo", s2logo); + logger.info("Created multipart request: " + multipartMap); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(new MediaType("multipart", "form-data")); + HttpEntity request = new HttpEntity(multipartMap, headers); + logger.info("Posting request to: " + uri); + ResponseEntity httpResponse = template.exchange(uri, HttpMethod.POST, request, null); + if (!httpResponse.getStatusCode().equals(HttpStatus.OK)){ + logger.error("Problems with the request. Http status: " + httpResponse.getStatusCode()); + } + } +}