diff options
author | Chris Goldthorpe | 2009-10-16 00:00:09 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2009-10-16 00:00:09 +0000 |
commit | d3b17af4f015f845c1fa0354d87c61f37d0f6b2c (patch) | |
tree | cd36eceb371618711724764046b0f72e9fe5b0f1 /org.eclipse.help.webapp | |
parent | 05e895ea586f727c98b559f0d8e501036bd90253 (diff) | |
download | eclipse.platform.ua-d3b17af4f015f845c1fa0354d87c61f37d0f6b2c.tar.gz eclipse.platform.ua-d3b17af4f015f845c1fa0354d87c61f37d0f6b2c.tar.xz eclipse.platform.ua-d3b17af4f015f845c1fa0354d87c61f37d0f6b2c.zip |
Bug 292483 [Help] Context Servlet does not return the value for the title attribute:
Diffstat (limited to 'org.eclipse.help.webapp')
-rw-r--r-- | org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java index ff187fa2a..53f4bd0e1 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.help.IContext; +import org.eclipse.help.IContext2; import org.eclipse.help.IHelpResource; import org.eclipse.help.internal.HelpPlugin; import org.eclipse.help.internal.Topic; @@ -43,7 +44,7 @@ public class ContextServlet extends HttpServlet { resp.setContentType("application/xml; charset=UTF-8"); //$NON-NLS-1$ String id = req.getParameter(PARAMETER_ID); if (id != null) { - IContext context = HelpPlugin.getContextManager().getContext(id, locale); + IContext context = getContext(locale, id); if (context != null) { serialize(context, resp.getWriter()); } @@ -55,11 +56,24 @@ public class ContextServlet extends HttpServlet { resp.sendError(400); // bad request; missing parameter } } + + protected IContext getContext(String locale, String id) { + IContext context = HelpPlugin.getContextManager().getContext(id, locale); + return context; + } private void serialize(IContext context, Writer out) throws IOException { out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ - out.write('<' + Context.NAME + ">\n"); //$NON-NLS-1$ + out.write('<' + Context.NAME ); + if (context instanceof IContext2) { + String title = ((IContext2)context).getTitle(); + if (title != null && title.length() > 0) { + out.write(" title=\"" + title + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + out.write(">\n"); //$NON-NLS-1$ out.write(" <description>" + context.getText() + "</description>\n"); //$NON-NLS-1$ //$NON-NLS-2$ + IHelpResource[] topics = context.getRelatedTopics(); for (int i=0;i<topics.length;++i) { out.write(" <" + Topic.NAME); //$NON-NLS-1$ |