Details
Description
QR code generation on JSP should work via REST: the full data for the QR code should be encoded in the URL as with the JSF version, such as this URL which returns the QR code for "ICEmobile":
http://mobileshowcase.icesoft.org/mobileshowcase/javax.faces.resource/qrcode:ICEmobile.jsf
http://mobileshowcase.icesoft.org/mobileshowcase/javax.faces.resource/qrcode:ICEmobile.jsf
Activity
Ted Goddard
created issue -
Ted Goddard
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Steve Maryka [ steve.maryka ] | Greg Dick [ greg.dick ] |
Ted Goddard
made changes -
Summary | REST variant of QR code tag | RESTful QR code tag |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #32669 | Fri Dec 07 17:41:32 MST 2012 | greg.dick | |
Files Changed | ||||
MODIFY
/icemobile/trunk/icemobile/samples/icemobilespring/src/main/java/org/icemobile/samples/spring/controllers/EchoSessionController.java
|
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #32670 | Fri Dec 07 17:43:19 MST 2012 | greg.dick | |
Files Changed | ||||
MODIFY
/icemobile/trunk/icemobile/jsp/src/main/java/org/icemobile/jsp/tags/QRCodeTag.java
|
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #32700 | Mon Dec 10 12:48:01 MST 2012 | greg.dick | |
Files Changed | ||||
MODIFY
/icemobile/trunk/icemobile/jsp/src/main/java/org/icemobile/jsp/tags/QRCodeTag.java
|
Greg Dick
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Greg Dick
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Spring MVC request mapping annotations don't seem to allow the mapping to include portions of the URL that isn't included in the mapping value. What that means is that a declaration like:
@RequestMapping(value = "/qrcode")
public void doImageRequest( HttpServletResponse response,
HttpServletRequest request,
@ModelAttribute("QRScanBean") QRScanBean model)
doesn't map the request /qrcode:xxxyyyzzz
Spring does have a nice structure for exactly this type of thing, with request parameterization, a mapping such as:
@RequestMapping(value = "/qrcode:
{theMessage}")
public void doImageRequest( HttpServletResponse response,
@PathVariable String theMessage,
HttpServletRequest request,
@ModelAttribute("QRScanBean") QRScanBean model)
Unfortunately, this structure seems to invoke some Spring code that rationalizes the URL. I found that /qrcode/www.icefaces.org
is correctly mapped, but the value that is in "theMessage" only winds up being "www.icefaces" and not the full string. Hence, the need to pass the request object into the mapping and retrieve the request URI with the entire QRCode string.
There is still an issue with being able to generate some strings with characters that break the technique, even with double URL encoding the content. It is possible to break the mapping as well, meaning the GET request fetching the image doesn't get mapped to the controller properly. It works fine for most cases, including www.icefaces.org. In 1.3, we should implement a base64 encoding method to cover all characters submitted to the server.
We have a Base64 encoding class in the mobi world, but no decoding class other than the one in sun.misc, (which is apparently a private API which may be removed at any time) so in 1.3, we should implement a decoder and pass the argument that way.