<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.26</version>
<scope>compile</scope>
</dependency>
register(MultiPartFeature.class);
@POST
@Path("/logos2")
@Consumes(MediaType.MULTIPART_FORM_DATA)
Response uploadLogo2(@FormDataParam("uploadFile") InputStream stream){
}
curl -X POST "http://localhost:7070/service-manager/services/logos2" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "uploadFile=@1.png;type=image/png"
018-04-26 17:13:11.777 DEBUG 30454 --- [nio-7070-exec-2] o.g.j.m.i.ReaderInterceptorExecutor : Message body reader (class org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide) is trying to close the entity input stream. Not closing.
2018-04-26 17:13:11.778 DEBUG 30454 --- [nio-7070-exec-2] o.g.j.m.m.i.MultiPartReaderClientSide : Exception occurred during parsing MultiPart message. Performing cleanup.
org.jvnet.mimepull.MIMEParsingException: Missing start boundary
at org.jvnet.mimepull.MIMEParser.skipPreamble(MIMEParser.java:318) ~[mimepull-1.9.6.jar:1.9.6]
下面给出依赖关系树。堆栈超过流要求放更多的文本。
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.1.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | | \- org.springframework:spring-core:jar:5.0.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.0.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.0.1.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.5:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.5:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.5:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.29:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.29:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.29:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.9.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | +- org.springframework:spring-web:jar:5.0.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:5.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.0.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jersey:jar:2.0.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:2.0.1.RELEASE:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.26:compile
[INFO] | | +- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] | | \- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-spring4:jar:2.26:compile
[INFO] | | +- org.glassfish.jersey.inject:jersey-hk2:jar:2.26:compile
[INFO] | | | \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b42:compile
[INFO] | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42:compile
[INFO] | | +- org.glassfish.hk2:hk2:jar:2.5.0-b42:compile
[INFO] | | | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b42:compile
[INFO] | | | | \- javax.inject:javax.inject:jar:1:compile
[INFO] | | | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b42:compile
[INFO] | | | +- org.glassfish.hk2:config-types:jar:2.5.0-b42:compile
[INFO] | | | +- org.glassfish.hk2:hk2-core:jar:2.5.0-b42:compile
[INFO] | | | +- org.glassfish.hk2:hk2-config:jar:2.5.0-b42:compile
[INFO] | | | +- org.glassfish.hk2:hk2-runlevel:jar:2.5.0-b42:compile
[INFO] | | | \- org.glassfish.hk2:class-model:jar:2.5.0-b42:compile
[INFO] | | | \- org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b42:compile
[INFO] | | \- org.glassfish.hk2:spring-bridge:jar:2.5.0-b42:compile
[INFO] | \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.26:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.0.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.1.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.1.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:2.7.8:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.0.5.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.2.16.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.22.0-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.3.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.0.6.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.0.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.0.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-tx:jar:5.0.5.RELEASE:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.0.5.RELEASE:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-multipart:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.26:compile
[INFO] | | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | \- org.jvnet.mimepull:mimepull:jar:1.9.6:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.4:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.9:compile
[INFO] | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] +- commons-validator:commons-validator:jar:1.6:compile
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] | +- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- com.h2database:h2:jar:1.4.196:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.5.5:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.19:compile
[INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.20:compile
[INFO] +- io.swagger:swagger-jersey2-jaxrs:jar:1.5.19:compile
[INFO] | \- io.swagger:swagger-jaxrs:jar:1.5.19:compile
[INFO] | +- io.swagger:swagger-core:jar:1.5.19:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.5:compile
[INFO] | | \- io.swagger:swagger-models:jar:1.5.19:compile
[INFO] | +- org.reflections:reflections:jar:0.9.11:compile
[INFO] | \- com.google.guava:guava:jar:20.0:compile
[INFO] +- io.swagger:swagger-annotations:jar:1.5.19:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.4:compile
[INFO] | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.5:compile
[INFO] +- org.mockito:mockito-all:jar:2.0.2-beta:test
[INFO] \- org.junit.jupiter:junit-jupiter-api:jar:5.1.0:test
[INFO] +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] +- org.opentest4j:opentest4j:jar:1.0.0:test
[INFO] \- org.junit.platform:junit-platform-commons:jar:1.1.0:test
我认为问题是您使用的是curl,而您没有为多部分/表单数据在content-header中设置边界。
试试像这样的事
curl -X POST "http://localhost:7070/service-manager/services/logos2" -H "accept: application/json" -H "Content-Type: multipart/form-data; boundary=------------------------d74496d66958873e" -F "uploadFile=@1.png;type=image/png"
注意在-h选项中添加了边界字符串。
我需要你的帮助, 似乎我在尝试在容器div内的textarea周围添加div以及包含容器div底部按钮的div边框时遇到了一些困难。 第一个问题:右侧边框丢失 第二个问题,inner2 div缺少1px纯红。 以下是问题和期望结果的图片: 预期结果是: 这里是超文本标记语言
我尝试上传多个文件,使用Apache Http库。 这就是我上传文件的方式。 它可以打印。 如果我只上传一个文件就行了! 注意,这不是重复的。这些链接显示了在服务器端引用问题的帖子。这是客户端的问题。 Jetty对多部分表单请求抛出“缺少多部分请求的内容” 500内部服务器错误Android HttpPost文件上载
如spring boot博客所述 我尝试自定义我的对象序列化。 在我的配置中添加了一个新的配置bean之后 当我尝试输出类用户的实例时,json结果不在CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES中 也许我需要在我的Jersey配置中注册一些东西来激活我的自定义obejctMapper配置 谢谢
谢谢你过来。 我想使用fetch api发送一个作为请求的 手术看起来像这样 这里的问题是边界,比如 永远不要将其放入标题中 应该是这样的 当您使用尝试“相同”操作时,如下所示 标题设置正确 所以我的问题是, > 在这种情况下,我如何使的行为完全像? 如果这不可能,为什么? 谢谢大家!这个社区或多或少是我职业成功的原因。
我有一个服务器Weblogic 12.1.3,带有JAX-RS 2。x作为共享库安装(参见。https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF297). 该共享库包括例如javax。ws。rs-api-2.0。jar和jersey-media-multipart-2.5.1。jar。 请注意,我不确
我正在尝试使用Appium(通过SauceLabs)在iOS上运行web应用程序的自动测试,但在下面详细介绍的一个相对简单的测试用例中遇到了一个问题。 我得到以下错误在Appium日志: 查看屏幕截图,问题中的元素确实出现在屏幕上。 在尝试单击元素之前,我尝试滚动到元素: 通过javascript滚动到它似乎没有任何区别。似乎有些坐标集被弄乱了,但我对Appium的工作原理了解不够,无法弄清楚。