[jboss-user] [JBoss Portal] - Re: Search Portlet?
albertodominguezs
do-not-reply at jboss.com
Tue Jul 28 16:16:37 EDT 2009
Hi Tom,
I didn't get any help or info. However, while I was debugging a custom LoginModule I found some really useful lines inside the org.jboss.portal.core.cms.ui.admin.CMSAdminPortlet.java.
Hope these lines work for you.
| package org.jboss.portal.core.cms.ui.admin;
|
| // ...
|
| public class CMSAdminPortlet extends JBossPortlet
| {
|
| // ...
|
| private void internalDoView(JBossRenderRequest rReq, JBossRenderResponse rRes)
| throws CMSException, PortletException, IOException
| {
|
| // ...
|
| else if (CMSAdminConstants.OP_VIEWSEARCHRESULTS.equals(op))
| {
| rRes.setContentType("text/html");
|
| String textQuery = rReq.getParameter("search");
| FederatedQuery query = new FederatedQuery(textQuery);
|
| JCRQueryConverter converter = new JCRQueryConverter();
|
| List files;
| try
| {
| Command searchCommand = CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query));
| files = (List)CMSService.execute(searchCommand);
| }
| catch (CMSException e)
| {
| e.printStackTrace();
| files = new ArrayList();
| }
| catch (QueryConversionException e)
| {
| files = new ArrayList();
| rReq.setAttribute("conversionError", Boolean.TRUE);
| }
| rReq.setAttribute("files", files);
| rReq.setAttribute("textQuery", textQuery);
|
| javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/searchResults.jsp");
| prd.include(rReq, rRes);
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246551#4246551
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246551
More information about the jboss-user
mailing list