use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.
the class ActionSequenceParameterContentGenerator method createContent.
@Override
public void createContent(OutputStream outputStream) throws Exception {
IParameterProvider requestParams = getRequestParameters();
IParameterProvider pathParams = getPathParameters();
if ((requestParams != null) && (requestParams.getStringParameter("path", null) != null)) {
path = URLDecoder.decode(requestParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
} else if ((pathParams != null) && (pathParams.getStringParameter("path", null) != null)) {
// $NON-NLS-1$
path = URLDecoder.decode(pathParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
}
if (path != null && path.length() > 0) {
IUnifiedRepository unifiedRepository = PentahoSystem.get(IUnifiedRepository.class, null);
RepositoryFile file = unifiedRepository.getFile(path);
String buffer = XactionUtil.doParameter(file, requestParams, PentahoSessionHolder.getSession());
outputStream.write(buffer.toString().getBytes(LocaleHelper.getSystemEncoding()));
}
}
use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.
the class ActionSequenceParameterUiContentGenerator method createContent.
@Override
public void createContent(OutputStream outputStream) throws Exception {
IParameterProvider requestParams = getRequestParameters();
IParameterProvider pathParams = getPathParameters();
if ((requestParams != null) && (requestParams.getStringParameter("path", null) != null)) {
path = URLDecoder.decode(requestParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
} else if ((pathParams != null) && (pathParams.getStringParameter("path", null) != null)) {
// $NON-NLS-1$
path = URLDecoder.decode(pathParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
}
if (path != null && path.length() > 0) {
IUnifiedRepository unifiedRepository = PentahoSystem.get(IUnifiedRepository.class, null);
RepositoryFile file = unifiedRepository.getFile(path);
// $NON-NLS-1$
HttpServletRequest httpRequest = (HttpServletRequest) pathParams.getParameter("httprequest");
// $NON-NLS-1$
HttpServletResponse httpResponse = (HttpServletResponse) pathParams.getParameter("httpresponse");
String buffer = XactionUtil.executeScheduleUi(file, httpRequest, httpResponse, PentahoSessionHolder.getSession(), outputHandler.getMimeTypeListener());
outputStream.write(buffer.toString().getBytes(LocaleHelper.getSystemEncoding()));
}
}
use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.
the class ActionSequenceParameterUiContentGenerator method getRequestParameters.
@SuppressWarnings("unchecked")
private IParameterProvider getRequestParameters() {
if (this.parameterProviders == null) {
return new SimpleParameterProvider();
}
// $NON-NLS-1$
IParameterProvider requestParams = this.parameterProviders.get("request");
SimpleParameterSetter parameters = new SimpleParameterSetter();
Iterator requestParamIterator = requestParams.getParameterNames();
while (requestParamIterator.hasNext()) {
String param = (String) requestParamIterator.next();
parameters.setParameter(param, requestParams.getParameter(param));
}
this.requestParameters = parameters;
return parameters;
}
use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.
the class WsdlPageTest method testBadServiceName.
@Test
public void testBadServiceName() throws Exception {
// $NON-NLS-1$
assertNotNull("Logger is null", contentGenerator.getLogger());
Map<String, IParameterProvider> parameterProviders = new HashMap<String, IParameterProvider>();
parameterProviders.put(IParameterProvider.SCOPE_REQUEST, new SimpleParameterProvider());
SimpleParameterProvider pathParams = new SimpleParameterProvider();
// $NON-NLS-1$//$NON-NLS-2$
pathParams.setParameter("path", "/bogus");
// $NON-NLS-1$
parameterProviders.put("path", pathParams);
contentGenerator.setParameterProviders(parameterProviders);
contentGenerator.createContent();
String content = new String(out.toByteArray());
assertTrue(content, content.contains(Messages.getInstance().getErrorString("WebServiceContentGenerator.ERROR_0006_SERVICE_IS_INVALID", // $NON-NLS-1$ //$NON-NLS-2$
"bogus")));
}
use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.
the class RuntimeContextTest method makeParameterProviders.
private Map<String, IParameterProvider> makeParameterProviders(final IPentahoSession session) {
final Map<String, IParameterProvider> res = new HashMap<>();
res.put("jvm", new JVMParameterProvider());
res.put(SecurityParameterProvider.SCOPE_SECURITY, new SecurityParameterProvider(session));
return res;
}
Aggregations