Home > Contents > Index >
Expanded TOC | Accordion TOC | Annotated TOC | Index
ICS.encode
Builds an encoded URL string from a set of attributes.
Syntax
public String
encode(String base,
Map map,
boolean bSession)
Parameters
base
- The base of the URL, for example,
"/servlet/ContentServer"
.
map
- Set of key/value pairs for each attribute, for example,
pagename/test01
.
bSession
- A value of
true
includes the session id in the URL when cookies are turned off on the client's browser. Note that if the session id is included in the URL, the page that URL refers to will not be cached.
Description
The
encode
method is analogous to theencode
XML and JSP tags. It takes a URL base and a set of key/value pairs and creates a URL like the following:
/servlet/ContentServer?pagename=test01
encode
also handles encoding for I18N, and optionally inserts a session id into the URL if cookies are turned off on the client's browser. Note that if the session id is included in the URL, the page that URL refers to will not be cached.Returns
A String; the encoded URL.
Example
The following examples encode a URL:
Example 1:
Map map=newHashMap(); map.put("pagename", "test01"); String url=ics.encode("/servlet/ContentServer", map,true);Example 2:
String sUrl = ics.GetProperty("cs.eventhost")+ics.GetProperty("ft.cgipath")
+ics.GetProperty("ft.approot")+"ContentServer"; Map mapPageCallResargs = new HashMap(); mapPageCallResargs.clear(); mapPageCallResargs.put("pagename", "books/bestsellers"); mapPageCallResargs.put("articleid", "102342"); mapPageCallResargs.put("author", "jones"); String sEncodedUrl = cs.encode(sUrl, mapCallUrl, true);See Also
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.