Re: Cannot get URL param on facebook redirect

Splash Forums PrettyFaces Users Cannot get URL param on facebook redirect Re: Cannot get URL param on facebook redirect



Hey Christian, thanks for the follow up on this.

Actually, my problem was the following:

I had an address of the following format:


I wanted to get the “code” paramater and store it somewhere else.

I wanted to get the “shortURLcode” parameter and make a pretty URL with it, of the format:

localhost:8080/shortURLcode (e.g.: localhost:8080/KTAGFaX).

I managed to do this using the following approach:

1. Two rules on the prettyfaces config

<url-mapping id=”rule1″>

<pattern value=”/#{ shortURLcode }” />

<view-id value=”/faces/Index.xhtml” />


<rewrite match=”code=(.+)” processor=”myapp.util.URLProcessor” redirect=”301″ />

They have to be in this order, so first we have a “pretty” URL pointing to “/faces/Index.xhtml” and then we remove the “code” parameter of the url using…

2. a custom processor

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

String fbAuthCode = url.substring(url.indexOf(“=”) + 1, url.length());

//System.out.println(“FB code: ” + fbAuthCode);

// do whatever we want with fb auth code…

//remove the parameter part appended by facebook

String returnUrl = url.substring(0, url.indexOf(“?”));

//return only the pretty url generated by the first rule.

return returnUrl;


Thanks a lot for the help, keep up the good work :)