Package nxt.http
Class EncodeQRCode
java.lang.Object
nxt.http.APIServlet.APIRequestHandler
nxt.http.EncodeQRCode
The EncodeQRCode API converts a UTF-8 string to a base64-encoded jpeg image of a 2-D QR (Quick Response) code, using the ZXing library.
The output qrCodeBase64 string can be incorporated into an in-line HTML image like this: <img src="data:image/jpeg;base64,qrCodeBase64">
The output qrCodeBase64 can be input to the DecodeQRCode API to recover the original qrCodeData.
Request parameters:
- qrCodeData - A UTF-8 text string.
- width - The width of the output image in pixels, optional.
- height - The height of the output image in pixels, optional.
Notes:
- The output image consists of a centrally positioned square QR code with a size which is an integer multiple of the minimum size, surrounded by sufficient white padding to achieve the requested width/height.
- The default width/height of 0 results in the minimum sized output image, with one pixel per black/white region of the QR code and no extra padding.
- To eliminate padding, the requested width/height must be an integer multiple of the minimum.
Response fields:
- qrCodeBase64 - A base64 string encoding a jpeg image of the QR code.
-
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected booleanprotected org.json.simple.JSONStreamAwareprocessRequest(javax.servlet.http.HttpServletRequest request) protected booleanprotected final booleanMethods inherited from class nxt.http.APIServlet.APIRequestHandler
canHaveRecipient, getAPITags, getCreateTransactionTypes, getFileParameters, getParameters, getSensitiveParameters, isIgnisOnly, isTextArea, processRequest, requiredBlockUpdateLock, requireFullClient, requirePassword, startDbTransaction
-
Method Details
-
processRequest
protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest request) throws NxtException - Specified by:
processRequestin classAPIServlet.APIRequestHandler- Throws:
NxtException
-
requirePost
protected final boolean requirePost()- Overrides:
requirePostin classAPIServlet.APIRequestHandler
-
allowRequiredBlockParameters
protected boolean allowRequiredBlockParameters()- Overrides:
allowRequiredBlockParametersin classAPIServlet.APIRequestHandler
-
requireBlockchain
protected boolean requireBlockchain()- Overrides:
requireBlockchainin classAPIServlet.APIRequestHandler
-
isChainSpecific
protected boolean isChainSpecific()- Overrides:
isChainSpecificin classAPIServlet.APIRequestHandler
-