To invoke a method before an endpoint method, annotate it with the @PreAction annotation. The value parameter of the annotation is the endpoint method name. This method should use the same parameters as the endpoint method.

For example:

@PreAction("addItems")
public void preAddItems(JSONObject pInputData) throws RestException {
  // pre endpoint logic
}

@POST
@Endpoint(id="/{commerceItems}/#POST", validatorId="commerceitems.add",
filterId="commerceitems-CollectionDefault", updateTarget=true)
public RepresentationModel addItems(JSONObject pInputData)
  throws RestException {
  // endpoint logic

}

Copyright © 1997, 2018 Oracle and/or its affiliates. All rights reserved. Legal Notices