当我尝试更新某些信息时,我在Safari浏览器中的应用程序出现问题。在我的应用程序中,该窗体是动态装载的,其属性来自API。在其他浏览器中,它只能在Safari中正常运行,并且会发生错误。
form.html
<form name="form" novalidate="novalidate">
<input type="hidden" name="wobId" value={{bankForm.wobId}}>
<div ng-repeat-start="prop in bankForm.properties | orderBy:'questionSequence'" class="bank-header section" ng-if="prop.type === 'header'">
<span class="text-large text-bold">{{prop.label}}</span>
<div class="link icon-info" ng-if="prop.note" tooltip="{{prop.note}}" tabindex="2">
</div>
</div>
<div ng-repeat-end ng-if="prop.type !== 'header'" class="form-group form-group--helper">
<div class="form-group__text" ng-if="!prop.options || prop.options.length === 0">
<div ng-if="prop.note" class="link icon-info" tooltip="{{prop.note}}" tabindex="2"></div>
<input id="{{prop.name}}-input" name="{{prop.name}}" ng-readonly="isTrue(prop.readOnly)" ng-model="prop.value"
ng-maxlength="{{getMaxLength(prop)}}" ng-minlength="{{getMinLength(prop)}}" ng-required="isTrue(prop.required)"
input-type="{{prop.type}}" input-step="{{prop.step}}" ng-trim="false" tabindex="{{isTrue(prop.readOnly) ? -1 : 2}}">
<label for="{{prop.name}}-input">{{prop.label}}:</label>
<div class="required-block" ng-if="isTrue(prop.required)">
<span class="icon-asterisk"></span>
</div>
</div>
<div class="form-group__text select" ng-if="prop.options && prop.options.length > 0">
<select id="{{prop.name}}-select" name="{{prop.name}}" ng-readonly="isTrue(prop.readOnly)" ng-model="prop.value" ng-required="isTrue(prop.required)">
<option ng-repeat="option in prop.options" value={{option.questionOptionId}}>{{option.options}}</option>
</select>
<label for="{{prop.name}}-select">{{prop.label}}:</label>
<div class="required-block" ng-if="isTrue(prop.required)">
<span class="icon-asterisk"></span>
</div>
</div>
<div class="help-block text-danger" ng-if="form[prop.name].$invalid && !form[prop.name].$error.required" ng-messages="form[prop.name].$error" role="alert">
<span class="icon-error"></span>
<span ng-message="minlength, maxlength"
translate="{{getLengthError(prop)}}"
translate-values="{ min: getMinLength(prop), max: getMaxLength(prop) }">
</span>
<span ng-message="number" translate="BANKING.ERROR_MESSAGES.NUMBER"></span>
<span ng-message="step" translate="BANKING.ERROR_MESSAGES.STEP"></span>
</div>
</div>
<div ng-if="!bankForm.attachment || bankForm.attachment.max > 0">
<div class="bank-attachments" ng-repeat="file in files">
<span class="link icon-remove-outline text-danger" title="Remove attachment" click="removeFile(file.name)" type="button" tabindex="2"></span>
<span class="text-default">{{file.name}}</span>
</div>
<input id="file-upload" name="file" type="file" input-change="uploadFile" multiple tabindex="2">
<label for="file-upload" class="btn btn--small upload-button">
<span class="icon-attachment"></span> {{fileName || ('BANKING.ATTACHMENT' | translate)}}
</label>
</div>
<div class="submit-error" ng-if="submitError">
<div class="alert alert--warning-alt2">
<div class="alert__icon icon-exclamation-triangle"></div>
<div class="alert__message" translate="{{submitError}}" translate-values="{{submitErrorParams}}"></div>
</div>
</div>
<p ng-if="bankForm.footer && bankForm.footer.length > 0" ng-repeat="footer in bankForm.footer" ng-style="footer.style">
{{footer.message}}
</p>
<div class="submit-form">
<input class="btn btn--primary" type="submit" value="{{'BANKING.SUBMIT' | translate}}" ng-click="openConfirmationModal()" ng-class="{disabled: form.$invalid}" ng-disabled="form.$invalid" tabindex="2">
<button class="btn" ng-if="bankForm.hasData" ui-sref="banking.details" translate="BANKING.CANCEL" tabindex="2"></button>
</div>
</form>
controller.js
$scope.submitForm = function() {
$rootScope.closeModal('confirmBanking');
if (isFormValid()) {
$scope.loading = true;
var formData = new FormData(document.querySelector('form'));
$scope.files.forEach(function(file) {
formData.append('file', file);
});
console.log($scope.bankForm);
bankingService.submitBankForm(formData).then(
function() {
$state.go('banking.details');
},
function() {
$scope.loading = false;
$scope.submitError = 'ERROR_MESSAGE';
}
);
}
};
service.js
this.submitBankForm = function(formData) {
return $http({
url: urlService.getLanguageUrl('update'),
method: 'POST',
data: formData,
headers: { 'Content-Type': undefined },
transformRequest: angular.identity
}).then(function(response) {
promise = $q.resolve(response.data);
});
};
错误控制台
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
ServletWebRequest: uri=/banking/formdata;client=0:0:0:0:0:0:0:1;session=6B07D458AE0AB542517A466CD0B999D0
2018-09-12 11:35:31 ERROR c.c.m.c.MyPayExceptionHandler:23 - EXCEPTION OCCURED IN THE API
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:116)
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:90)
at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:81)
at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1104)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:936)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.apache.catalina.connector.Request.parseParts(Request.java:2916)
at org.apache.catalina.connector.Request.parseParameters(Request.java:3216)
at org.apache.catalina.connector.Request.getParameter(Request.java:1137)
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75)
... 23 common frames omitted
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:297)
at org.apache.catalina.connector.Request.parseParts(Request.java:2868)
... 27 common frames omitted
Caused by: java.net.SocketTimeoutException: null
at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:201)
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:235)
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:216)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1241)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1190)
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:717)
at org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:40)
at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1072)
at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:140)
at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:261)
at org.apache.coyote.Request.doRead(Request.java:581)
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:326)
at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:642)
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:349)
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:183)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132)
at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977)
at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:881)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:98)
at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:68)
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:293)
... 28 common frames omitted
2018-09-12 11:35:31 INFO o.a.c.h.Http11Processor:167 - Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:426)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)