org.restlet.data.Request.setChallengeResponse()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(90)

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

Request.setChallengeResponse介绍

[英]Sets the authentication response sent by a client to an origin server.
[中]设置客户端发送到源服务器的身份验证响应。

代码示例

代码示例来源:origin: org.restlet/org.restlet

/**
 * Sets the authentication response sent by a client to an origin server.
 * 
 * @param response
 *            The authentication response sent by a client to an origin
 *            server.
 */
@Override
public void setChallengeResponse(ChallengeResponse response) {
  getWrappedRequest().setChallengeResponse(response);
}

代码示例来源:origin: uk.org.mygrid.remotetaverna/taverna-rest-client

private Request makeRequest(Reference uri, MediaType accepts) {
  Request request = new Request();
  logger.debug("Making new request for " + uri + " -- " + uri.getTargetRef());
  request.setResourceRef(uri.getTargetRef());
  if (accepts != null) {
    request.getClientInfo().getAcceptedMediaTypes().add(
      new Preference<MediaType>(accepts));
  }
  if (baseURI.isParent(uri) && username != null) {
    logger.debug("Authenticating as " + username);
    ChallengeResponse challengeResponse =
      new ChallengeResponse(ChallengeScheme.HTTP_BASIC, username,
        password);
    request.setChallengeResponse(challengeResponse);
  } else {
    logger.warn("Not supplying credentials for out-of-site URI " + uri);
  }
  return request;
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-client-java

public Response sendRequest( Method method, String url, Representation representation )
{
  this.logger.debug( "Method: " + method.getName() + " url: " + url );
  Request request = new Request();
  request.setResourceRef( url );
  request.setMethod( method );
  if ( !Method.GET.equals( method ) && !Method.DELETE.equals( method ) )
  {
    request.setEntity( representation );
  }
  request.setChallengeResponse( this.challenge );
  return this.restClient.handle( request );
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-utils

public Response sendMessage( final Request request, final Matcher<Response> matchers )
  throws IOException
{
  checkNotNull( request );
  // check the text context to see if this is a secure test
  if ( testContext.isSecureTest() )
  {
    // ChallengeScheme scheme = new ChallengeScheme( "HTTP_NxBasic", "NxBasic", "Nexus Basic" );
    ChallengeResponse authentication =
      new ChallengeResponse(
        ChallengeScheme.HTTP_BASIC, testContext.getUsername(), testContext.getPassword()
      );
    request.setChallengeResponse( authentication );
  }
  LOG.debug( "sendMessage: " + request.getMethod().getName() + " " + request.getResourceRef().toString() );
  Response response = client.handle( request );
  if ( matchers != null )
  {
    try
    {
      assertThat( response, matchers );
    }
    catch ( AssertionError e )
    {
      releaseResponse( response );
      throw e;
    }
  }
  return response;
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

request.setChallengeResponse(authentication);

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base

context.getUsername(),
  context.getPassword() );
request.setChallengeResponse( authentication );

相关文章