This section provides instructions for using the Oracle ATG Web Commerce platform REST Web Services to invoke Java Server Pages (JSPs) in your Web applications.

You can create JSPs that access the functionality of a Web application that would otherwise be difficult to use via REST Web Services. JSPs may combine several functions and return a purpose-built set of information to REST Web Services clients.

Note: The REST Web Services interface does not secure access to JSPs. If your JSP provides access to sensitive resources, make sure to include security measures such as an access control servlet in your Web application.

The REST Web Services use the URL recoding feature of the Oracle ATG Web Commerce platform. This feature links URL application paths (for example, http://domain/an/application/path/) to specific JSPs in a Web application. It can identify input parameters in the URL and pass them to the JSP. See comprehensive information about URL recoding in the ATG Platform Programming Guide.

See instructions for configuring JSPs to be accessed by REST Web Services clients in REST Web Services JSP Configuration Procedure.

To invoke a JSP, send a REST Web Services request as described in the following table.

Request Component

Value

HTTP Method

GET or POST

Functional Parameters

Do not submit functional parameters when accessing JSPs via the REST Web Services. Pass parameters in the URL that corresponds to the JSP.

The format of the parameters that you pass in the URL is configured by the URL recoding feature of the Oracle ATG Web Commerce platform. The developers who design the JSP and the URL recoding template control the parameter format. See URL Templates for REST Web Services JSPs.

URL

Include the component pathname that corresponds to the JSP in the application path after /rest/service/. Include the parameters at the end of the path in the format expected by the template.

The URL that corresponds to a JSP is configured by the URL recoding feature of the Oracle ATG Web Commerce platform. The developers who design the JSP and the URL recoding template control the URL and the parameter format. See URL Templates for REST Web Services JSPs.

The following example shows a REST Web Services request that invokes a JSP. The application path and parameters in the URL are the controlled by the example configurations shown in URL Templates for REST Web Services JSPs. The code of the JSP itself is shown in Example REST Web Services JSP.

$ curl -v -b cookies.txt -X GET http://myserver:7003/rest/service/atg/AnyComponent/xprod2083,foo
* About to connect() to myserver port 7003 (#0)
*   Trying 12.34.567.890... connected
* Connected to myserver (12.34.567.890) port 7003 (#0)
> GET /rest/service/atg/AnyComponent/xprod2083,foo HTTP/1.1
> User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.5
> Host: myserver:7003
> Accept: */*
> Cookie: JSESSIONID=tGD0P6WBTGp62dd5QczJjM0JhpMSvzQvqMbC9jvMNhJ8fS3w33vD!-531422523; DYN_USER_CONFIRM=838bac4608584930c
f177410e3b46448; DYN_USER_ID=110001
>
< HTTP/1.1 200 OK
< Date: Tue, 14 Feb 2012 18:17:34 GMT
< Content-Length: 127
< Content-Type: application/json
< X-ATG-Version: version=QVRHUGxhdGZvcm0vMTAuMSxDb21tZXJjZVJlZmVyZW5jZVN0b3JlLzEwLjE=
< X-Powered-By: Servlet/2.5 JSP/2.1
<

      {"displayName":"Wine Glass Set","someString":"foo"}

* Connection #0 to host myserver left intact
* Closing connection #0