FFL2:FFL2 Main/Web Framework/Fantacy URL Encoding

From FFL Wiki
Revision as of 07:29, 4 September 2014 by Allan (talk | contribs) (Created page with 'Any URLs in a Java EE web app should be run through the [http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletResponse.html#encodeURL%28java.lang.String%29 HttpServl…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Any URLs in a Java EE web app should be run through the HttpServletResponse.encodeURL method. This is required to ensure that the session is encoded into the URL if need be.

In addition, for the FFL site, we have some parameters which we carry around as context from page to page. These are encoded into every link. They are

  • idFantacyLeague
  • idRealDivision
  • seasonStartYear

The DefaultParameterHelper class gives default values for these parameters if they are not present. However, this should only ever be the case for the first page a user hits. After that every link the user clicks should include these parameters, whether or not they are of relevance for the particular page the user is looking at. So if, for example, one changes seasonStartYear from 2014 to 2013 and clicks around the site, this value should persist and be encoded into every linke.

The FantacyURLEncoder class is used to perform the standard URL encoding and also to add maintain the values of these parameters as one navigates the site. This class may be called directly but more normally one would use the <ffl:url ...> tag which makes use of this class or the <ffl:a ... > tag which allows us to apply standard formatting to all <a ... > tags and which in turn calls <ffl:url ... >. Tags such as <ffl:fantacyClub ... > are provided so that a Fantacy Club's name will be rendered consistently on all pages and include a link to the club (using <ffl:a .. >).