简体   繁体   English

定制帮助选项卡中的Eclipse RCP错误404

[英]Eclipse RCP error 404 in custom help tab

I want to add some advanced functionality to help browser in an Eclipse RCP application based on Eclipse 3.7. 我想添加一些高级功能来帮助基于Eclipse 3.7的Eclipse RCP应用程序中的浏览器。 I've created a separate plugin for help functionality and extended org.eclipse.help.webapp.AbstractView: 我创建了一个用于帮助功能的单独插件,并扩展了org.eclipse.help.webapp.AbstractView:

import java.util.Locale;

import org.eclipse.help.webapp.AbstractView;

public class CustomView extends AbstractView {

    @Override
    public String getImageURL() {
        return "";
    }

    @Override
    public char getKey() {
        return 0;
    }

    @Override
    public String getName() {
        return "Custom";
    }

    @Override
    public String getTitle(Locale arg0) {
        return "Test Title";
    }

    @Override
    public String getURL() {
        return "/";
    }

    @Override
    public String getBasicURL() {
        return getURL();
    }
}

I've added the extension org.eclipse.help.webapp.view pointing to this class. 我添加了扩展org.eclipse.help.webapp.view指向该类。

In the same plugin I have a folder plugin/help with file CustomView.jsp: 在同一个插件中,我有一个文件夹Plugin / help,带有文件CustomView.jsp:

<html>
<head>
<title>View Test</title>
</head>

<body>
<h1>Hellp JSP!</h1>
</body>
</html>

This folder is added to build.properties file. 此文件夹已添加到build.properties文件。

Another tab appears in help contents browser window as expected, but the only thing I get is 404 error inside this tab's frame: 另一个标签按预期出现在帮助内容浏览器窗口中,但我唯一得到的是此标签框架内的404错误:

HTTP ERROR 404 Problem accessing /help/CustomView.jsp. HTTP错误404访问/help/CustomView.jsp时出现问题。 Reason: 原因:

 /CustomView.jsp 

Powered by Jetty:// 由Jetty://提供技术支持

What am I doing wrong and how to get this tab contents to display properly? 我在做什么错以及如何使此选项卡内容正确显示?

I've found the reason this failed. 我已经找到失败的原因。 After dissecting the help plugin I've found additional extensions defined that allowed Equinox to use help files supplied in the plugin project as accessible resources. 剖析帮助插件后,我发现已定义了其他扩展名,这些扩展名允许Equinox将插件项目中提供的帮助文件用作可访问资源。 This is what I put in plugin.xml in extensions' section: 这是我在扩展部分的plugin.xml中输入的内容:

<extension point="org.eclipse.help.webapp.view">
      <view class="plugin.CustomView"></view>
</extension>

<extension point="org.eclipse.equinox.http.registry.httpcontexts">
      <httpcontext id="help">
         <resource-mapping path="/"> </resource-mapping>
      </httpcontext>
</extension>

<extension point="org.eclipse.equinox.http.registry.resources">
      <resource alias="/help" base-name="/help" httpcontextId="help"> </resource>
</extension>

The firs one is the actual view definition class. 第一类是实际的视图定义类。 Next is the help context pointing on the plugin's root and the last is actual folder containing JSP files, it's position relative to the plugin's root and alias as available for the browser. 接下来是指向插件根目录的帮助上下文,最后一个是包含JSP文件的实际文件夹,相对于插件根目录和别名的位置对浏览器可用。 After adding those Information Center in my application displays my test HTML code in the new tab. 在我的应用程序中添加了这些信息中心之后,在新标签中显示我的测试HTML代码。 The same goes for other extension points in help plugin that add new JSP-based views in Information Center. 帮助插件中的其他扩展点(在信息中心中添加基于JSP的新视图)也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM