Skip to content

Instantly share code, notes, and snippets.

@ControllerAdvice("com.storageservice.document")
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(MaxUploadSizeExceededException.class)
@ResponseStatus(HttpStatus.PAYLOAD_TOO_LARGE)
public ResponseEntity<Object> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException maxUploadSizeExceededException,
WebRequest request) {
return buildErrorResponse("File size too large!", HttpStatus.PAYLOAD_TOO_LARGE);
}
<cffunction name="JSONUtil" access="private" returntype="string" output="false" hint="Serialize complex object into JSON">
<cfargument name="obj" type="any" required="true" hint="Object which will be converted into JSON" />
<cfset var returnValue = createObject("Java","java.lang.StringBuilder") />
<cfset var currentMetaData = getMetaData(obj) />
<cfif isStruct(currentMetaData) AND structKeyExists(currentMetaData, "TYPE") AND compareNoCase(currentMetaData.TYPE, "component") EQ 0>
<cfset returnValue.append("{") />
<cfset var isNOTFirstElem = false />
<cffunction name="importLeadList" description="Import lead List" access="remote" output="false" returnformat="JSON">
<cfargument name="qqfile" type="string" required="true" hint="upload file" />
<cfscript>
var local = structNew();
local.response = structNew();
local.requestData = GetHttpRequestData(); //Get the request headers and body
local.uploadedFileInfo = structNew();
local.imageRecordInsertStatus = true;
local.imageUploadDirectory = "#application.baseDir#\LeadImportFiles\";
@roulupen
roulupen / CountDiff.cfm
Created November 10, 2014 16:07
Difference of COUNT(*) between Query of Query(QoQ) and normal SQL Query
<!---SQL Query to get Artists --->
<cfquery name="qryGetArtists" datasource="cfartgallery">
SELECT * FROM ARTISTS
</cfquery>
<cfdump var="#qryGetArtists#" label="SQL Query to get Artists"><br/>
<!--- COUNT(*) by SQL Query --->
<cfquery name="qryGetArtistCount" datasource="cfartgallery">
SELECT COUNT(*) AS ArtistCount FROM ARTISTS WHERE ARTISTID = 100000
$('#selectedFiles-edit-win').kendoUpload({
multiple: true,
localization: {
select: 'Select File(s)'
},
async: {
saveUrl: "/CFCS/AjaxFactory.cfc?method=uploadFile",
removeUrl: "/CFCS/AjaxFactory.cfc?method=cancelUploadedFile",
autoUpload: true
},
Code block in lua file
– Define a group
local gameBoardGroup = display.newGroup()
– Define background to display count down
local countDownOverlay = display.newRect(0, 0, displayWidth, displayHeight)
countDownOverlay:setFillColor(140, 140, 140) – Set the color of the block
countDownOverlay.alpha = 0.5 – Define opacity to make it translucent
– Insert backround to the display group
gameBoardGroup : insert( countDownOverlay )
– Define label to display number
<cfset request.getSMSS = structNew() />
<cfhttp
method="get"
url="https://api.plivo.com/v1/Account/{Auth ID}/Message/"
result="request.getSMSS">
<cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("{AUTH_ID}:{AUTH_TOKEN}")#" />
<cfhttpparam type="url" name="limit" value="10" />
<cfhttpparam type="url" name="offset" value="1" />
</cfhttp>
<cfdump var="#request.getSMSS#">
<cfset request.getSMSS = structNew() />
<cfhttp
method="get"
url="https://api.plivo.com/v1/Account/{Auth ID}/Message/"
result="request.getSMSS" username="USER_NAME" password="PASSWORD">
<cfhttpparam type="url" name="limit" value="10" />
<cfhttpparam type="url" name="offset" value="1" />
</cfhttp>
<cfdump var="#request.getSMSS#">
<?xml version="1.0" encoding="ISO-8859-1"?>
<employees>
<employee department="ENG">
<name id="1">Upendra Roul</title>
<position>Software Developer</author>
<joinyear>2010</joinyear>
<salary>6000</price>
</employee>
<employee category="ENG">
<name id="1">Jay Prakash</title>