Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.fasterxml.jackson.databind.util.StdDateFormat;
Expand Down Expand Up @@ -178,7 +175,7 @@ public ObjectMapper objectMapper() {
objectMapper.setFilterProvider(jsonFilterProvider());
objectMapper.setDateFormat(new StdDateFormat());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setPropertyNamingStrategy(new PropertyNamingStrategy.UpperCamelCaseStrategy());
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.UPPER_CAMEL_CASE);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private ApiClient getPcaClient() {
// To determine this, DXA first tries the regular Page and if it doesn't exist, it appends /index.html and tries again.
// TODO: The above should be handled by GraphQL (See CRQ-11703)
public <T> T loadPage(Class<T> type, PageRequestDto pageRequest, ContentType contentType) throws ContentProviderException {
T result = null;
try {
JsonNode pageNode = getPcaClient().getPageModelData(
GraphQLUtils.convertUriToGraphQLContentNamespace(pageRequest.getUriType()),
Expand All @@ -79,7 +80,7 @@ public <T> T loadPage(Class<T> type, PageRequestDto pageRequest, ContentType con
ContentIncludeMode.INCLUDE_DATA_AND_RENDER,
null
);
T result = mapToType(type, pageNode);
result = mapToType(type, pageNode);
// result may be 'null' starting from Jackson 2.18.3, so checking for this condition
if (result == null) {
String pathToDefaults = normalizePathToDefaults(pageRequest.getPath(), true);
Expand All @@ -95,10 +96,6 @@ public <T> T loadPage(Class<T> type, PageRequestDto pageRequest, ContentType con
null);
result = mapToType(type, pageNode);
}
if (log.isTraceEnabled()) {
log.trace("Loaded '{}' for pageRequest '{}'", result, pageRequest);
}
return result;
}
catch (IOException e) {
// Keeping this for users who may override the Jackson version and utilize a version prior to 2.18.3
Expand All @@ -115,11 +112,7 @@ public <T> T loadPage(Class<T> type, PageRequestDto pageRequest, ContentType con
PageInclusion.valueOf(pageRequest.getIncludePages().toString()),
ContentIncludeMode.INCLUDE_DATA_AND_RENDER,
null);
T result = mapToType(type, node);
if (log.isTraceEnabled()) {
log.trace("Loaded '{}' for pageRequest '{}'", result, pageRequest);
}
return result;
result = mapToType(type, node);
}
catch (IOException ex) {
if (log.isTraceEnabled()) {
Expand All @@ -128,6 +121,13 @@ public <T> T loadPage(Class<T> type, PageRequestDto pageRequest, ContentType con
throw new PageNotFoundException("Unable to load page, by request " + pageRequest, ex);
}
}
if (log.isTraceEnabled()) {
log.trace("Loaded '{}' for pageRequest '{}'", result, pageRequest);
}
if (result == null) {
throw new PageNotFoundException("Unable to load page (retrieved 'null'), by request " + pageRequest);
}
return result;
}

public <T> T loadPage(Class<T> type, String namespace, int publicationId, int pageId, ContentType contentType, DataModelType modelType, PageInclusion pageInclusion, ContextData contextData) throws ContentProviderException {
Expand Down