org.ldaptive.Response.<init>()方法的使用及代码示例

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

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

Response.<init>介绍

[英]Creates a new ldap response.
[中]创建一个新的ldap响应。

代码示例

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

/**
 * Invokes the handlers for the supplied async request. Calls {@link #responseReceived(Response)} if a handler
 * aborts the operation.
 *
 * @param  request  to handle
 *
 * @throws  LdapException  if a handler throws
 */
protected void processAsyncRequest(final AsyncRequest request)
 throws LdapException
{
 logger.trace("processing async request={}", request);
 final HandlerResult<AsyncRequest> hr = executeHandlers(getAsyncRequestHandlers(), searchRequest, request);
 if (hr.getAbort()) {
  logger.debug("Aborting search on async request=%s", request);
  responseReceived(new Response<>(null, null));
 }
}

代码示例来源:origin: com.floragunn/ldaptive

/**
 * Invokes the handlers for the supplied async request. Calls {@link #responseReceived(Response)} if a handler
 * aborts the operation.
 *
 * @param  request  to handle
 *
 * @throws  LdapException  if a handler throws
 */
protected void processAsyncRequest(final AsyncRequest request)
 throws LdapException
{
 logger.trace("processing async request={}", request);
 final HandlerResult<AsyncRequest> hr = executeHandlers(getAsyncRequestHandlers(), searchRequest, request);
 if (hr.getAbort()) {
  logger.debug("Aborting search on async request=%s", request);
  responseReceived(new Response<Void>(null, null));
 }
}

代码示例来源:origin: vt-middleware/ldaptive

/**
 * Invokes the handlers for the supplied async request. Calls {@link #responseReceived(Response)} if a handler
 * aborts the operation.
 *
 * @param  request  to handle
 *
 * @throws  LdapException  if a handler throws
 */
protected void processAsyncRequest(final AsyncRequest request)
 throws LdapException
{
 logger.trace("processing async request={}", request);
 final HandlerResult<AsyncRequest> hr = executeHandlers(getAsyncRequestHandlers(), searchRequest, request);
 if (hr.getAbort()) {
  logger.debug("Aborting search on async request=%s", request);
  responseReceived(new Response<>(null, null));
 }
}

代码示例来源:origin: com.floragunn/ldaptive

/**
 * Implementation that does not require the response.
 *
 * @param  conn  the operation occurred on
 * @param  request  the operation executed
 * @param  referralUrls  encountered in the operation
 *
 * @return  handler result
 *
 * @throws  LdapException  if an error occurs following referrals
 */
public HandlerResult<Response<S>> handle(final Connection conn, final Q request, final String[] referralUrls)
 throws LdapException
{
 HandlerResult<Response<S>> result;
 if (referralDepth > referralLimit) {
  result = new HandlerResult<>(
   new Response<>((S) null, ResultCode.REFERRAL_LIMIT_EXCEEDED, null, null, null, null, -1));
 } else {
  final Response<S> referralResponse = followReferral(conn, request, referralUrls);
  if (referralResponse != null) {
   result = new HandlerResult<>(referralResponse);
  } else {
   result = new HandlerResult<>(null);
  }
 }
 return result;
}

代码示例来源:origin: vt-middleware/ldaptive

/**
 * Implementation that does not require the response.
 *
 * @param  conn  the operation occurred on
 * @param  request  the operation executed
 * @param  referralUrls  encountered in the operation
 *
 * @return  handler result
 *
 * @throws  LdapException  if an error occurs following referrals
 */
public HandlerResult<Response<S>> handle(final Connection conn, final Q request, final String[] referralUrls)
 throws LdapException
{
 final HandlerResult<Response<S>> result;
 if (referralDepth > referralLimit) {
  result = new HandlerResult<>(
   new Response<>((S) null, ResultCode.REFERRAL_LIMIT_EXCEEDED, null, null, null, null, -1));
 } else {
  final Response<S> referralResponse = followReferral(conn, request, referralUrls);
  if (referralResponse != null) {
   result = new HandlerResult<>(referralResponse);
  } else {
   result = new HandlerResult<>(null);
  }
 }
 return result;
}

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

@Override
public void responseReceived(final Response<Void> response)
{
 searchResponse = new Response<>(
  searchResult,
  response.getResultCode(),
  response.getMessage(),
  response.getMatchedDn(),
  response.getControls(),
  response.getReferralURLs(),
  response.getMessageId());
 responseLock.release();
}

代码示例来源:origin: vt-middleware/ldaptive

@Override
public void responseReceived(final Response<Void> response)
{
 searchResponse = new Response<>(
  searchResult,
  response.getResultCode(),
  response.getMessage(),
  response.getMatchedDn(),
  response.getControls(),
  response.getReferralURLs(),
  response.getMessageId());
 responseLock.release();
}

代码示例来源:origin: com.floragunn/ldaptive

@Override
public void responseReceived(final Response<Void> response)
{
 searchResponse = new Response<>(
  searchResult,
  response.getResultCode(),
  response.getMessage(),
  response.getMatchedDn(),
  response.getControls(),
  response.getReferralURLs(),
  response.getMessageId());
 responseLock.release();
}

代码示例来源:origin: com.floragunn/ldaptive

@Override
protected Response<SearchResult> invoke(final SearchRequest request)
 throws LdapException
{
 Response<SearchResult> response;
 if (cache != null) {
  final SearchResult sr = cache.get(request);
  if (sr == null) {
   response = executeSearch(request);
   cache.put(request, response.getResult());
   logger.debug("invoke stored result={} in cache", response.getResult());
  } else {
   logger.debug("invoke found result={} in cache", sr);
   response = new Response<>(sr, null);
  }
 } else {
  response = executeSearch(request);
 }
 return response;
}

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

@Override
protected Response<SearchResult> invoke(final SearchRequest request)
 throws LdapException
{
 final Response<SearchResult> response;
 if (cache != null) {
  final SearchResult sr = cache.get(request);
  if (sr == null) {
   response = executeSearch(request);
   cache.put(request, response.getResult());
   logger.debug("invoke stored result={} in cache", response.getResult());
  } else {
   logger.debug("invoke found result={} in cache", sr);
   response = new Response<>(sr, null);
  }
 } else {
  response = executeSearch(request);
 }
 return response;
}

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

@Override
public synchronized Response<Void> reopen()
 throws LdapException
{
 try {
  if (providerConnection != null) {
   providerConnection.close(null);
  }
 } catch (LdapException e) {
  logger.warn("Error closing connection with the LDAP", e);
 } finally {
  providerConnection = null;
 }
 providerConnection = providerConnectionFactory.create();
 if (config.getConnectionInitializer() != null) {
  return config.getConnectionInitializer().initialize(this);
 } else {
  return new Response<>(null, null);
 }
}

代码示例来源:origin: vt-middleware/ldaptive

@Override
protected Response<SearchResult> invoke(final SearchRequest request)
 throws LdapException
{
 final Response<SearchResult> response;
 if (cache != null) {
  final SearchResult sr = cache.get(request);
  if (sr == null) {
   response = executeSearch(request);
   cache.put(request, response.getResult());
   logger.debug("invoke stored result={} in cache", response.getResult());
  } else {
   logger.debug("invoke found result={} in cache", sr);
   response = new Response<>(sr, null);
  }
 } else {
  response = executeSearch(request);
 }
 return response;
}

代码示例来源:origin: com.floragunn/ldaptive

@Override
public synchronized Response<Void> reopen()
 throws LdapException
{
 try {
  if (providerConnection != null) {
   providerConnection.close(null);
  }
 } catch (LdapException e) {
  logger.warn("Error closing connection with the LDAP", e);
 } finally {
  providerConnection = null;
 }
 providerConnection = providerConnectionFactory.create();
 if (config.getConnectionInitializer() != null) {
  return config.getConnectionInitializer().initialize(this);
 } else {
  return new Response<>(null, null);
 }
}

代码示例来源:origin: vt-middleware/ldaptive

@Override
public synchronized Response<Void> reopen()
 throws LdapException
{
 try {
  if (providerConnection != null) {
   providerConnection.close(null);
  }
 } catch (LdapException e) {
  logger.warn("Error closing connection with the LDAP", e);
 } finally {
  providerConnection = null;
 }
 providerConnection = providerConnectionFactory.create();
 if (config.getConnectionInitializer() != null) {
  return config.getConnectionInitializer().initialize(this);
 } else {
  return new Response<>(null, null);
 }
}

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

/**
 * This will establish a connection if one does not already exist. This connection should be closed using {@link
 * #close()}.
 *
 * @return  response associated with the {@link ConnectionInitializer} or an empty response if no connection
 *          initializer was configured
 *
 * @throws  IllegalStateException  if the connection is already open
 * @throws  LdapException  if the LDAP cannot be reached
 */
@Override
public synchronized Response<Void> open()
 throws LdapException
{
 if (isOpen()) {
  throw new IllegalStateException("Connection already open");
 }
 providerConnection = providerConnectionFactory.create();
 if (config.getConnectionInitializer() != null) {
  return config.getConnectionInitializer().initialize(this);
 } else {
  return new Response<>(null, null);
 }
}

代码示例来源:origin: com.floragunn/ldaptive

/**
 * This will establish a connection if one does not already exist. This connection should be closed using {@link
 * #close()}.
 *
 * @return  response associated with the {@link ConnectionInitializer} or an empty response if no connection
 *          initializer was configured
 *
 * @throws  IllegalStateException  if the connection is already open
 * @throws  LdapException  if the LDAP cannot be reached
 */
@Override
public synchronized Response<Void> open()
 throws LdapException
{
 if (isOpen()) {
  throw new IllegalStateException("Connection already open");
 }
 providerConnection = providerConnectionFactory.create();
 if (config.getConnectionInitializer() != null) {
  return config.getConnectionInitializer().initialize(this);
 } else {
  return new Response<>(null, null);
 }
}

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

@Override
public HandlerResult<Response<S>> handle(final Connection conn, final Q request, final Response<S> response)
 throws LdapException
{
 final HandlerResult<Response<S>> result;
 if (referralDepth > referralLimit) {
  result = new HandlerResult<>(
   new Response<>(
    response.getResult(),
    ResultCode.REFERRAL_LIMIT_EXCEEDED,
    response.getMessage(),
    response.getMatchedDn(),
    response.getControls(),
    response.getReferralURLs(),
    response.getMessageId()));
 } else {
  final Response<S> referralResponse = followReferral(conn, request, response.getReferralURLs());
  if (referralResponse != null) {
   result = new HandlerResult<>(referralResponse);
  } else {
   result = new HandlerResult<>(response);
  }
 }
 return result;
}

代码示例来源:origin: org.ldaptive/ldaptive-apache

/**
 * Creates an operation response with the supplied response data.
 *
 * @param  <T>  type of response
 * @param  request  containing controls
 * @param  result  of the operation
 * @param  resultResponse  provider response
 *
 * @return  operation response
 */
protected <T> Response<T> createResponse(final Request request, final T result, final ResultResponse resultResponse)
{
 final LdapResult ldapResult = resultResponse.getLdapResult();
 final Referral ref = ldapResult.getReferral();
 return
  new Response<>(
   result,
   ResultCode.valueOf(ldapResult.getResultCode().getValue()),
   ldapResult.getDiagnosticMessage(),
   ldapResult.getMatchedDn() != null ? ldapResult.getMatchedDn().getName() : null,
   processResponseControls(config.getControlProcessor(), request.getControls(), resultResponse),
   ref != null ? ref.getLdapUrls().toArray(new String[ref.getReferralLength()]) : null,
   resultResponse.getMessageId());
}

代码示例来源:origin: vt-middleware/ldaptive

/**
 * Performs the ldap search.
 *
 * @param  request  to invoke search with
 *
 * @return  ldap response
 *
 * @throws  LdapException  if an error occurs
 */
protected Response<SearchResult> executeSearch(final SearchRequest request)
 throws LdapException
{
 final SearchIterator si = getConnection().getProviderConnection().search(request);
 final SearchResult result = readResult(request, si);
 final Response<Void> response = si.getResponse();
 return
  new Response<>(
   result,
   response.getResultCode(),
   response.getMessage(),
   response.getMatchedDn(),
   response.getControls(),
   response.getReferralURLs(),
   response.getMessageId());
}

代码示例来源:origin: com.floragunn/ldaptive

/**
 * Performs the ldap search.
 *
 * @param  request  to invoke search with
 *
 * @return  ldap response
 *
 * @throws  LdapException  if an error occurs
 */
protected Response<SearchResult> executeSearch(final SearchRequest request)
 throws LdapException
{
 final SearchIterator si = getConnection().getProviderConnection().search(request);
 final SearchResult result = readResult(request, si);
 final Response<Void> response = si.getResponse();
 return
  new Response<>(
   result,
   response.getResultCode(),
   response.getMessage(),
   response.getMatchedDn(),
   response.getControls(),
   response.getReferralURLs(),
   response.getMessageId());
}

相关文章