HTML documents often need to contain a URL that the client can use to return information to the servlet. The relative URL of the servlet is the path to the context the servlet resides in, followed by the path the servlet occupies within the context.
The following sample generates a relative URL for a servlet:
std::string myURL = response.encodeURL(request.getContextPath() + request.getServletPath());
Notice that this sample uses the encodeURL function of the response to preserve session information for clients that use URL rewriting for sessions, as described in Section 7.5.
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.