The following steps show how you might create an endpoint.

  1. Create a package called atg.commerce.foo.restresources.

  2. In this new package, create a current order resource class, such as CurrentOrderRestResource.

  3. Define the annotations for the root resource level:

    @RestResource(id=OrderRestConstants.CURRENT_ORDER_ID)
    @Path("/cart")
    @Api(value="/cart")
    public class CurrentOrderRestResource extends GenericService {
    }

  4. Add an endpoint that retrieves a representation of the current order by adding the following:

    @GET
    @Endpoint(id="/cart#GET" filterId="cart-Default")
    @ApiOperation(value="Gets the current order.")
    public Object getOrder(JSONObject pJson) throws RestException, CommerceException {
    }

  5. Register the current user resource in the RestResourceRegistry.properties file.

    nucleusRestResources+=\
        atg/commerce/foo/restresources/CurrentOrderRestResource

  6. Build a CurrentOrderRestResource using a separate class loader.

    <target name="make-jerseyclassloader-jar">
      <!-- Make a jar file with misc override classes. -->
        <mkdir dir="${atg.dynamo.dynamoroot}/DCS/lib"/>
        <jar
            jarfile="${atg.dynamo.dynamoroot}/DCS/lib/
                foo-jersey-classloader.jar"
            basedir="${moduleroot}/buildtree"
            includes="
            atg/commerce/foo/restresources/CurrentOrderRestResource.class">
        </jar>
    </target>

  7. If you are adding the resource to a location different than the default, update the /Dynamo/foo/config/atg/dynamo/service/jaxrs/
    JerseyClassLoaderService.properties
    file to include:

    childFirstPrefixes=+\
                      atg/commerce/foo/restresources


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