Liferay portlet 中的自定义 servlet/jsp
我记得可以将类似的内容添加到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只有一条信息是你不知道的。
URL 将为
http://host:8080/cool-portlet/abcd/hw ....
如果您请求 servlet,则“web-context”目录名称必须遵循 ...
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 ...