本文整理了Java中org.eclipse.jetty.server.Request.setScheme
方法的一些代码示例,展示了Request.setScheme
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setScheme
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:setScheme
暂无
代码示例来源:origin: neo4j/neo4j
@Override
public void customize( Connector connector, HttpConfiguration channelConfig, Request request )
{
request.setScheme( HttpScheme.HTTPS.asString() );
addResponseFieldIfConfigured( request, hstsResponseField );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldSetRequestSchemeToHttps()
{
Customizer customizer = newCustomizer();
Request request = mock( Request.class );
customize( customizer, request );
verify( request ).setScheme( HTTPS.asString() );
}
代码示例来源:origin: OAuth-Apis/apis
@Override
public void customize(EndPoint endpoint, Request request) throws IOException {
String forwardedProtocol = getHeaderCaseInsensitive(request, X_FORWARDED_PROTO);
if (forwardedProtocol != null) {
if (forwardedProtocol.indexOf("https") >= 0) {
request.setScheme("https");
}
}
super.customize(endpoint, request);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
protected String apply(String target, String value, HttpServletRequest request, HttpServletResponse response)
{
((Request) request).setScheme(_scheme);
return target;
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-rewrite
@Override
protected String apply(String target, String value, HttpServletRequest request, HttpServletResponse response)
{
((Request) request).setScheme(_scheme);
return target;
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
protected String apply(String target, String value, HttpServletRequest request, HttpServletResponse response)
{
((Request) request).setScheme(_scheme);
return target;
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
protected String apply(String target, String value, HttpServletRequest request, HttpServletResponse response)
{
((Request) request).setScheme(_scheme);
return target;
}
}
代码示例来源:origin: org.simplericity.jettyconsole/jetty-console-core
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request) {
request.setScheme(URIUtil.HTTPS);
request.setSecure(true);
}
});
代码示例来源:origin: org.neo4j.app/neo4j-server
@Override
public void customize( Connector connector, HttpConfiguration channelConfig, Request request )
{
request.setScheme( HttpScheme.HTTPS.asString() );
addResponseFieldIfConfigured( request, hstsResponseField );
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
@Override
public void customize(EndPoint endpoint, Request request) throws IOException
{
super.customize(endpoint,request);
if (request.isSecure())
request.setScheme(HttpSchemes.HTTPS);
}
代码示例来源:origin: org.eclipse.jetty.spdy/spdy-jetty-http
@Override
public void customize(EndPoint endPoint, Request request) throws IOException
{
super.customize(endPoint, request);
if (getSslContextFactory() != null)
request.setScheme(HttpSchemes.HTTPS);
}
代码示例来源:origin: works.lmz.common/common-runnable-war
public static void rewriteProxyRequest(Request request) {
String client = request.getHeader(CLIENT_HEADER);
if (client != null && client.length() > 0) {
InetSocketAddress realClient = new InetSocketAddress(client, 80);
request.setRemoteAddr(realClient);
}
String scheme = request.getHeader(SCHEME_HEADER);
if (scheme == null || scheme.equals("")) {
scheme = HTTP_SCHEME;
}
request.setScheme(scheme);
String hostAndPort = request.getHeader(HOST_HEADER);
if (hostAndPort != null) {
int ofs = hostAndPort.indexOf(':');
if (ofs >= 0) {
request.setServerName(hostAndPort.substring(0, ofs));
request.setServerPort(Integer.parseInt(hostAndPort.substring(ofs + 1)));
} else {
request.setServerName(hostAndPort);
request.setServerPort(HTTPS_SCHEME.equalsIgnoreCase(scheme) ? HTTPS_PORT : HTTP_PORT);
}
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* Allow the Listener a chance to customise the request. before the server does its stuff. <br>
* This allows the required attributes to be set for SSL requests. <br>
* The requirements of the Servlet specs are:
* <ul>
* <li> an attribute named "javax.servlet.request.ssl_id" of type String (since Spec 3.0).</li>
* <li> an attribute named "javax.servlet.request.cipher_suite" of type String.</li>
* <li> an attribute named "javax.servlet.request.key_size" of type Integer.</li>
* <li> an attribute named "javax.servlet.request.X509Certificate" of type
* java.security.cert.X509Certificate[]. This is an array of objects of type X509Certificate,
* the order of this array is defined as being in ascending order of trust. The first
* certificate in the chain is the one set by the client, the next is the one used to
* authenticate the first, and so on. </li>
* </ul>
*
* @param endpoint The Socket the request arrived on.
* This should be a {@link SocketEndPoint} wrapping a {@link SSLSocket}.
* @param request HttpRequest to be customised.
*/
@Override
public void customize(EndPoint endpoint, Request request)
throws IOException
{
super.customize(endpoint, request);
request.setScheme(HttpSchemes.HTTPS);
SocketEndPoint socket_end_point = (SocketEndPoint)endpoint;
SSLSocket sslSocket = (SSLSocket)socket_end_point.getTransport();
SSLSession sslSession = sslSocket.getSession();
SslCertificates.customize(sslSession,endpoint,request);
}
代码示例来源:origin: org.apache.activemq/activemq-optional
@Override
public void customize(EndPoint endpoint, Request request) throws IOException {
if (useKrb) { // Add Kerberos-specific info
SSLSocket sslSocket = (SSLSocket) endpoint.getTransport();
Principal remotePrincipal = sslSocket.getSession().getPeerPrincipal();
logIfDebug("Remote principal = " + remotePrincipal);
request.setScheme(HttpSchemes.HTTPS);
request.setAttribute(REMOTE_PRINCIPAL, remotePrincipal);
if (!useCerts) { // Add extra info that would have been added by
// super
String cipherSuite = sslSocket.getSession().getCipherSuite();
Integer keySize = Integer.valueOf(ServletSSL.deduceKeyLength(cipherSuite));
;
request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite);
request.setAttribute("javax.servlet.request.key_size", keySize);
}
}
if (useCerts)
super.customize(endpoint, request);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
{
request.setScheme(HttpScheme.HTTPS.asString());
request.setSecure(true);
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
{
request.setScheme(HttpScheme.HTTPS.asString());
request.setSecure(true);
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
}
}
代码示例来源:origin: Nextdoor/bender
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
{
request.setScheme(HttpScheme.HTTPS.asString());
request.setSecure(true);
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
}
}
代码示例来源:origin: jenkinsci/winstone
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
EndPoint endp = request.getHttpChannel().getEndPoint();
if (endp instanceof DecryptedEndPoint)
{
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)endp;
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
if (request.getHttpURI().getScheme()==null)
request.setScheme(HttpScheme.HTTPS.asString());
}
else if (endp instanceof ProxyConnectionFactory.ProxyEndPoint)
{
ProxyConnectionFactory.ProxyEndPoint proxy = (ProxyConnectionFactory.ProxyEndPoint)endp;
if (request.getHttpURI().getScheme()==null && proxy.getAttribute(ProxyConnectionFactory.TLS_VERSION)!=null)
request.setScheme(HttpScheme.HTTPS.asString());
}
if (HttpScheme.HTTPS.is(request.getScheme()))
customizeSecure(request);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
{
if (request.getHttpURI().getScheme()==null)
request.setScheme(HttpScheme.HTTPS.asString());
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
}
if (HttpScheme.HTTPS.is(request.getScheme()))
customizeSecure(request);
}
代码示例来源:origin: org.eclipse.jetty.spdy/spdy-http-server
private boolean performBeginRequest(Fields headers)
{
short version = stream.getSession().getVersion();
Fields.Field methodHeader = headers.get(HTTPSPDYHeader.METHOD.name(version));
Fields.Field uriHeader = headers.get(HTTPSPDYHeader.URI.name(version));
Fields.Field versionHeader = headers.get(HTTPSPDYHeader.VERSION.name(version));
if (methodHeader == null || uriHeader == null || versionHeader == null)
{
badMessage(400, "Missing required request line elements");
return false;
}
HttpMethod httpMethod = HttpMethod.fromString(methodHeader.getValue());
HttpVersion httpVersion = HttpVersion.fromString(versionHeader.getValue());
// TODO should handle URI as byte buffer as some bad clients send WRONG encodings in query string
// that we have to deal with
ByteBuffer uri = BufferUtil.toBuffer(uriHeader.getValue());
if (LOG.isDebugEnabled())
LOG.debug("HTTP > {} {} {}", httpMethod, uriHeader.getValue(), httpVersion);
startRequest(httpMethod, httpMethod.asString(), uri, httpVersion);
Fields.Field schemeHeader = headers.get(HTTPSPDYHeader.SCHEME.name(version));
if (schemeHeader != null)
getRequest().setScheme(schemeHeader.getValue());
return true;
}
内容来源于网络,如有侵权,请联系作者删除!