Skip to content
Snippets Groups Projects
Commit e78249dd authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Merge branch 'main' into 'production'

Production Release | nshmp-ws-static

See merge request !141
parents eabe7f94 910721af
No related branches found
No related tags found
1 merge request!141Production Release | nshmp-ws-static
Pipeline #269163 passed
......@@ -3,7 +3,6 @@
.project
.settings
.gradle
.vscode
bin
build
classes
......@@ -18,7 +17,6 @@ swagger-files
libs
.factorypath
.apt_*
.vscode
*version.json
# Node
......
{
/*
* VS Code recommended extensions for nshmp-ws-static.
*
* For more information on extension,
* visit: https://code.visualstudio.com/docs/editor/extension-marketplace
*/
"recommendations": [
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"gitlab.gitlab-workflow",
"jumpinjackie.vscode-map-preview",
"redhat.vscode-yaml",
"vscjava.vscode-gradle",
"vscjava.vscode-java-pack",
]
}
{
/*
* VS Code settings for nshmp-ws-static.
*
* For more information on settings,
* visit: https://code.visualstudio.com/docs/getstarted/settings
*/
"editor.rulers": [
{
"column": 100
}
],
"editor.tabSize": 2,
"files.associations": {
"*.geojson": "json"
},
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic",
"java.import.generatesMetadataFilesAtProjectRoot": true,
"files.exclude": {
"**/.classpath": true,
"**/.DS_Store": true,
"**/.factorypath": true,
"**/.git": true,
"**/.gradle": true,
"**/.project": true,
"**/.settings": true,
"**/bin": true,
"**/node_modules": true,
"**/package*.json": true,
}
}
{
/*
* VS Code tasks for nshmp-ws-static.
*
* For more information on tasks, visit: https://code.visualstudio.com/docs/editor/tasks
*/
"version": "2.0.0",
"tasks": [
/*
* Task to automatically run the `./gradlew eclipse` task on startup to
* keep the `.classpath` file updated.
*/
{
"label": "Update Classpath File",
"type": "shell",
"command": "./gradlew eclipse",
"windows": {
"command": "gradle.bat eclipse"
},
"presentation": {
"close": true,
},
"group": "none",
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
......@@ -112,7 +112,7 @@ public class NetcdfController {
"Annual Frequency of Exceedence,0.036386,0.026034,0.018125,0.012197, ...\n"))
})
@Get(uri = "/{longitude}/{latitude}/{siteClass}/{imt}{?format}",
produces = MediaType.APPLICATION_JSON)
produces = { MediaType.APPLICATION_JSON, MediaType.TEXT_CSV })
public HttpResponse<String> doGetSlashByImt(
HttpRequest<?> request,
@Schema(required = true) @PathVariable Double latitude,
......@@ -177,7 +177,7 @@ public class NetcdfController {
})
@Get(uri = "/{longitude}/{latitude}/{siteClass}{?format}",
produces = MediaType.APPLICATION_JSON)
produces = { MediaType.APPLICATION_JSON, MediaType.TEXT_CSV })
public HttpResponse<String> doGetSlashBySite(
HttpRequest<?> request,
@Schema(required = true) @PathVariable Double latitude,
......@@ -238,7 +238,8 @@ public class NetcdfController {
"..."))
})
@Get(uri = "/{longitude}/{latitude}{?format}", produces = MediaType.APPLICATION_JSON)
@Get(uri = "/{longitude}/{latitude}{?format}",
produces = { MediaType.APPLICATION_JSON, MediaType.TEXT_CSV })
public HttpResponse<String> doGetSlash(
HttpRequest<?> request,
@Schema(required = true) @PathVariable Double longitude,
......@@ -300,10 +301,10 @@ public class NetcdfController {
"Annual Frequency of Exceedence,0.036386,0.026034,0.018125,0.012197, ...\n" +
"\n" +
"..."))
})
@Get(uri = "{?longitude,latitude,siteClass,imt,format}",
produces = MediaType.APPLICATION_JSON)
@Get(
uri = "{?longitude,latitude,siteClass,imt,format}",
produces = { MediaType.APPLICATION_JSON, MediaType.TEXT_CSV })
public HttpResponse<String> doGet(
HttpRequest<?> request,
@Schema(required = true) @QueryValue @Nullable Double longitude,
......
......@@ -22,6 +22,7 @@ import gov.usgs.earthquake.nshmp.www.ResponseBody;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
/**
* Abstract service handler for {@code NetcdfController}.
......@@ -89,7 +90,14 @@ public abstract class NetcdfService<S, T extends Query> {
var service = getService(query);
var response = processRequest(httpRequest, query, service);
LOGGER.fine("Result:\n" + response);
return HttpResponse.ok(response);
var httpResponse = HttpResponse.ok(response);
if (query.format == ResponseFormat.CSV) {
httpResponse.header("Content-Type", MediaType.TEXT_CSV.toString());
}
return httpResponse;
} catch (Exception e) {
var url = httpRequest.getUri().toString();
return NetcdfWsUtils.handleError(e, getServiceName(), url);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment