Skip to content

Instantly share code, notes, and snippets.

View robertmassaioli's full-sized avatar

Robert Massaioli robertmassaioli

View GitHub Profile

Definitions

Field Description
CK Exists The new client key in the lifecle event already exists in the database
BURL Missing The new base url does not exist in the database
BURL Different The new base url does exist in the database but the new client key from the request is different to the one in the database
BURL Same The new base url does exist in the database and the client key from the request is the same as the one in the database

The "CK Exists" is a boolean and the BURL is a ternary.

// Verify that the request for this Atlassian Connect Web Panel has
// a valid JWT token from the Host Product
@FilterWith(JwtFilter.class)
public Result sayHello(Context context) {
// Get the tenant out of the Context (the tenant is provided by the JwtFilter)
final Tenant tenant = (Tenant) context.getAttribute(JwtFilter.ATLASSIAN_CONNECT_TENANT_ATTR);
// Pass the tenant baseUrl into the freemarker template as the variable productBaseUrl
return Results.html().render("productBaseUrl", tenant.baseUrl);
}
Utils = {};
Utils.getUrlParam = function (param, escape) {
try {
var regex = new RegExp(param + '=([^&]+)'),
data = regex.exec(window.location.search)[1];
// decode URI with plus sign fix.
return (escape) ? window.decodeURIComponent(data.replace(/\+/g, '%20')) : data;
} catch (e) {
return undefined;
<!DOCTYPE html>
<html lang="en">
<head>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- Atlassian User Interface (AUI) -->
<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.7.0/css/aui.css" media="all">
<script src="//aui-cdn.atlassian.com/aui-adg/5.7.0/js/aui.js"></script>
{
"generalPages": [
{
"url": "/hello-you.html",
"key": "hello-world",
"location": "system.top.navigation.bar",
"name": {
"value": "Click me"
}
}
{
"key": "com.atlassian.jira.static.tutorial.local",
"name": "Static Tutorial for JIRA (Local)",
"version": "1.0",
"description": "Provides a static example of an Atlassian Connect addon.",
"vendor": {
"name": "Your name",
"url": "http://www.your-site.com"
},
"baseUrl": "http://localhost:3311",
<!DOCTYPE html>
<html lang="en">
<head>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- Atlassian User Interface (AUI) -->
<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.7.0/css/aui.css" media="all">
<script src="//aui-cdn.atlassian.com/aui-adg/5.7.0/js/aui.js"></script>
</head>