Sets the HTTP redirect code to use for the PageReference object when
setRedirect(redirect) is set to true.
Signature
public System.PageReference setRedirectCode(Integer redirectCode)
Parameters
redirectCode
Type: Integer
Valid values:
0 — Redirect using the default redirect action for this PageReference.
Typically a JavaScript-based redirection or HTTP 302.
Note
Site URLRewirter
Interface implementations pointing to a PageReference with a
redirectCode of 0 are not redirected.
301 — Moved Permanently. Redirect users by sending an HTTP GET request to
the target location. Includes instructions to update any references to the
requested URL with the target location.
302 — Moved Temporarily. Redirect users by sending an HTTP GET request
to the target location. Because the redirection is temporary, it doesn’t include
update instructions.
303 — See Other. Redirect users by sending an HTTP GET request to the
target location. Not commonly used. Useful when the client sends a POST request
and you want the client to call the new web page using a GET request instead of a
POST request.
307 — Temporary Redirect. Send the same HTTP request, regardless of the
HTTP method, to the target location. Because the redirection is temporary, it
doesn’t include update instructions.
308 — Permanent Redirect. Send the same HTTP request, regardless of the
HTTP method, to the target location. Includes instructions to update any
references to the requested URL with the target location.
If the redirect code contains an invalid integer, an error message is
displayed when PageReference is used by
Salesforce for redirection.