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

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

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

Response.sendRedirect介绍

[英]Send a temporary redirect to the specified redirect location URL.
[中]将临时重定向发送到指定的重定向位置URL。

代码示例

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

/**
 * Sends a temporary redirect to the specified redirect location URL.
 *
 * @param location Location URL to redirect to
 *
 * @throws IllegalStateException if this response has
 *  already been committed
 * @throws IOException if an input/output error occurs
 */
public void sendRedirect(String location) throws IOException {
  sendRedirect(location, true);
}

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

/**
 * Send a temporary redirect to the specified redirect location URL.
 *
 * @param location Location URL to redirect to
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
@Override
public void sendRedirect(String location) throws IOException {
  sendRedirect(location, SC_FOUND);
}

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

/**
 * Send a temporary redirect to the specified redirect location URL.
 *
 * @param location Location URL to redirect to
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
@Override
public void sendRedirect(String location) throws IOException {
  sendRedirect(location, SC_FOUND);
}

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

/**
 * Send a temporary redirect to the specified redirect location URL.
 *
 * @param location Location URL to redirect to
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
@Override
public void sendRedirect(String location)
  throws IOException {
  sendRedirect(location, SC_FOUND);
}

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

@Override
public void sendRedirect(String location) throws IOException {
  // Disallow operation if the object has gone out of scope
  if (response == null) {
    throw new IllegalStateException(rb.getString(LogFacade.NULL_RESPONSE_OBJECT));
  }
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: tomcat/catalina

public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (/*sm.getString("responseBase.reset.ise")*/);
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: org.picketlink/picketlink-consolidated-social

public boolean initialInteraction(Request request, Response response) throws IOException {
  HttpSession session = request.getSession();
  Map<String, String> params = new HashMap<String, String>();
  params.put(OAuthConstants.REDIRECT_URI_PARAMETER, returnURL);
  params.put(OAuthConstants.CLIENT_ID_PARAMETER, clientID);
  if (scope != null) {
    params.put(OAuthConstants.SCOPE_PARAMETER, scope);
  }
  String location = new StringBuilder(FacebookConstants.SERVICE_URL).append("?").append(util.createQueryString(params))
      .toString();
  try {
    session.setAttribute("STATE", STATES.AUTH.name());
    if (trace)
      log.trace("Redirect:" + location);
    response.sendRedirect(location);
    return false;
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.picketlink/picketlink-facebook

public boolean initialInteraction(Request request, Response response) throws IOException {
  HttpSession session = request.getSession();
  Map<String, String> params = new HashMap<String, String>();
  params.put(OAuthConstants.REDIRECT_URI_PARAMETER, returnURL);
  params.put(OAuthConstants.CLIENT_ID_PARAMETER, clientID);
  if (scope != null) {
    params.put(OAuthConstants.SCOPE_PARAMETER, scope);
  }
  String location = new StringBuilder(FacebookConstants.SERVICE_URL).append("?").append(util.createQueryString(params))
      .toString();
  try {
    session.setAttribute("STATE", STATES.AUTH.name());
    if (trace)
      log.trace("Redirect:" + location);
    response.sendRedirect(location);
    return false;
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

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

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendRedirect.ise"));
  }
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendRedirect.ise"));
  }
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendRedirect.ise"));
  }
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendRedirect.ise"));
  }
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
public void sendRedirect(String location)
  throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendRedirect.ise"));
  }
  response.setAppCommitted(true);
  response.sendRedirect(location);
}

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

@Override
public void invoke(final Request request, final Response response) throws IOException, ServletException {
  final String destination = router.route(request.getRequestURI());
  if (destination == null) {
    getNext().invoke(request, response);
    return;
  }
  if (router.hasPrefix()) {
    request.getRequestDispatcher(destination).forward(request, response);
  } else {
    response.sendRedirect(destination);
  }
}

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

protected void redirectAccessCode(boolean sso, Response response, String redirect_uri, String client_id, String state, GenericPrincipal gp) throws IOException
{
 SkeletonKeyToken token = buildToken(gp);
 AccessCode code = new AccessCode();
 code.setToken(token);
 code.setClient(client_id);
 code.setSso(sso);
 code.setRedirect(redirect_uri);
 int expiration = skeletonKeyConfig.getAccessCodeLifetime() == 0 ? 300 : skeletonKeyConfig.getAccessCodeLifetime();
 code.setExpiration((System.currentTimeMillis() / 1000) + expiration);
 accessCodeMap.put(code.getId(), code);
 LogMessages.LOGGER.debug(Messages.MESSAGES.signAccessCode());
 String accessCode = null;
 accessCode = new JWSBuilder().content(code.getId().getBytes(StandardCharsets.UTF_8)).rsa256(realmPrivateKey);
 LogMessages.LOGGER.debug(Messages.MESSAGES.buildRedirect());
 UriBuilder redirectUri = UriBuilder.fromUri(redirect_uri).queryParam("code", accessCode);
 if (state != null) redirectUri.queryParam("state", state);
 response.sendRedirect(redirectUri.toTemplate());
 LogMessages.LOGGER.debug(Messages.MESSAGES.endOAuthAuthenticate());
}

相关文章

Response类方法