@Test public void testSchemaIsChangedAccordingToXForwardedProto() throws IOException { Request baseRequest = new Request(); final Request request = Mockito.spy(baseRequest); EndPoint endPoint = Mockito.mock(EndPoint.class); Vector<String> headers = new Vector<String>(); headers.add(XFORWARDED_PROTO); Mockito.doReturn(headers.elements()).when(request).getHeaderNames(); Mockito.doReturn(HTTPS_SCHEME).when(request).getHeader(XFORWARDED_PROTO); SelectChannelConnectorHttps connector = new SelectChannelConnectorHttps(); connector.customize(endPoint, request); assertEquals(HTTPS_SCHEME, request.getScheme()); }
@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); }
SelectChannelConnectorHttps extends SelectChannelConnector { @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); } }
SelectChannelConnectorHttps extends SelectChannelConnector { @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); }  }
SelectChannelConnectorHttps extends SelectChannelConnector { @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); }  @Override void customize(EndPoint endpoint, Request request); }
SelectChannelConnectorHttps extends SelectChannelConnector { @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); }  @Override void customize(EndPoint endpoint, Request request);  }