protected void handle( final HttpServerRequest vertxRequest, final InputStream inputStream ) { URI uri = getAbsoluteURI(vertxRequest); boolean isSecure = "https".equalsIgnoreCase(uri.getScheme()); UriBuilder baseUriBuilder = UriBuilder.fromUri(uri) .replacePath(baseUri.getPath()) .replaceQuery(null); // Create the jersey request final ContainerRequest jerseyRequest = new ContainerRequest( baseUriBuilder.build(), uri, vertxRequest.method(), new DefaultSecurityContext(isSecure), new MapPropertiesDelegate()); handle(vertxRequest, inputStream, jerseyRequest); }
protected void handle( final HttpServerRequest vertxRequest, final InputStream inputStream ) { URI uri = getAbsoluteURI(vertxRequest); boolean isSecure = "https".equalsIgnoreCase(uri.getScheme()); UriBuilder baseUriBuilder = UriBuilder.fromUri(uri) .replacePath(getBaseUri().getPath()) .replaceQuery(null); // Create the jersey request final ContainerRequest jerseyRequest = new ContainerRequest( baseUriBuilder.build(), uri, vertxRequest.method().name(), new DefaultSecurityContext(isSecure), new MapPropertiesDelegate()); handle(vertxRequest, inputStream, jerseyRequest); }
protected void handle( final HttpServerRequest vertxRequest, final InputStream inputStream ) { URI uri = getAbsoluteURI(vertxRequest); boolean isSecure = "https".equalsIgnoreCase(uri.getScheme()); UriBuilder baseUriBuilder = UriBuilder.fromUri(uri) .replacePath(getBaseUri().getPath()) .replaceQuery(null); // Create the jersey request final ContainerRequest jerseyRequest = new ContainerRequest( baseUriBuilder.build(), uri, vertxRequest.method().name(), new DefaultSecurityContext(isSecure), new MapPropertiesDelegate()); handle(vertxRequest, inputStream, jerseyRequest); }
@Test public void testGetAbsoluteURI() throws Exception { URI uri; String absoluteUri = "http://0.0.0.0:80/test"; String host = "test.englishtown.com"; String badUrl = "http://test.englishtown.com/test?a=b=c|d=e"; HttpServerRequest request = mock(HttpServerRequest.class); when(request.absoluteURI()).thenReturn(absoluteUri).thenThrow(new IllegalArgumentException()); when(request.uri()).thenReturn(badUrl); when(request.headers()).thenReturn(headers); when(headers.get(eq(HttpHeaders.HOST))).thenReturn(host); uri = jerseyHandler.getAbsoluteURI(request); assertEquals("http://test.englishtown.com/test", uri.toString()); uri = jerseyHandler.getAbsoluteURI(request); assertEquals("http://test.englishtown.com/test?a=b%3Dc%7Cd%3De", uri.toString()); }