code: public static void searchByCriterion(final Criterion criterion, final MapWidget mapWidget,
  			final DataCallback<Map<VectorLayer, List<Feature>>> onFinished, final Runnable onError) {
  		FeatureSearchRequest request = new FeatureSearchRequest();
  		request.setMapCrs(mapWidget.getMapModel().getCrs());
  		request.setCriterion(criterion);
  		request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel()));
  		request.setFeatureIncludes(featureIncludes);
  		request.setMax(searchResultSize);
  
  		GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND);
  		commandRequest.setCommandRequest(request);
  		GwtCommandDispatcher.getInstance().execute(commandRequest,
  				new AbstractCommandCallback<FeatureSearchResponse>() {
  			public void execute(FeatureSearchResponse response) {
  				onFinished.execute(convertFromDto(response.getFeatureMap(), mapWidget.getMapModel()));
  			}
  
  			@Override
  			public void onCommunicationException(Throwable error) {
  				if (null != onError) {
  					onError.run();
  				} else {
  					super.onCommunicationException(error);
  				}
  			}
  		});
  	}
docs: Execute a search by criterion command.
  
  @param criterion criterion
  @param mapWidget map widget
  @param onFinished callback
  @param onError
  callback to execute in case of error, optional use null if you
  don't need it