blob: 98df3bdf6ad638924cbba5f96d4ebe1a2df27b7a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*******************************************************************************
* Copyright (c) 2011, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.base;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.eclipse.help.internal.HelpPlugin.IHelpProvider;
import org.eclipse.help.internal.base.util.ProxyUtil;
import org.eclipse.help.internal.protocols.HelpURLStreamHandler;
/*
* Provides help document content via the internal application server.
* The org.eclipse.help plugin should not make any assumptions about
* where the content comes from.
*/
public class HelpProvider implements IHelpProvider {
/* (non-Javadoc)
* @see org.eclipse.help.internal.HelpPlugin.IHelpProvider#getHelpContent(java.lang.String, java.lang.String)
*/
@Override
public InputStream getHelpContent(String href, String locale) {
try {
URL helpURL = new URL("help", //$NON-NLS-1$
null, -1, href + "?lang=" + locale, HelpURLStreamHandler.getDefault()); //$NON-NLS-1$
return ProxyUtil.getStream(helpURL);
} catch (IOException ioe) {
return null;
}
}
}
|