Skip to content

Added file download support to EcpWebService, fixed a bug with non-au…#341

Merged
chrisala merged 7 commits intodevfrom
feature/issue3715
Mar 18, 2026
Merged

Added file download support to EcpWebService, fixed a bug with non-au…#341
chrisala merged 7 commits intodevfrom
feature/issue3715

Conversation

@chrisala
Copy link
Collaborator

…thenticated calls to proxyGet fieldcapture#3715

…thenticated calls to proxyGet fieldcapture#3715
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for streaming (file download) responses from upstream services in EcpWebService, and addresses an unauthenticated-call bug related to request header handling.

Changes:

  • Added readToStream(...) to stream HTTP responses to a caller-provided OutputStream (intended for file downloads).
  • Updated timeout handling in getString to use HttpStatus.SC_GATEWAY_TIMEOUT.
  • Fixed a null-user bug in multipart POST header setup by only reading user.userId when a user is present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

} catch (Exception e) {
resp = [error: "Timed out calling web service. URL= ${url}.", statusCode: conn?.responseCode?:""]

log.error "Failed calling web service. ${e.getClass()} ${e.getMessage()} URL= ${url}.", e
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling disconnect is only recommended if more calls to the server are not anticipated. Almost all requests are to ecodata and we don't want to close the socket here.

Comment on lines +109 to +124
try (InputStream inputStream = conn.inputStream) {
outputStream << inputStream
}
resp = [statusCode: conn.responseCode]

} catch (SocketTimeoutException e) {
resp = [error: "Timed out calling web service. URL= ${url}.", statusCode: conn?.responseCode?:""]
log.error "Timed out calling web service. URL= ${url}.", e
} catch (SocketException se) {
resp = [error: "Timed out calling web service. URL= ${url}.", statusCode: conn?.responseCode?:""]

log.warn "Socket connection closed. ${se.getMessage()} URL= ${url}.", se
} catch (Exception e) {
resp = [error: "Timed out calling web service. URL= ${url}.", statusCode: conn?.responseCode?:""]

log.error "Failed calling web service. ${e.getClass()} ${e.getMessage()} URL= ${url}.", e
@chrisala chrisala merged commit 1f03077 into dev Mar 18, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants