Package nxt.http
Class EncodeQRCode
- java.lang.Object
-
- nxt.http.APIServlet.APIRequestHandler
-
- nxt.http.EncodeQRCode
-
public final class EncodeQRCode extends APIServlet.APIRequestHandler
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.
-
-
Field Summary
-
Fields inherited from class nxt.http.APIServlet.APIRequestHandler
DESCRIPTION_FIELD, MESSAGE_FIELD, NAME_FIELD
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
allowRequiredBlockParameters()
protected org.json.simple.JSONStreamAware
processRequest(javax.servlet.http.HttpServletRequest request)
protected boolean
requireBlockchain()
protected boolean
requirePost()
-
Methods inherited from class nxt.http.APIServlet.APIRequestHandler
getAPITags, getFileParameter, getParameters, processRequest, requireFullClient, requirePassword, startDbTransaction
-
-
-
-
Method Detail
-
processRequest
protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest request) throws NxtException
- Specified by:
processRequest
in classAPIServlet.APIRequestHandler
- Throws:
NxtException
-
requirePost
protected final boolean requirePost()
- Overrides:
requirePost
in classAPIServlet.APIRequestHandler
-
allowRequiredBlockParameters
protected boolean allowRequiredBlockParameters()
- Overrides:
allowRequiredBlockParameters
in classAPIServlet.APIRequestHandler
-
requireBlockchain
protected boolean requireBlockchain()
- Overrides:
requireBlockchain
in classAPIServlet.APIRequestHandler
-
-