org.apache.catalina.connector.Request.getDecodedRequestURI()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(12.8k)|赞(0)|评价(0)|浏览(153)

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

Request.getDecodedRequestURI介绍

[英]Get the decoded request URI.
[中]获取已解码的请求URI。

代码示例

代码示例来源:origin: org.glassfish.main.web/web-core

/**
 * Get the decoded request URI.
 * 
 * @return the URL decoded request URI
 */
@Override
public String getDecodedRequestURI() {
  return getDecodedRequestURI(false);
}

代码示例来源:origin: org.glassfish.main.security/websecurity

public String getDecodedRequestURI() {
  return httpRequest.getDecodedRequestURI();
}

代码示例来源:origin: org.jboss.resteasy/skeleton-key-as7

@Override
public void invoke(Request request, Response response) throws IOException, ServletException
{
 try
 {
   String requestURI = request.getDecodedRequestURI();
   if (requestURI.endsWith("j_oauth_remote_logout"))
   {
    remoteLogout(request, response);
    return;
   }
   super.invoke(request, response);
 }
 finally
 {
   ResteasyProviderFactory.clearContextData(); // to clear push of SkeletonKeySession
 }
}

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

@Override
protected boolean isContinuationRequired(Request request) {
  // Special handling for form-based logins to deal with the case
  // where the login form (and therefore the "j_security_check" URI
  // to which it submits) might be outside the secured area
  String contextPath = this.context.getPath();
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI.startsWith(contextPath) &&
      decodedRequestURI.endsWith(Constants.FORM_ACTION)) {
    return true;
  }
  // Special handling for form-based logins to deal with the case where
  // a resource is protected for some HTTP methods but not protected for
  // GET which is used after authentication when redirecting to the
  // protected resource.
  // TODO: This is similar to the FormAuthenticator.matchRequest() logic
  // Is there a way to remove the duplication?
  Session session = request.getSessionInternal(false);
  if (session != null) {
    SavedRequest savedRequest = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
    if (savedRequest != null &&
        decodedRequestURI.equals(savedRequest.getDecodedRequestURI())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
protected boolean isContinuationRequired(Request request) {
  // Special handling for form-based logins to deal with the case
  // where the login form (and therefore the "j_security_check" URI
  // to which it submits) might be outside the secured area
  String contextPath = this.context.getPath();
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI.startsWith(contextPath) &&
      decodedRequestURI.endsWith(Constants.FORM_ACTION)) {
    return true;
  }
  // Special handling for form-based logins to deal with the case where
  // a resource is protected for some HTTP methods but not protected for
  // GET which is used after authentication when redirecting to the
  // protected resource.
  // TODO: This is similar to the FormAuthenticator.matchRequest() logic
  // Is there a way to remove the duplication?
  Session session = request.getSessionInternal(false);
  if (session != null) {
    SavedRequest savedRequest = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
    if (savedRequest != null &&
        decodedRequestURI.equals(savedRequest.getDecodedRequestURI())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat7

@Override
protected boolean matchRequest(Request request) {
  Session session = request.getSessionInternal(false);
  String uri = request.getDecodedRequestURI();
  if (session != null && uri != null) {
    SavedRequest saved = (SavedRequest) session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
    if (saved != null) {
      synchronized (session) {
        session.setNote(Constants.FORM_REQUEST_NOTE, saved);
        return super.matchRequest(request);
      }
    }
  }
  return false;
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Does this request match the saved one (so that it must be the redirect
 * we signalled after successful authentication?
 *
 * @param request The request to be verified
 */
protected boolean matchRequest(Request request) {
 // Has a session been created?
 Session session = request.getSessionInternal(false);
 if (session == null)
   return (false);
 // Is there a saved request?
 SavedRequest sreq = (SavedRequest)
   session.getNote(Constants.FORM_REQUEST_NOTE);
 if (sreq == null)
   return (false);
 // Is there a saved principal?
 if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null)
   return (false);
 // Does the request URI match?
 String decodedRequestURI = request.getDecodedRequestURI();
 if (decodedRequestURI == null)
   return (false);
 return (decodedRequestURI.equals(sreq.getDecodedRequestURI()));
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat7

protected void saveRequest(Request request, String contextId) throws IOException {
  String uri = request.getDecodedRequestURI();
  Session session = request.getSessionInternal(true);
  if (session != null) {
    LOG.debug("Save request in session '{}'", session.getIdInternal());
  }
  if (session != null && uri != null) {
    SavedRequest saved;
    synchronized (session) {
      super.saveRequest(request, session);
      saved = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
    }
    session.setNote(SESSION_SAVED_REQUEST_PREFIX + uri, saved);
    StringBuilder sb = new StringBuilder(saved.getRequestURI());
    if (saved.getQueryString() != null) {
      sb.append('?');
      sb.append(saved.getQueryString());
    }
    session.setNote(SESSION_SAVED_URI_PREFIX + contextId, sb.toString());
  }
}

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

/**
 * Does this request match the saved one (so that it must be the redirect
 * we signaled after successful authentication?
 *
 * @param request The request to be verified
 * @return <code>true</code> if the requests matched the saved one
 */
protected boolean matchRequest(Request request) {
  // Has a session been created?
  Session session = request.getSessionInternal(false);
  if (session == null) {
    return false;
  }
  // Is there a saved request?
  SavedRequest sreq =
      (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
  if (sreq == null) {
    return false;
  }
  // Is there a saved principal?
  if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null) {
    return false;
  }
  // Does the request URI match?
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI == null) {
    return false;
  }
  return decodedRequestURI.equals(sreq.getDecodedRequestURI());
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat8

@Override
protected boolean matchRequest(Request request) {
  Session session = request.getSessionInternal(false);
  String uri = request.getDecodedRequestURI();
  if (session != null && uri != null) {
    SavedRequest saved = (SavedRequest) session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
    if (saved != null) {
      synchronized (session) {
        session.setNote(Constants.FORM_REQUEST_NOTE, saved);
        return super.matchRequest(request);
      }
    }
  }
  return false;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Does this request match the saved one (so that it must be the redirect
 * we signaled after successful authentication?
 *
 * @param request The request to be verified
 */
protected boolean matchRequest(Request request) {
  // Has a session been created?
  Session session = request.getSessionInternal(false);
  if (session == null) {
    return false;
  }
  // Is there a saved request?
  SavedRequest sreq =
      (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
  if (sreq == null) {
    return false;
  }
  // Is there a saved principal?
  if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null) {
    return false;
  }
  // Does the request URI match?
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI == null) {
    return false;
  }
  return decodedRequestURI.equals(sreq.getDecodedRequestURI());
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Does this request match the saved one (so that it must be the redirect
 * we signaled after successful authentication?
 *
 * @param request The request to be verified
 */
protected boolean matchRequest(Request request) {
 // Has a session been created?
 Session session = request.getSessionInternal(false);
 if (session == null) {
  return (false);
}
 // Is there a saved request?
 SavedRequest sreq = (SavedRequest)
   session.getNote(Constants.FORM_REQUEST_NOTE);
 if (sreq == null) {
  return (false);
}
 // Is there a saved principal?
 if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null) {
  return (false);
}
 // Does the request URI match?
 String decodedRequestURI = request.getDecodedRequestURI();
 if (decodedRequestURI == null) {
  return (false);
}
 return (decodedRequestURI.equals(sreq.getDecodedRequestURI()));
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Does this request match the saved one (so that it must be the redirect
 * we signaled after successful authentication?
 *
 * @param request The request to be verified
 * @return <code>true</code> if the requests matched the saved one
 */
protected boolean matchRequest(Request request) {
  // Has a session been created?
  Session session = request.getSessionInternal(false);
  if (session == null) {
    return false;
  }
  // Is there a saved request?
  SavedRequest sreq =
      (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
  if (sreq == null) {
    return false;
  }
  // Is there a saved principal?
  if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null) {
    return false;
  }
  // Does the request URI match?
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI == null) {
    return false;
  }
  return decodedRequestURI.equals(sreq.getDecodedRequestURI());
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat8

protected void saveRequest(Request request, RequestState requestState) throws IOException {
  String contextId = requestState.getState();
  String uri = request.getDecodedRequestURI();
  Session session = request.getSessionInternal(true);
  if (session != null) {
    LOG.debug("Save request in session '{}'", session.getIdInternal());
  }
  if (session != null && uri != null) {
    SavedRequest saved;
    synchronized (session) {
      super.saveRequest(request, session);
      saved = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
    }
    session.setNote(SESSION_SAVED_REQUEST_PREFIX + uri, saved);
    StringBuilder sb = new StringBuilder(saved.getRequestURI());
    if (saved.getQueryString() != null) {
      sb.append('?');
      sb.append(saved.getQueryString());
    }
    session.setNote(SESSION_SAVED_URI_PREFIX + contextId, sb.toString());
    //we set Request State as session attribute for later retrieval in SigninHandler
    request.getSession().setAttribute(
      FederationConstants.SESSION_SAVED_REQUEST_STATE_PREFIX + requestState.getState(), requestState);
  }
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat7

protected boolean restoreRequest(Request request) throws IOException {
  Session session = request.getSessionInternal(false);
  String uri = request.getDecodedRequestURI();
  if (session != null && uri != null) {
    SavedRequest saved = (SavedRequest)session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
    if (saved != null) {
      session.removeNote(SESSION_SAVED_REQUEST_PREFIX + uri); // cleanup session
      synchronized (session) {
        session.setNote(Constants.FORM_REQUEST_NOTE, saved);
        return super.restoreRequest(request, session);
      }
    }
  }
  return false;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat8

protected boolean restoreRequest(Request request) throws IOException {
  Session session = request.getSessionInternal(false);
  String uri = request.getDecodedRequestURI();
  if (session != null && uri != null) {
    SavedRequest saved = (SavedRequest)session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
    if (saved != null) {
      session.removeNote(SESSION_SAVED_REQUEST_PREFIX + uri); // cleanup session
      synchronized (session) {
        session.setNote(Constants.FORM_REQUEST_NOTE, saved);
        return super.restoreRequest(request, session);
      }
    }
  }
  return false;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina-ha

/**
 * Send Cluster Replication Request
 * @param request current request
 * @param manager session manager
 * @param cluster replication cluster
 */
protected void sendSessionReplicationMessage(Request request,
    ClusterManager manager, CatalinaCluster cluster) {
  Session session = request.getSessionInternal(false);
  if (session != null) {
    String uri = request.getDecodedRequestURI();
    // request without session change
    if (!isRequestWithoutSessionChange(uri)) {
      if (log.isDebugEnabled())
        log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
      sendMessage(session,manager,cluster);
    } else
      if(doStatistics())
        nrOfFilterRequests++;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Send Cluster Replication Request
 * @param request current request
 * @param manager session manager
 */
protected void sendSessionReplicationMessage(Request request,
    ClusterManager manager) {
  Session session = request.getSessionInternal(false);
  if (session != null) {
    String uri = request.getDecodedRequestURI();
    // request without session change
    if (!isRequestWithoutSessionChange(uri)) {
      if (log.isDebugEnabled()) {
        log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
      }
      sendMessage(session,manager);
    } else
      if(doStatistics()) {
        nrOfFilterRequests++;
      }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * Send Cluster Replication Request
 * @param request current request
 * @param manager session manager
 */
protected void sendSessionReplicationMessage(Request request,
    ClusterManager manager) {
  Session session = request.getSessionInternal(false);
  if (session != null) {
    String uri = request.getDecodedRequestURI();
    // request without session change
    if (!isRequestWithoutSessionChange(uri)) {
      if (log.isDebugEnabled()) {
        log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
      }
      sendMessage(session,manager);
    } else
      if(doStatistics()) {
        nrOfFilterRequests++;
      }
  }
}

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

saved.setQueryString(request.getQueryString());
saved.setRequestURI(request.getRequestURI());
saved.setDecodedRequestURI(request.getDecodedRequestURI());

相关文章

Request类方法