Re: Query parameters showing in URL on initial page access

Splash Forums PrettyFaces Users Query parameters showing in URL on initial page access Re: Query parameters showing in URL on initial page access

#22242

clemmonsm
Participant

Did a bit of debugging in my PF processor. I think you are right – ADF must be appending the params. Below is my config and PF processing. Below that are the debugging results from breaking on the return statements in the processor methods.

pretty-config.xml rewrite rules:

<!-- inbound rewrite rules: process inbound urls w/o "?" or "."; append trailing slash, set url to lowercase -->
<rewrite outbound="false" match="^[^?.]*$" toCase="lowercase" trailingSlash="append" redirect="301" />

<!-- outbound rewrite rules: process outbound urls that have a specific pattern via PrettyFacesAdfProcessor -->
<rewrite inbound="false" match=".*(^/$|/about/|/finance/|/build-on-your-lot/|/new-homes/|/request-info/|/career/)+.*" processor="siteUtils.PrettyFacesAdfProcessor" redirect="301" />

PrettyFacesAdfProcessor logic:

public class PrettyFacesAdfProcessor implements Processor {

public String processInbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rewrite, final String url) {

return url;
}

public String processOutbound(final HttpServletRequest request, final HttpServletResponse response, final RewriteRule rewrite, final String url) {

if (request.getParameterValues("_adf.ctrl-state") != null && !url.contains("_adf.ctrl-state")) {
// param exists and is not assigned to url, so append _adf.ctrl-state key/value to query string
String newUrl = url + "?_adf.ctrl-state=" + request.getParameterValues("_adf.ctrl-state")[0];
return newUrl;
}

return url;
}
}

Results:

1) processInbound – no params on URL

2) processInbound – ADF params on URL

3) processOutbound – ADF & Query params on URL

4) processOutbound – ADF & Query params on URL

5) processInbound – ADF & Query params on URL

6) processOutbound – ADF & Query params on URL

7) processOutbound – ADF & Query params on URL

…other outbound URL writing begins…

You mentioned breaking on calls to HttpServletResponse.sendRedirect(), however I don’t explicitly call that method in my code.

So, based on this, do you think I should modify my processor to remove these params?