Questions tagged [apache-velocity]

Apache Velocity is a Java-based template engine. It can be used to dynamically generate web pages, email messages, source code, or any other text file.

Apache Velocity is a Java-based template engine. It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.

Velocity can be used to dynamically generate web pages, email messages, source code, or any other text file.

Apache Velocity is a project of the Apache Software Foundations (ASF).

It include 2 releases of Engine and Tools:

Latest Engine 2.0 released in 2017-08-06

Latest Tools 2.0 released in 2010-05-10

Site http://velocity.apache.org/

74 questions
2
votes
1 answer

How to generate self closing XML elements using Apache Velocity template, if the value is null or empty

Is there any shorter way to generate xml elements using Apache Velocity, with elements with self closing tags if the value is null or empty. However this can be achieved by putting - #if #else #end. but I need some shorter way to do this as I need…
Ajeet Maurya
  • 622
  • 5
  • 16
2
votes
1 answer

Dot after Reference in Body Mapping Template (AWS API Gateway)

Is it possible to use a dot directly after a reference in API Gateway's Body Mapping Templates? I do string concatination like this: #set($region = "us-east-2") #set($apiid = "$context.apiId") #set($stage = "$context.stage") #set($path =…
1
vote
1 answer

replace 2 strings at a time in velocity template

SERIAL_NUMBER {SerialNumber} not found in iLPN/Tote {IlpnId} I want to replace {SerialNumber} with some value and also want to replace {abcd} with some value at a time. I am able to replace either {SerialNumber} or {abcd} one at a time but not…
1
vote
1 answer

Is velocity.log created for Apache Velocity v2.0 by default?

Since with Apache Velocity v2.0 we have moved to SLF4J, how to handle creation of velocity.log for serverless calls? For example if an AWS lambda function is calling the java code using VTL, during runtime velocity.log will not be able to create.…
sraipuria
  • 11
  • 2
1
vote
0 answers

How to stop loading of Post servlet on Page reload?

I'm new to web development and currently trying to build a custom Jira Plugin, where I'm rendering velocity template files on UI for Get and Post Servlet requests. On UI, we are loading a velocity template file to render the Form which consist of a…
1
vote
1 answer

Import of apache velocity in gradle downgrades HttpServletResponse

I have a spring boot project with the following code: import org.springframework.web.context.request.NativeWebRequest; import javax.servlet.http.HttpServletResponse foo(NativeWebRequest req){ HttpServletResponse res =…
peer
  • 4,171
  • 8
  • 42
  • 73
1
vote
1 answer

How to change velocity template in Intellij for catch statement

I want to print in catch block directly with logger like: Logger.getLogger(Example.class.getName()).log(Level.SEVERE, null, ex); I checked Velocity template in Settings - File and Code Templates for Catch Statement body By Default it is given with…
Ranjit M
  • 138
  • 4
  • 4
  • 17
1
vote
1 answer

How to get the maximum value in an array in Velocity Template Language (VTL)

Using Velocity Template Language (VTL), I would like to get the maximum value of an array. I was looking quite a while through the documentation of Apache Velocity but couldn't find a method for doing this. Here is my sample array: #set($array =…
SteffPoint
  • 479
  • 2
  • 9
  • 24
1
vote
0 answers

Handling Nested Integration response from aws apigateway

I have a JSON response from AWS Lambda going to AWS API-GATEWAY as follows :- [ { "key1" : "fruit", "key2" : "citrus", "key3" : { "key31" : "lemon", "key32" : "orange", …
1
vote
1 answer

WebHook receives string data with + (plus) where whitespace should be

My goal is to receive WhatsApp messages via API Gateway and store these in DynamoDB. I receive the data the following way through my webhook. My problem is that when Body should be saved as "Hello world" into the database. It is saved as…
Joey Coder
  • 3,199
  • 8
  • 28
  • 60
1
vote
1 answer

Check if variable is empty in PhpStorm file template

I'm trying to follow Zend coding standard for comments blocks for functions and I've stuck during PHP Function Doc Commentcustomization. This is my current code look /** ${PARAM_DOC} #if(${PARAM_DOC}) * #end * @return…
Maciej Król
  • 382
  • 1
  • 8
1
vote
1 answer

Unable to find resource although file is in classpath

I have added Apache Velocity 1.7 to my spring 3.2.5.RELEASE application in order to convert html to string and send mail. My spring context is defined below:
user1999453
  • 1,297
  • 4
  • 29
  • 65
1
vote
1 answer

Achieving recursion in simple Velocity report

I'm generating a velocity report. I currently iterate through a collection of documents (IDs), for each of these I can get a list of relationships. What I'd like to do is for each these IDs is to call the same function to see if there any further…
Andyww
  • 209
  • 3
  • 13
1
vote
1 answer

Apache Velocity - if clause

I use Apache Velocity for create an e-mail template. I have a mail message that contain a table with a list of elements, for create it I had used a #foreach. In this table I'll add a column contained a conditional string, If the element is empty the…
Apo
  • 157
  • 3
  • 17
1
vote
1 answer

How to add image as an 'inline attachment' with Apache Velocity and JavaMail

I know this question resembles to this question here. But, I am using a different email methodology with Spring Framework so adding a new question. I have an image stored at /tmp/upload/image path in my machine. Taking details from the same question…
Vishal A
  • 144
  • 3
  • 17