我正在使用Apache-cxf(JAX-RS)和spring框架。我在beans.xml中有以下示例代码。
<jaxrs:server id="services" address="${http.server}">
<jaxrs:properties>
<entry key="attachment-max-size" value="1024" />
</jaxrs:properties>
<jaxrs:serviceBeans>
<bean id="mainResource" class="com.abc.rest.api.MainResource">
<lookup-method name="createEmployeeCollectionResource"
bean="employeeCollectionResource" />
</bean>
...
...other beans
...
</jaxrs:serviceBeans>
</jaxrs:server>
我还有以下代码
<bean id="employeeCollectionResource"
class="com.abc.rest.services.EmployeeCollectionResourceImpl">
<lookup-method name="createNewEmployeeResource" bean="employeeResource" />
</bean>
<bean id="employeeResource" scope="prototype"
class="com.abc.rest.services.EmployeeResourceImpl">
</bean>
我已经将上传期间的最大文件大小设置为1KB,通常用于所有服务。
如何限制attachment-max-size
特别针对少数豆类?示例 - 少数豆为5MB,少数为2MB等
答案 0 :(得分:2)
您必须使用各自的附件大小设置,在单独的<jaxrs:server >
代码中整理您的终端/资源:
<jaxrs:server id="services">
<jaxrs:properties>
<entry key="attachment-max-size" value="1024" />
</jaxrs:properties>
....
</jaxrs:server>
<jaxrs:server id="largeFileServices">
<jaxrs:properties>
<entry key="attachment-max-size" value="1000000" />
</jaxrs:properties>
....
</jaxrs:server>