嗨,我们正在使用IBMCommerceSever,通过下面的代码从一个视图移动到另一个视图。
protected void prepareResponse(){
...
String returnUrl = "www.example.com/aNewPage.jsp?aUrlParameter=123&anotherParameter=654"
...
StringBuffer sb = new StringBuffer(returnUrl);
sb.append("&storeId=").append(commandContext.getStoreId());
sb.append("&langId=-1");
responseProperties.put(ECConstants.EC_REDIRECTURL, sb.toString());
responseProperties.put(ECConstants.EC_VIEWTASKNAME, ECConstants.EC_GENERIC_REDIRECTVIEW);
}
我们的网址是www.example.com/anewpage.jsp?krypto=f0lotsonRandomCharacters
不可否认,由于第三方集成,我们让javascript查找URL参数的未加密形式,当然它不能解密krypto参数。
这个行为是根据
documentation
:
Flattening input parameters into a query string for HttpRedirectView
All input parameters that are passed to a redirect view command are flattened
into a query string for URL redirection. For example, suppose that the input
to the redirect view command contains the following properties:
URL = "MyView?p1=v1&p2=v2";
ip1 = "iv1"; // input to orginal controller command
ip2 = "iv2" ; // input to original controller command
op1 = "ov1";
op2 = "ov2";
Based upon the preceding input parameters, the final URL is
MyView?p1=v1&p2=v2&ip1=iv1&ip2=iv2&op1=ov1&op2=ov2
Note that if the command is to use SSL, then the parameters are encrypted
and the final URL appears as
MyView?krypto=encrypted_value_ofâp1=v1&p2=v2&ip1=iv1&ip2=iv2&op1=ov1&op2=ov2â
现在的问题是:
如何防止这些URL参数被加密?