Liferay portlet 中的自定义 servlet/jsp

发布于 2024-11-09 01:17:14 字数 2259 浏览 0 评论 0原文

我记得可以将类似的内容添加到 portlet 的 web.xml 中,并且可以通过 http 访问 jsp 或 servlet ://host:8080/abcd/hw ....

<servlet>
    <servlet-name>myjsp</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
    <init-param>
        <param-name>hello</param-name>
        <param-value>test</param-value>
    </init-param>
</servlet>
<servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>com.example.Servlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>myjsp</servlet-name>
    <url-pattern>/jsp/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/abcd/hw</url-pattern>
    <load-on-startup>1</load-on-startup>
</servlet-mapping>

但是现在它有点像

INFO  [PortalImpl:4243] Current URL /abcd/hw generates exception: null

被过滤掉了或者什么的,但我在调试它时没有发现任何东西。

我闻到了这里的问题

13:48:58,587 DEBUG [ETagFilter:116] [http-8080-1]> com.liferay.portal.servlet.filters.etag.ETagFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [I18nFilter:116] [http-8080-1]=> com.liferay.portal.servlet.filters.i18n.I18nFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,589 DEBUG [SecureFilter:138] https is not required
13:48:58,589 DEBUG [SecureFilter:172] Not securing http://localhost:8080/web/guest/abcd/hw
13:48:58,590 DEBUG [SecureFilter:116] [http-8080-1]==> com.liferay.portal.servlet.filters.secure.SecureFilter /web/guest/abcd/hw
13:48:58,645 INFO  [PortalImpl:4437] Current URL /abcd/hw generates exception: null
13:48:58,646 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,647 DEBUG [SecureFilter:138] https is not required
13:48:58,647 DEBUG [SecureFilter:172] Not securing http://localhost:8080/c/portal/status
13:48:58,648 DEBUG [SecureFilter:116] [http-8080-1]===> com.liferay.portal.servlet.filters.secure.SecureFilter /c/portal/status
13:48:58,649 DEBUG [MainServlet:359] Process service request

I remember it was possible to add something like this to web.xml of a portlet and one could reach the jsp or servlet at http://host:8080/abcd/hw ....

<servlet>
    <servlet-name>myjsp</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
    <init-param>
        <param-name>hello</param-name>
        <param-value>test</param-value>
    </init-param>
</servlet>
<servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>com.example.Servlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>myjsp</servlet-name>
    <url-pattern>/jsp/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/abcd/hw</url-pattern>
    <load-on-startup>1</load-on-startup>
</servlet-mapping>

But now it kinda resolves into

INFO  [PortalImpl:4243] Current URL /abcd/hw generates exception: null

like if it was filtered away or something, but I haven't found anything when debugging it.

I smell the problem here

13:48:58,587 DEBUG [ETagFilter:116] [http-8080-1]> com.liferay.portal.servlet.filters.etag.ETagFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [I18nFilter:116] [http-8080-1]=> com.liferay.portal.servlet.filters.i18n.I18nFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,589 DEBUG [SecureFilter:138] https is not required
13:48:58,589 DEBUG [SecureFilter:172] Not securing http://localhost:8080/web/guest/abcd/hw
13:48:58,590 DEBUG [SecureFilter:116] [http-8080-1]==> com.liferay.portal.servlet.filters.secure.SecureFilter /web/guest/abcd/hw
13:48:58,645 INFO  [PortalImpl:4437] Current URL /abcd/hw generates exception: null
13:48:58,646 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,647 DEBUG [SecureFilter:138] https is not required
13:48:58,647 DEBUG [SecureFilter:172] Not securing http://localhost:8080/c/portal/status
13:48:58,648 DEBUG [SecureFilter:116] [http-8080-1]===> com.liferay.portal.servlet.filters.secure.SecureFilter /c/portal/status
13:48:58,649 DEBUG [MainServlet:359] Process service request

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无畏 2024-11-16 01:17:14

只有一条信息是你不知道的。

URL 将为 http://host:8080/cool-portlet/abcd/hw ....

如果您请求 servlet,则“web-context”目录名称必须遵循 ...

webapp/
    cool-portlet/
    ROOT/

There is just one piece of information that you are not aware of.

The URL would be http://host:8080/cool-portlet/abcd/hw ....

if you are requesting a servlet, the 'web-context' directory name must follow ...

webapp/
    cool-portlet/
    ROOT/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文