01: package org.wings.portlet;
02:
03: /**
04: *
05: * Codec for encoding and decoding parameter names set in a SPortletAnchor. The
06: * parameter names have to be encoded to seperate them from the normal wingS
07: * parameters. A parameter must be encoded manually if it is set in the portlet
08: * and retrieved in a wingS class using the {@link PortletParameterProvider}
09: *
10: * @author <a href="mailto:marc.musch@mercatis.com">Marc Musch</a>
11: *
12: */
13: public class PortletParameterCodec {
14:
15: /**
16: * Encodes a parameter name
17: *
18: * @param parameterName
19: * the parameter name to encode
20: * @return the encoded parameter name
21: */
22: public synchronized static String encode(String parameterName) {
23: return Const.WINGS_PORTLET_URL_CODE_STRING + parameterName;
24:
25: }
26:
27: /**
28: * Decodes a parameter name
29: *
30: * @param codedParameterName
31: * the encoded paramter name to decode
32: * @return the decoded parameter name
33: */
34: public synchronized static String decode(String codedParameterName) {
35: return codedParameterName
36: .substring(Const.WINGS_PORTLET_URL_CODE_STRING.length());
37: }
38:
39: }
|