Skip to content

Commit 2b63ad0

Browse files
committed
Merge remote-tracking branch 'origin/master' into non-bid-codes-in-modules
# Conflicts: # extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/config/GreenbidsRealTimeDataConfiguration.java # extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInvocationService.java # extra/modules/ortb2-blocking/src/test/java/org/prebid/server/hooks/modules/ortb2/blocking/core/BidsBlockerTest.java # extra/modules/pb-richmedia-filter/src/test/java/org/prebid/server/hooks/modules/pb/richmedia/filter/core/BidResponsesMraidFilterTest.java # src/main/java/org/prebid/server/analytics/reporter/greenbids/GreenbidsAnalyticsReporter.java # src/main/java/org/prebid/server/auction/BidResponseCreator.java # src/main/java/org/prebid/server/auction/model/BidRejectionTracker.java # src/test/java/org/prebid/server/auction/BidResponseCreatorTest.java # src/test/java/org/prebid/server/auction/ExchangeServiceTest.java # src/test/java/org/prebid/server/auction/model/BidRejectionTrackerTest.java
2 parents ddff00c + 61a8887 commit 2b63ad0

File tree

1,338 files changed

+32905
-7658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,338 files changed

+32905
-7658
lines changed

.github/workflows/pr-java-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v4
2424

2525
- name: Set up JDK
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@v4
2727
with:
2828
distribution: 'temurin'
2929
cache: 'maven'

.github/workflows/scripts/codepath-notification

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@
1717
# The aim is to find a minimal set of regex patterns that matches any file in these paths
1818

1919
/ix|Ix|ix.json|ix.yaml: pdu-supply-prebid@indexexchange.com
20+
appnexus|Appnexus: prebid@microsoft.com
21+
pubmatic|Pubmatic: header-bidding@pubmatic.com
22+
openx|OpenX: prebid@openx.com
23+
medianet|Medianet: prebid@media.net
24+
thetradedesk|TheTradeDesk: Prebid-Maintainers@thetradedesk.com

.mvn/wrapper/maven-wrapper.jar

-58.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
88
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
9+
# http://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21
1+
FROM amazoncorretto:21.0.6-al2023
22

33
WORKDIR /app/prebid-server
44

Dockerfile-modules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21
1+
FROM amazoncorretto:21.0.6-al2023
22

33
WORKDIR /app/prebid-server
44

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Follow next steps to create JAR file which can be deployed locally.
4242

4343
- Install prerequsites
4444
- Java SDK: Oracle's or Corretto. Let us know if there's a distribution PBS-Java doesn't work with.
45+
- Java SDK Version: 21
4546
- Maven
4647

4748
- Clone the project:

docs/application-settings.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ There are two ways to configure application settings: database and file. This do
2525
- `auction.bidadjustments.mediatype.*.*.*[].value` - value of the bid adjustment
2626
- `auction.bidadjustments.mediatype.*.*.*[].currency` - currency of the bid adjustment
2727
- `auction.events.enabled` - enables events for account if true
28+
- `auction.bid-rounding` - bid rounding options are:
29+
- **down** - rounding down to the lower price bucket
30+
- **up** - rounding up to the higher price bucket
31+
- **timesplit** - 50% of the time rounding down to the lower PB and 50% of the time rounding up to the higher price bucket
32+
- **true** - if the price >= 50% of the range, rounding up to the higher price bucket, otherwise rounding down
2833
- `auction.price-floors.enabled` - enables price floors for account if true. Defaults to true.
2934
- `auction.price-floors.fetch.enabled`- enables data fetch for price floors for account if true. Defaults to false.
3035
- `auction.price-floors.fetch.url` - url to fetch price floors data from.
@@ -50,6 +55,7 @@ Keep in mind following restrictions:
5055
- `auction.preferredmediatype.<bidder>.<media-type>` - <media-type> that will be left for <bidder> that doesn't support multi-format. Other media types will be removed. Acceptable values: `banner`, `video`, `audio`, `native`.
5156
- `auction.privacysandbox.cookiedeprecation.enabled` - boolean that turns on setting and reading of the Chrome Privacy Sandbox testing label header. Defaults to false.
5257
- `auction.privacysandbox.cookiedeprecation.ttlsec` - if the above setting is true, how long to set the receive-cookie-deprecation cookie's expiration
58+
- `auction.cache.enabled` - enables bids caching for account if true. Defaults to true.
5359
- `privacy.gdpr.enabled` - enables gdpr verifications if true. Has higher priority than configuration in
5460
application.yaml.
5561
- `privacy.gdpr.eea-countries` - overrides the host-level list of 2-letter country codes where TCF processing is applied
@@ -277,8 +283,8 @@ The general idea is that you'll place all the account-specific settings in a sep
277283
```yaml
278284
settings:
279285
s3:
280-
accessKeyId: <S3 access key>
281-
secretAccessKey: <S3 access key>
286+
accessKeyId: <S3 access key> # optional
287+
secretAccessKey: <S3 access key> #optional
282288
endpoint: <endpoint> # http://s3.storage.com
283289
bucket: <bucket name> # prebid-application-settings
284290
region: <region name> # if not provided AWS_GLOBAL will be used. Example value: 'eu-central-1'
@@ -298,6 +304,14 @@ settings:
298304
timeout: 5000
299305
```
300306
307+
If `accessKeyId` and `secretAccessKey` are not specified in the Prebid Server configuration then AWS credentials will be looked up in this order:
308+
- Java System Properties - `aws.accessKeyId` and `aws.secretAccessKey`
309+
- Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
310+
- Web Identity Token credentials from system properties or environment variables
311+
- Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI
312+
- Credentials delivered through the Amazon EC2 container service if "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
313+
- Instance profile credentials delivered through the Amazon EC2 metadata service
314+
301315
### File format
302316

303317
We recommend using the `json` format for your account configuration. A minimal configuration may look like this.

docs/config-app.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Removes and downloads file again if depending service cant process probably corr
9696
- `auction.cache.expected-request-time-ms` - approximate value in milliseconds for Cache Service interacting.
9797
- `auction.cache.only-winning-bids` - if equals to `true` only the winning bids would be cached. Has lower priority than request-specific flags.
9898
- `auction.generate-bid-id` - whether to generate seatbid[].bid[].ext.prebid.bidid in the OpenRTB response.
99+
- `auction.enforce-random-bid-id` - whether to enforce generating a robust random seatbid[].bid[].id in the OpenRTB response if the initial value is less than 17 characters.
99100
- `auction.validations.banner-creative-max-size` - enables creative max size validation for banners. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
100101
- `auction.validations.secure-markup` - enables secure markup validation. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
101102
- `auction.host-schain-node` - defines global schain node that will be appended to `request.source.ext.schain.nodes` passed to bidders
@@ -283,8 +284,12 @@ For `JVM` metrics
283284
- `cache.scheme` - set the external Cache Service protocol: `http`, `https`, etc.
284285
- `cache.host` - set the external Cache Service destination in format `host:port`.
285286
- `cache.path` - set the external Cache Service path, for example `/cache`.
287+
- `cache.internal.scheme` - set the internal Cache Service protocol: `http`, `https`, etc., the internal scheme get priority over the external one when provided.
288+
- `cache.internal.host` - set the internal Cache Service destination in format `host:port`, the internal port get priority over the external one when provided.
289+
- `cache.internal.path` - set the internal Cache Service path, for example `/cache`, the internal path get priority over the external one when provided.
286290
- `storage.pbc.enabled` - If set to true, this will allow storing modules’ data in third-party storage.
287291
- `storage.pbc.path` - set the external Cache Service path for module caching, for example `/pbc-storage`.
292+
- `cache.api-key-secured` - if set to `true`, will cause Prebid Server to add a special API key header to Prebid Cache requests.
288293
- `pbc.api.key` - set the external Cache Service api key for secured calls.
289294
- `cache.query` - appends to the cache path as query string params (used for legacy Auction requests).
290295
- `cache.banner-ttl-seconds` - how long (in seconds) banner will be available via the external Cache Service.
@@ -294,6 +299,7 @@ for particular publisher account. Overrides `cache.banner-ttl-seconds` property.
294299
- `cache.account.<ACCOUNT>.video-ttl-seconds` - how long (in seconds) video creative will be available in Cache Service
295300
for particular publisher account. Overrides `cache.video-ttl-seconds` property.
296301
- `cache.default-ttl-seconds.{banner, video, audio, native}` - a default value how long (in seconds) a creative of the specific type will be available in Cache Service
302+
- `cache.append-trace-info-to-cache-id` - if set to `true`, causes the addition account ID and datacenter to cache UUID: _ACCOUNT-DATACENTER-remainderOfUUID_. Implies that cache UUID will be generated by the Prebid Server.
297303

298304
## Application settings (account configuration, stored ad unit configurations, stored requests)
299305
Preconfigured application settings can be obtained from multiple data sources consequently:
@@ -388,8 +394,8 @@ contain 'WHERE last_updated > ?' for MySQL and 'WHERE last_updated > $1' for Pos
388394

389395
For S3 storage configuration
390396
- `settings.in-memory-cache.s3-update.refresh-rate` - refresh period in ms for stored request updates in S3
391-
- `settings.s3.access-key-id` - an access key
392-
- `settings.s3.secret-access-key` - a secret access key
397+
- `settings.s3.access-key-id` - an access key (optional)
398+
- `settings.s3.secret-access-key` - a secret access key (optional)
393399
- `settings.s3.region` - a region, AWS_GLOBAL by default
394400
- `settings.s3.endpoint` - an endpoint
395401
- `settings.s3.bucket` - a bucket name
@@ -399,6 +405,15 @@ For S3 storage configuration
399405
- `settings.s3.stored-requests-dir` - a directory with stored requests
400406
- `settings.s3.stored-responses-dir` - a directory with stored responses
401407

408+
If `settings.s3.access-key-id` and `settings.s3.secret-access-key` are not specified in the Prebid Server configuration then AWS credentials will be looked up in this order:
409+
- Java System Properties - `aws.accessKeyId` and `aws.secretAccessKey`
410+
- Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
411+
- Web Identity Token credentials from system properties or environment variables
412+
- Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI
413+
- Credentials delivered through the Amazon EC2 container service if "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
414+
- Instance profile credentials delivered through the Amazon EC2 metadata service
415+
416+
402417
For targeting available next options:
403418
- `settings.targeting.truncate-attr-chars` - set the max length for names of targeting keywords (0 means no truncation).
404419

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Porting Guide
2+
3+
## Overview
4+
5+
First, thank you for taking on the migration of an adapter from Go to Java. But really the best way to think of it is not as straight port. Instead, we recommend treat this task as a re-implementation. It will take a few adapters before you fully get the hang of it, and that's okay—everyone goes through a learning curve.
6+
7+
Keep in mind that the PBS-Go team is more lenient about what they allow in adapters compared to the PBS-Java team.
8+
9+
## Pull Request Requirements
10+
11+
We would appreciate it if your porting PR title follows these patterns:
12+
13+
- `Port <adapter_name>: New Adapter` – For porting a completely new adapter to the project (e.g., `Port Kobler: New Adapter`).
14+
- `Port <adapter_name>: <update_description>` – For porting a specific update to an existing adapter (e.g., `Port OpenX: Native Support`).
15+
- `Port <alias_name>: New alias for <adapter_name>` – For porting an alias of an existing adapter to the project (e.g., `Port Artechnology: New alias of StartHub`).
16+
17+
Additionally, we kindly ask that you:
18+
19+
- Link any existing GitHub issues that your PR resolves. This ensures the issue will be automatically closed when your PR is merged.
20+
- Add the label `do not port` to your PR.
21+
22+
## Porting Requirements
23+
24+
1. **Feature Parity**: A Java adapter should have the same functionality as the Go adapter.
25+
2. **Java Adapter Code Should:**
26+
- Follow the code style of the PBS-Java repository (see [the code style page](code-style.md)).
27+
- Be well-written Java code: clear, readable, optimized, and following best practices.
28+
- Maintain a structure similar to existing adapters (see below).
29+
3. **The adapter should be covered with tests:**
30+
- Unit tests for implementation details.
31+
- A simple integration test to ensure the adapter is reachable, can send requests to the bidder, and that its configuration works.
32+
33+
### What does "having a similar structure to existing adapters" mean?
34+
35+
The PBS-Java codebase has evolved over time. While existing adapters may not be perfect and could contain legacy issues (e.g., using outdated Java syntax), they still serve as a valuable reference for learning, inspiration, and even reuse.
36+
37+
Each adapter is unique, but most share common patterns. For example, nearly every adapter includes:
38+
39+
1. **A `makeHttpRequests(...)` method**
40+
- Iterates over the `imps` in the bid request:
41+
- Parses `imp[].ext.prebid.bidder` (i.e., bidder static parameters).
42+
- Modifies the `imp`.
43+
- Collects errors encountered during `imp` processing.
44+
- Prepares outgoing request(s):
45+
- Constructs headers.
46+
- Builds the request URL.
47+
- Modifies the incoming bid request based on the updated `imps`.
48+
49+
2. **A `makeBids(...)` method**
50+
- Parses the `BidResponse`.
51+
- Iterates over `seatBids` and `bids`.
52+
- Creates a list of `BidderBid` objects.
53+
54+
### Ensuring Structural Consistency
55+
56+
To maintain consistency across adapters:
57+
- Fit the Go adapter functionality into the Java adapter structure.
58+
- Use the same or similar method and variable names where applicable.
59+
- Reuse existing solutions for common functionality (e.g., use `BidderUtil`, `HttpUtil` classes).
60+
- Ensure unit tests follow a similar structure, with comparable test cases and code patterns.
61+
62+
## Specific Rules and Tips for Porting
63+
64+
1. Begin by determining how the Go adapter's functionality fits into the Java adapter structure.
65+
2. Go adapters deserialize JSON objects in-place, while Java adapters work with pre-deserialized objects. As a result, many errors thrown in the Go version do not apply in Java.
66+
3. **No hardcoded URLs.** If an adapter has a "test URL," it must be defined in the YAML file. See `org.prebid.server.spring.config.bidder.NextMillenniumConfiguration.NextMillenniumConfigurationProperties` for an example of how to handle special YAML entries.
67+
4. The structure of Go and Java bidder configuration files differs—do not copy and paste directly. Pay attention to details such as macros in the endpoint and redirect/iframe URLs.
68+
5. **Prohibited in bidder adapters:**
69+
- Blocking code.
70+
- Fully dynamic hostnames in URLs.
71+
- Non-thread-safe code (bidder adapters should not store state internally).
72+
6. If an adapter has no special logic, consider using an alias to `Generic` instead. In this case, there will still need to be an integration test for this bidder. e.g. `src/test/java/org/prebid/server/it/BidderNameTest.java`

0 commit comments

Comments
 (0)