use of org.n52.web.common.Stopwatch in project arctic-sea by 52North.
the class Service method options.
@RequestMapping(method = RequestMethod.OPTIONS)
private void options(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
Stopwatch stopwatch = Stopwatch.createStarted();
long currentCount = logRequest(request);
Binding binding = null;
try {
binding = getBinding(request);
binding.doOptionsOperation(request, response);
} catch (HTTPException exception) {
if (exception.getStatus() == HTTPStatus.METHOD_NOT_ALLOWED && binding != null) {
doDefaultOptions(binding, request, response);
} else {
onHttpException(request, response, exception);
}
} finally {
logResponse(request, response, currentCount, stopwatch);
}
}
use of org.n52.web.common.Stopwatch in project arctic-sea by 52North.
the class Service method delete.
@RequestMapping(method = RequestMethod.DELETE)
public void delete(HttpServletRequest request, HttpServletResponse response) throws IOException {
Stopwatch stopwatch = Stopwatch.createStarted();
long currentCount = logRequest(request);
try {
getBinding(request).doDeleteOperation(request, response);
} catch (HTTPException exception) {
onHttpException(request, response, exception);
} finally {
logResponse(request, response, currentCount, stopwatch);
}
}
use of org.n52.web.common.Stopwatch in project series-rest-api by 52North.
the class ParameterController method getCollection.
@Override
public ModelAndView getCollection(HttpServletResponse response, String locale, MultiValueMap<String, String> query) {
Stopwatch stopwatch = Stopwatch.startStopwatch();
IoParameters parameters = createParameters(query, locale, response);
try {
LOGGER.debug("getCollection() with query '{}'", parameters);
preparePagingHeaders(parameters, response);
return createModelAndView(getCollection(parameters), parameters);
} finally {
LOGGER.debug("Processing request took {} seconds.", stopwatch.stopInSeconds());
}
}
use of org.n52.web.common.Stopwatch in project series-rest-api by 52North.
the class ParameterController method getCollection.
@Override
public ModelAndView getCollection(String locale, MultiValueMap<String, String> query) {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters queryMap = QueryParameters.createFromQuery(query);
LOGGER.debug("getCollection() with query '{}'", queryMap);
if (queryMap.isExpanded()) {
Stopwatch stopwatch = Stopwatch.startStopwatch();
OutputCollection<T> result = addExtensionInfos(parameterService.getExpandedParameters(queryMap));
LOGGER.debug("Processing request took {} seconds.", stopwatch.stopInSeconds());
return createModelAndView(result);
} else {
OutputCollection<T> results = parameterService.getCondensedParameters(queryMap);
return createModelAndView(results);
}
}
use of org.n52.web.common.Stopwatch in project series-rest-api by 52North.
the class PreRenderingJob method execute.
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
if (interrupted) {
return;
}
LOGGER.info("Start prerendering task");
final Stopwatch stopwatch = Stopwatch.startStopwatch();
final JobDetail details = context.getJobDetail();
JobDataMap jobDataMap = details.getJobDataMap();
taskConfigPrerendering = readJobConfig(jobDataMap.getString(JOB_DATA_CONFIG_FILE));
webappFolder = jobDataMap.getString(JOB_DATA_WEBAPP_FOLDER);
List<RenderingConfig> phenomenonStyles = taskConfigPrerendering.getPhenomenonStyles();
List<RenderingConfig> styles = taskConfigPrerendering.getSeriesStyles();
for (RenderingConfig config : phenomenonStyles) {
Map<String, String> parameters = new HashMap<>();
parameters.put("phenomenon", config.getId());
IoParameters query = QueryParameters.createFromQuery(parameters);
for (DatasetOutput<?, ?> metadata : datasetService.getCondensedParameters(query)) {
String timeseriesId = metadata.getId();
renderConfiguredIntervals(timeseriesId, config);
if (interrupted) {
return;
}
}
}
for (RenderingConfig config : styles) {
renderConfiguredIntervals(config.getId(), config);
if (interrupted) {
return;
}
}
LOGGER.debug("prerendering took '{}'", stopwatch.stopInSeconds());
}
Aggregations