I have two properties in macro which I want to access in Servlet.
below is my atlassian-plugin.xml
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="paynow"/>
<!-- add our web resources -->
<web-resource key="paynow-resources" name="paynow Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="paynow.css" location="/css/paynow.css"/>
<resource type="download" name="paynow.js" location="/js/paynow.js"/>
<resource type="download" name="images/" location="/images"/>
<resource type="velocity" name="template" location="/templates/paynow.vm"/>
<context>paynow</context>
</web-resource>
<xhtml-macro name="paynow" class="com.wgh.plugins.macro.Paynow" key='paynow-macro'>
<description key="paynow.macro.desc"/>
<category name="formatting"/>
<parameters>
<parameter name="login_credential" type="string"/>
<parameter name="transaction_key" type="string"/>
</parameters>
</xhtml-macro>
<servlet name="paynowservlet" key="paynow-servlet" class="com.wgh.plugins.servlet.PaynowServlet">
<description key="paynow-servlet">The Pay Now Servlet Plugin.</description>
<url-pattern>/paynowservlet</url-pattern>
</servlet>
</atlassian-plugin>
As you can see I have login_credential and transaction_key two properties which user will set at the time of configuring macro.
I want to access these two properties in Servlet
package com.wgh.plugins.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PaynowServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws IOException, ServletException {
response.getWriter().write("servlet responding to get request.");
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response
) throws IOException, ServletException {
response.getWriter().write("servlet responding to post.");
}
}
Can this be possible and how?
One possible solution can be; send properties to template and then forward them to Servlet in an Ajax request. This will expose my transaction key which I do not want.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.