Skip to content

Commit

Permalink
Re-emabøe suffix pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaar, Bjørn-Andre committed Jan 17, 2024
1 parent 7fe3d85 commit 6f4ce4f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions klass-api/doc/requests/examples-classifications.http
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ Accept: application/json
### Get all classifications with size and page
GET {{base_url}}/classifications?size=2&page=2
Accept: application/json

### Get a single correspondencetable
GET {{base_url}}/correspondencetables/1
Accept: application/json

### Get a single correspondencetable with suffix pattern matching
GET {{base_url}}/correspondencetables/1.csv
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -254,7 +255,7 @@ public ClassificationVersionResource versions(@PathVariable Long id,
return new ClassificationVersionResource(version, language, corrTableVersionIsTarget, includeFuture);
}

@RequestMapping(value = "/correspondencetables/{id}", method = RequestMethod.GET)
@GetMapping("/correspondencetables/{id}")
public CorrespondenceTableResource correspondenceTables(@PathVariable Long id, @RequestParam(value = "language",
defaultValue = "nb") Language language) {
CorrespondenceTable table = classificationService.getCorrespondenceTable(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

@JacksonXmlRootElement(localName = "correspondenceTable")
@JsonPropertyOrder({"name", "contactPerson", "owningSection", "source", "sourceId", "target", "targetId", "changeTable",
"lastModified", "published", "links"})
"lastModified", "published", "sourceLevel", "targetLevel", "description", "changelogs", "correspondenceMaps",
"links"})
public class CorrespondenceTableResource extends CorrespondenceTableSummaryResource {
private final String description;
private final List<ChangelogResource> changelogs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import no.ssb.klass.api.controllers.ClassificationController;

@JsonPropertyOrder({"name", "contactPerson", "owningSection", "source", "sourceId", "target", "targetId", "changeTable",
"lastModified", "published", "links"})
"lastModified", "published", "sourceLevel", "targetLevel", "links"})
public class CorrespondenceTableSummaryResource extends KlassResource {
private final String name;
private final ContactPersonResource contactPerson;
Expand Down
12 changes: 11 additions & 1 deletion klass-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,14 @@ klass.env.api.path=/api/klass
# Set to '/**' to skip authorization for local testing
security.ignored=${klass.env.security.ignored}

spring.main.allow-bean-definition-overriding=true
# Spring Boot 2.1 disabled bean overriding by default as a defensive approach.
# But we need to override some beans in our tests, so we need to enable it.
spring.main.allow-bean-definition-overriding=true

# Spring MVC 5.3 disabled suffix pattern matching by default as a defensive approach.
# But we need to re-enable this since buttons from ssb.no/klass still uses it
spring.mvc.pathmatch.use-registered-suffix-pattern=true
spring.mvc.pathmatch.matching-strategy: ant-path-matcher
spring.mvc.contentnegotiation.favor-path-extension=true
# Register additional file extensions/media types:
spring.mvc.contentnegotiation.media-types.csv=text/csv

0 comments on commit 6f4ce4f

Please sign in to comment.