@Test(expected = ActionParamsException.class) public void testHandleActionNoCoordinates() throws Exception { Map<String, String> params = getValidParams(); params.remove(PARAM_LAT); handler.handleAction(createActionParams(params)); }
@Override public void handleAction(final ActionParameters params) throws ActionException { final Point point = new Point(params.getRequiredParamDouble(PARAM_LON), params.getRequiredParamDouble(PARAM_LAT)); final String srs = params.getRequiredParam(PARAM_SRS); final String target = params.getRequiredParam(TARGET_SRS); LOG.debug("Params - lon", point.getLon(), "lat", point.getLat(), "in", srs); try { PointTransformer transformer = getTransformer(); Point value = srs.equals(target) ? point : transformer.reproject(point, srs, target); LOG.debug("Reprojected - lon", value.getLon(), "lat", value.getLat(), "in", target); JSONObject response = new JSONObject(); JSONHelper.putValue(response, PARAM_LON, value.getLon()); JSONHelper.putValue(response, PARAM_LAT, value.getLat()); JSONHelper.putValue(response, PARAM_SRS, target); ResponseHelper.writeResponse(params, response); } catch (RuntimeException ex) { throw new ActionParamsException(ex.getMessage()); } }
CoordinatesHandler extends ActionHandler { @Override public void handleAction(final ActionParameters params) throws ActionException { final Point point = new Point(params.getRequiredParamDouble(PARAM_LON), params.getRequiredParamDouble(PARAM_LAT)); final String srs = params.getRequiredParam(PARAM_SRS); final String target = params.getRequiredParam(TARGET_SRS); LOG.debug("Params - lon", point.getLon(), "lat", point.getLat(), "in", srs); try { PointTransformer transformer = getTransformer(); Point value = srs.equals(target) ? point : transformer.reproject(point, srs, target); LOG.debug("Reprojected - lon", value.getLon(), "lat", value.getLat(), "in", target); JSONObject response = new JSONObject(); JSONHelper.putValue(response, PARAM_LON, value.getLon()); JSONHelper.putValue(response, PARAM_LAT, value.getLat()); JSONHelper.putValue(response, PARAM_SRS, target); ResponseHelper.writeResponse(params, response); } catch (RuntimeException ex) { throw new ActionParamsException(ex.getMessage()); } } }
CoordinatesHandler extends ActionHandler { @Override public void handleAction(final ActionParameters params) throws ActionException { final Point point = new Point(params.getRequiredParamDouble(PARAM_LON), params.getRequiredParamDouble(PARAM_LAT)); final String srs = params.getRequiredParam(PARAM_SRS); final String target = params.getRequiredParam(TARGET_SRS); LOG.debug("Params - lon", point.getLon(), "lat", point.getLat(), "in", srs); try { PointTransformer transformer = getTransformer(); Point value = srs.equals(target) ? point : transformer.reproject(point, srs, target); LOG.debug("Reprojected - lon", value.getLon(), "lat", value.getLat(), "in", target); JSONObject response = new JSONObject(); JSONHelper.putValue(response, PARAM_LON, value.getLon()); JSONHelper.putValue(response, PARAM_LAT, value.getLat()); JSONHelper.putValue(response, PARAM_SRS, target); ResponseHelper.writeResponse(params, response); } catch (RuntimeException ex) { throw new ActionParamsException(ex.getMessage()); } }  }
CoordinatesHandler extends ActionHandler { @Override public void handleAction(final ActionParameters params) throws ActionException { final Point point = new Point(params.getRequiredParamDouble(PARAM_LON), params.getRequiredParamDouble(PARAM_LAT)); final String srs = params.getRequiredParam(PARAM_SRS); final String target = params.getRequiredParam(TARGET_SRS); LOG.debug("Params - lon", point.getLon(), "lat", point.getLat(), "in", srs); try { PointTransformer transformer = getTransformer(); Point value = srs.equals(target) ? point : transformer.reproject(point, srs, target); LOG.debug("Reprojected - lon", value.getLon(), "lat", value.getLat(), "in", target); JSONObject response = new JSONObject(); JSONHelper.putValue(response, PARAM_LON, value.getLon()); JSONHelper.putValue(response, PARAM_LAT, value.getLat()); JSONHelper.putValue(response, PARAM_SRS, target); ResponseHelper.writeResponse(params, response); } catch (RuntimeException ex) { throw new ActionParamsException(ex.getMessage()); } }  @Override void init(); @Override void handleAction(final ActionParameters params); }
CoordinatesHandler extends ActionHandler { @Override public void handleAction(final ActionParameters params) throws ActionException { final Point point = new Point(params.getRequiredParamDouble(PARAM_LON), params.getRequiredParamDouble(PARAM_LAT)); final String srs = params.getRequiredParam(PARAM_SRS); final String target = params.getRequiredParam(TARGET_SRS); LOG.debug("Params - lon", point.getLon(), "lat", point.getLat(), "in", srs); try { PointTransformer transformer = getTransformer(); Point value = srs.equals(target) ? point : transformer.reproject(point, srs, target); LOG.debug("Reprojected - lon", value.getLon(), "lat", value.getLat(), "in", target); JSONObject response = new JSONObject(); JSONHelper.putValue(response, PARAM_LON, value.getLon()); JSONHelper.putValue(response, PARAM_LAT, value.getLat()); JSONHelper.putValue(response, PARAM_SRS, target); ResponseHelper.writeResponse(params, response); } catch (RuntimeException ex) { throw new ActionParamsException(ex.getMessage()); } }  @Override void init(); @Override void handleAction(final ActionParameters params);  }