com.meterware.httpunit.WebRequest.getSourceScriptingHandler()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中com.meterware.httpunit.WebRequest.getSourceScriptingHandler()方法的一些代码示例,展示了WebRequest.getSourceScriptingHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebRequest.getSourceScriptingHandler()方法的具体详情如下:
包路径:com.meterware.httpunit.WebRequest
类名称:WebRequest
方法名:getSourceScriptingHandler

WebRequest.getSourceScriptingHandler介绍

暂无

代码示例

代码示例来源:origin: httpunit/httpunit

/**
 * Returns the resource specified by the request. Does not update the window or load included framesets.
 * May return null if the resource is a JavaScript URL which would normally leave the client unchanged.
 */
public WebResponse getResource( WebRequest request ) throws IOException {
  _client.tellListeners( request );
  WebResponse response = null;
  String urlString = request.getURLString().trim();
  FrameSelector targetFrame = _frameContents.getTargetFrame( request );
  if (urlString.startsWith( "about:" )) {
    response = new DefaultWebResponse( _client, targetFrame, null, "" );
  } else if (!HttpUnitUtils.isJavaScriptURL( urlString )) {
    response = _client.createResponse( request, targetFrame );
  } else {
    ScriptingHandler handler = request.getSourceScriptingHandler();
    if (handler == null)  handler = getCurrentPage().getScriptingHandler();
    Object result = handler.evaluateExpression( urlString );
    if (result != null) {
      response = new DefaultWebResponse( _client, targetFrame, request.getURL(), result.toString() );
    }
  }
  if (response != null) _client.tellListeners( response );
  return response;
}

代码示例来源:origin: javanettasks/httpunit

/**
 * Returns the resource specified by the request. Does not update the window or load included framesets.
 * May return null if the resource is a JavaScript URL which would normally leave the client unchanged.
 */
public WebResponse getResource( WebRequest request ) throws IOException {
  _client.tellListeners( request );
  WebResponse response = null;
  String urlString = request.getURLString().trim();
  FrameSelector targetFrame = _frameContents.getTargetFrame( request );
  if (urlString.startsWith( "about:" )) {
    response = new DefaultWebResponse( _client, targetFrame, null, "" );
  } else if (!HttpUnitUtils.isJavaScriptURL( urlString )) {
    response = _client.createResponse( request, targetFrame );
  } else {
    ScriptingHandler handler = request.getSourceScriptingHandler();
    if (handler == null)  handler = getCurrentPage().getScriptingHandler();
    Object result = handler.evaluateExpression( urlString );
    if (result != null) {
      response = new DefaultWebResponse( _client, targetFrame, request.getURL(), result.toString() );
    }
  }
  if (response != null) _client.tellListeners( response );
  return response;
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

/**
 * Returns the resource specified by the request. Does not update the window or load included framesets.
 * May return null if the resource is a JavaScript URL which would normally leave the client unchanged.
 */
public WebResponse getResource( WebRequest request ) throws IOException {
  _client.tellListeners( request );
  WebResponse response = null;
  String urlString = request.getURLString().trim();
  FrameSelector targetFrame = _frameContents.getTargetFrame( request );
  if (urlString.startsWith( "about:" )) {
    response = new DefaultWebResponse( _client, targetFrame, null, "" );
  } else if (!HttpUnitUtils.isJavaScriptURL( urlString )) {
    response = _client.createResponse( request, targetFrame );
  } else {
    ScriptingHandler handler = request.getSourceScriptingHandler();
    if (handler == null)  handler = getCurrentPage().getScriptingHandler();
    Object result = handler.evaluateExpression( urlString );
    if (result != null) {
      response = new DefaultWebResponse( _client, targetFrame, request.getURL(), result.toString() );
    }
  }
  if (response != null) _client.tellListeners( response );
  return response;
}

相关文章