ส่วนเสริมไม่ตอบสนอง รอหรือยกเลิก?

ฉันกำลังพยายามสร้างส่วนเสริม HelloWorld ง่ายๆ โดยใช้ atlassian-connect-play-java :

ตัวควบคุมของฉัน:

package controllers;
import views.html.*;
import com.atlassian.connect.play.java.controllers.AcController;
import com.google.common.base.Supplier;
import play.mvc.Controller;
import play.mvc.Result;
public class Application extends Controller {
     public static Result index()
    {
        return AcController.index(home(), descriptor());
    }
     private static Supplier<Result> descriptor()
    {
        return new Supplier<Result>()
        {
            @Override
            public Result get()
            {
                return AcController.descriptor();
            }
        };
    }
    private static Supplier<Result> home()
    {
        return new Supplier<Result>()
        {
            @Override
            public Result get()
            {
                return ok(index.render("Hello"));
            }
        };
    }
}

ไฟล์เส้นทางของฉัน:

GET / controllers.Application.index()
GET /assets/*file controllers.Assets.at(path="/public", file)
-> / ac.Routes

ไฟล์ดัชนีของฉัน: scala.html:

@(message: String)
@main("Welcome to Play") {
        <p>@message</p>

}

ไฟล์ main.scala.html ของฉัน:

@(title: String)(content: Html)
<!DOCTYPE html>
<html>
    <head>
        <title>@title</title>

        <script src="http://localhost:1990/confluence/atlassian-connect/all.js" type="text/javascript"></script>
        <link rel="stylesheet" href="/th//aui-cdn.atlassian.com/aui-adg/5.4.3/css/aui.css" media="all">
        <link rel="stylesheet" media="screen" href="/[email protected]("stylesheets/main.css")">
        <link rel="shortcut icon" type="image/png" href="/[email protected]("images/favicon.png")">
        <script src="@routes.Assets.at("javascripts/jquery-1.9.0.min.js")" type="text/javascript"></script>
    </head>
    <body>
        <div class="ac-content">
        <p>@content</p>
    </div>

    </body>
</html>

ไฟล์ atlassian-connect.json ของฉัน:

{
     "key": "${addonKey}",
     "name": "${addonName}",
     "description": "Atlassian Connect add-on",

     "baseUrl": "${localBaseUrl}",
     "vendor": {
        "name": "Atlassian",
        "url": "http://www.atlassian.com"
    },
     "authentication": {
         "type": "none"
     },

     "modules": {
    "generalPages": [
      {
        "url": "/",
        "key": "test-application",
        "location": "system.user",
        "name": {
          "value": "Test"
        }
      }
    ]
  },
  "scopes": ["READ"]
 }

เมื่อเรียกใช้แอปพลิเคชัน play ทุกอย่างทำงานได้ดี

แต่เมื่อฉันติดตั้งปลั๊กอินบนอินสแตนซ์ภายในของ Confluence และเปิดใช้งาน เนื้อหาของส่วนเสริมไม่เคยหยุดโหลด ฉันได้รับข้อความต่อไปนี้:

ส่วนเสริมไม่ตอบสนอง รอหรือยกเลิก?

ฉันพยายามค้นหาปัญหาแต่ทำไม่ได้ ใครสามารถช่วยได้บ้าง


person Balkis Khouni    schedule 08.02.2015    source แหล่งที่มา


คำตอบ (2)


ส่วนเสริม Atlassian Connect ทั้งหมดจำเป็นต้องโหลดทรัพยากร all.js Javascript ดังนั้นจึงสามารถสร้างสะพานเชื่อมระหว่างส่วนเสริมของคุณและสภาพแวดล้อมโฮสต์ได้ รถตักจะนั่งรอการสร้างสะพาน ซึ่งหมายความว่าคุณไม่ได้รวม all.js

ตัวอย่างการทำ: https://bitbucket.org/atlassian/whoslooking-connect/src/9066821fe168737b94d5b1e8ad520befb200ec99/app/views/poller.scala.html?at=master#cl-43

ตรวจสอบคอนโซลของเบราว์เซอร์ของคุณอีกครั้งเพื่อดูข้อผิดพลาด แต่หากวิธีนี้ไม่สามารถแก้ไขปัญหาของคุณได้ มันอาจจะให้คำแนะนำว่าปัญหาคืออะไร ตรวจสอบแท็บเครือข่าย (อาจมีการโหลดซ้ำ) เพื่อให้แน่ใจว่าทรัพยากรทั้งหมดของคุณโหลด

เฟรมเวิร์กบางตัวยังปล่อยส่วนหัว X-Frame-Origin: SAMEORIGIN ตามค่าเริ่มต้น ทำให้เบราว์เซอร์ไม่โหลดเนื้อหาของ iframe เลย ซึ่งไม่ควรเป็นเช่นนั้นกับ atlassian-connect-play

person Travis    schedule 09.02.2015
comment
ใช่ ต้องใส่สิ่งนี้ไว้ในหัว: <script type="text/javascript" src="https://bitbucket.org/atlassian-connect/all.js"></script> - person Nate Cook; 04.12.2015

ขอขอบคุณสำหรับการตอบสนองของคุณ :)

URL ที่ฉันระบุในตัวอธิบายไม่ถูกต้อง การบรรจบกันไม่ยอมรับ "/" แบบธรรมดาหรือ URL ว่าง "" ดังนั้นฉันต้องเปลี่ยนเป็น "/ home" และเปลี่ยนไฟล์เส้นทางของฉันด้วย

person Balkis Khouni    schedule 12.02.2015