{
String actionName = _state.action;
if (actionName.length() > 0 && actionName.charAt(0) == '/') {
actionName = actionName.substring(1);
}
MutableURI uri = PageFlowUtils.getActionURI(servletContext, request, response, actionName);
uri.setFragment(_location);
uri.setEncoding(response.getCharacterEncoding());
boolean needsToBeSecure = PageFlowUtils.needsToBeSecure(servletContext, request, uri.getPath(), true);
URLRewriterService.rewriteURL(servletContext, request, response, uri, URLType.ACTION, needsToBeSecure);
// Add a scope-ID hidden input, if there's one on this tag, or one in the request.
String targetScope = (_targetScope != null) ? _targetScope : request.getParameter(ScopedServletUtils.SCOPE_ID_PARAM);
if (targetScope != null) {
if (_params == null) {
_params = new HashMap();
}
_params.put(ScopedServletUtils.SCOPE_ID_PARAM, targetScope);
// If there's one on the URL, we're replacing it with a hidden param.
if (uri != null) {
assert uri instanceof FreezableMutableURI : uri.getClass().getName();
((FreezableMutableURI) uri).setFrozen(false);
uri.removeParameter(ScopedServletUtils.SCOPE_ID_PARAM);
}
}
// Check if the rewritten form action contains request parameters that need
// to be turned into hidden fields -- shouldn't include them in the action
// URI on a GET.
boolean forXML = false;
if (_state.method != null && _state.method.equalsIgnoreCase(FORM_GET)
&& !URLRewriterService.allowParamsOnFormAction(servletContext, request)) {
extraHiddenParams.putAll(uri.getParameters());
}
else {
// Params are allowed on the form action so see if this is for XHTML
forXML = TagRenderingBase.Factory.isXHTML(request);
}