Package com.alibaba.dashscope.transport
package com.alibaba.dashscope.transport
-
ClassesClassDescriptionAttaches Authorization and X-DashScope-WorkSpace from the per-request auth tag.One-shot encryption material for a single encrypted-channel request (J7): server public key + freshly generated AES key + IV.Fetches the server's latest encryption public key (J7):
GET /public-keys/latest→{request_id, data:{public_key, public_key_id}}, then bundles it with fresh AES material into anEncryptionConfig.Crypto primitives for the encrypted channel (J7, ported from 2.x utils/EncryptionUtils): RSA-wrapped AES-256-GCM.3.0 HTTP transport (design §6): one OkHttpClient (pool maxRequests=100 / perHost=20, keepAlive 5s, env-tunable), application-level retry/auth/UA interceptors, and the dual error layer — non-2xx status and HTTP-200-with-business-code both map throughErrors; withraiseOnError(false)they instead surface on the returned envelope (2.x-styleisError()semantics).Shared Jackson mapper and wire-envelope helpers.OkHttp request tags carrying per-call state into application interceptors.Per-request auth material resolved from config + RequestOptions overrides.Per-request encryption material used for both request encryption and response decryption.Per-request maxRetries override.Functional-area tag for the x-dashscope-sdk-client header (e.g.Marker: SSE / WebSocket-upgrade requests must not be auto-retried (design §6).Suffix appended to the User-Agent (e.g.Raw result of one HTTP exchange after error policy ran: status + headers + decoded body.Application-level retry policy (design §6): retryable statuses {408, 409, 429, 500, 502, 503, 504} plus connection-level IO failures honorsRetry-After/Retry-After-ms/X-Should-Retryexponential backoff 500ms → 8s with ±25% jitter default maxRetries=2 (per-request override viaRequestTags.MaxRetries) requests taggedRequestTags.NoRetry(SSE / WebSocket upgrade) are never retried: a failed stream cannot be safely replayed (double billing / duplicated results)Attaches SDK telemetry headers (design §6): User-Agent (version), x-dashscope-sdk-session-id (shared with 2.x via the neutral layer, so one process reports one session id across generations), and x-dashscope-sdk-client in theclient/version/moduleform.