У меня проблема с portletRequestDispatcher, из-за которой возникает исключение UnsupportedOperationException.
Итак, часть моей страницы jsp выглядит так:
<div id="correspTree">
<%@include file="html/fragment/correspTree.jsp"%>
</div>
. Когда я изменяю значение на входе, он вызывает функцию javascript:
function refreshTree(inputElement){
var correspCode = $(inputElement).val();
var url = $("#refreshTreeURL").val();
$.ajax({
url : url,
data : {
correspCode:correspCode
},
type: 'POST',
success : function(data) {
console.log(data);
}
});
}
Затем я выполняю свои функции:
private void refreshTree(ResourceRequest resourceRequest, ResourceResponse resourceResponse){
PortletRequestDispatcher portletRequestDispatcher = getPortletContext().getRequestDispatcher("html/fragment/correspTree.jsp");
String correspCode = ParamUtil.getString(resourceRequest, KEY_CORRESP_CODE);
Map<Correspondent, Map<Correspondent, List<Correspondent>>> correspondentMap = CorrespondentLocalServiceUtil.findCorrespondentHierarchy(correspCode);
Map<String, Boolean> resultRightMap = new HashMap<String, Boolean>();
resourceRequest.setAttribute(KEY_CORRESP_MAP, correspondentMap);
resourceRequest.setAttribute(KEY_RESULT_RIGHT_MAP, resultRightMap);
try {
portletRequestDispatcher.include(resourceRequest, resourceResponse);
} catch (PortletException e) {
log.error(e);
} catch (IOException e) {
log.error(e);
}
}
И когда я прибываю в portletRequestDispatcher.include, я получаю исключение UnsupportedOperationException:
2019-01-09 16: 06: 30.210 ОШИБКА [http-nio-8080-exec-3] [AbstractResultRightPortlet: 182] null
javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.UnsupportedOperationException
в com.liferay.portlet.internal.PortletRequestDispatcherImpl.dispatch (PortletRequestDispatcherImpl.java:301)
в com.liferay.portlet.internal.PortletRequestDispatcherImpl.include (PortletRequestDispatcherImpl.java:128)
в com.eurofins.cdxconnect.portlet.AbstractResultRightPortlet.refreshTree (AbstractResultRightPortlet.java:180)
в com.eurofins.cdxconnect.portlet.AbstractResultRightPortlet.serveResource (AbstractResultRightPortlet.java:91)
в com.liferay.portlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:146)
в com.liferay.portlet.ScriptDataPortletFilter.doFilter (ScriptDataPortletFilter.java:86)
в com.liferay.portlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:140)
на com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter (PortletFilterUtil.java:78)
на com.liferay.portal.kernel.servlet.PortletServlet.service (PortletServlet.java:108)
на javax.servlet.http.HttpServlet.service (HttpServlet.java:741)
в org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service (EndpointRegistration.java:153)
в org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest (ResponseStateHandler.java:62)
в org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch (DispatchTargets.java:118)
в org.eclipse.equinox.http.servlet.internal.servlet.RequestDispatcherAdaptor.forward (RequestDispatcherAdaptor.java:40)
в com.liferay.portlet.internal.InvokerPortletImpl.invoke (InvokerPortletImpl.java:603)
в com.liferay.portlet.internal.InvokerPortletImpl.invokeResource (InvokerPortletImpl.java:727)
в com.liferay.portlet.internal.InvokerPortletImpl.serveResource (InvokerPortletImpl.java:546)
в com.liferay.portal.monitoring.internal.portlet.MonitoringInvokerPortlet.serveResource (MonitoringInvokerPortlet.java:305)
в com.liferay.portlet.internal.PortletContainerImpl._serveResource (PortletContainerImpl.java:985)
в com.liferay.portlet.internal.PortletContainerImpl.lambda $ serveResource $ 4 (PortletContainerImpl.java:254)
в com.liferay.portlet.internal.PortletContainerImpl._preserveGroupIds (PortletContainerImpl.java:390)
в com.liferay.portlet.internal.PortletContainerImpl.serveResource (PortletContainerImpl.java:247)
Спасибо за вашу помощь