}
}
// Create the web driver configuration - this information
// comes from mcs-config.xml in normal MCS operation.
WebDriverConfiguration webdConfig =
createWebDriverConfig();
// set encoding if available
// ported from 4.2.0, see vbm 2007070313
if (marinerRequestContext != null) {
webdConfig.setCharacterEncoding(
marinerRequestContext.getCharacterEncoding());
}
// Create a pipeline configuration which knows about the web
// driver configuration that we've specified, and the default
// MCS dynamic pipeline configuration.
XMLPipelineConfiguration configuration =
createPipelineConfiguration(webdConfig);
final XMLPipelineContext pipelineContext =
createPipelineContext(configuration,
httpRequest, httpResponse);
setUpJSessionPreprocessors(pipelineContext, httpRequest,
remoteProjectName);
storeRemoteProject(pipelineContext, remoteProjectName);
// Push the URL of the resource that we need to retrieve onto
// the context - this allows relative references in any
// returned markup to be resolved.
pipelineContext.pushBaseURI(remappedURL);
// Create a pipeline
XMLPipeline pipeline = pipelineFactory.createPipeline
(pipelineContext);
XMLFilter filter = pipelineFactory.createPipelineFilter(
pipeline, true);
// Create a serializer that will output to the response.
ServletOutputStream outputStream = httpResponse.getOutputStream();
XMLSerializer serializer = getSerializer(outputStream);
filter.setContentHandler(serializer.asContentHandler());
// Create and initialise the request process.
HTTPRequestOperationProcess requestOperation =
new HTTPRequestOperationProcess();
requestOperation.setFollowRedirects(
Boolean.toString(webdConfig.getFollowRedirects()));
requestOperation.setUrlString(remappedURL);
requestOperation.setRequestType(HTTPRequestType.GET);
// todo this is wrong as the request operation timeout is in
// todo seconds but the configuration is in milliseconds.
Period timeout = Period.treatNonPositiveAsIndefinitely(
webdConfig.getTimeoutInMillis());
requestOperation.setTimeout(timeout);
// This is necessary in order for the request process to be
// able to pick up the headers, parameters, cookies etc.
WebDriverAccessor webdAccessor = createWebDriverAccessor(