List of usage examples for org.apache.http.client.methods HttpUriRequest getMethod
String getMethod();
From source file:org.fcrepo.integration.syndication.AbstractResourceIT.java
protected int getStatus(HttpUriRequest method) throws ClientProtocolException, IOException { logger.debug("Executing: " + method.getMethod() + " to " + method.getURI()); return client.execute(method).getStatusLine().getStatusCode(); }
From source file:org.fcrepo.integration.generator.AbstractResourceIT.java
protected int getStatus(final HttpUriRequest method) throws ClientProtocolException, IOException { logger.debug("Executing: " + method.getMethod() + " to " + method.getURI()); return client.execute(method).getStatusLine().getStatusCode(); }
From source file:org.fcrepo.auth.integration.AbstractResourceIT.java
protected HttpResponse execute(final HttpUriRequest method) throws IOException { logger.debug("Executing: " + method.getMethod() + " to " + method.getURI()); return client.execute(method); }
From source file:com.google.android.apps.authenticator.timesync.NetworkTimeProviderTest.java
public void testRequest() throws Exception { withHttpRequestThrowing(new IOException("arbitrary")); try {/*from w w w. j ava2s.com*/ mProvider.getNetworkTime(); } catch (Exception expected) { } ArgumentCaptor<HttpUriRequest> requestCaptor = ArgumentCaptor.forClass(HttpUriRequest.class); verify(mMockHttpClient).execute(requestCaptor.capture()); HttpUriRequest request = requestCaptor.getValue(); assertEquals("HEAD", request.getMethod()); assertEquals("https://www.google.com", request.getURI().toString()); MoreAsserts.assertEmpty(Arrays.asList(request.getAllHeaders())); }
From source file:org.fcrepo.integration.SanityIT.java
protected int getStatus(final HttpUriRequest method) throws IOException { logger.debug("Executing: " + method.getMethod() + " to " + method.getURI()); return client.execute(method).getStatusLine().getStatusCode(); }
From source file:org.fcrepo.auth.oauth.integration.api.AbstractOAuthResourceIT.java
protected HttpResponse execute(final HttpUriRequest method) throws ClientProtocolException, IOException { logger.debug("Executing: " + method.getMethod() + " to " + method.getURI()); return client.execute(method); }
From source file:net.netheos.pcsapi.oauth.PasswordSessionManager.java
@Override public CResponse execute(HttpUriRequest request) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("{}: {}", request.getMethod(), PcsUtils.shortenUrl(request.getURI())); }/*w w w .j a v a 2s . c o m*/ try { URI uri = request.getURI(); HttpHost host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()); HttpContext context = getHttpContext(host); HttpResponse httpResponse = httpClient.execute(host, request, context); return new CResponse(request, httpResponse); } catch (IOException ex) { // a low level error should be retried : throw new CRetriableException(ex); } }
From source file:org.jasig.portlet.proxy.service.web.HttpContentServiceImplTest.java
@Test public void testGetFormNoParams() { when(request.getParameter(HttpContentServiceImpl.IS_FORM_PARAM)).thenReturn("true"); when(request.getParameter(HttpContentServiceImpl.FORM_METHOD_PARAM)).thenReturn("GET"); when(processor.process(any(String.class), any(PortletRequest.class))) .thenReturn("http://somewhere.com/path/page.html"); HttpContentRequestImpl proxyRequest = new HttpContentRequestImpl(request, processor); final HttpUriRequest httpRequest = service.getHttpRequest(proxyRequest, request); assertEquals("GET", httpRequest.getMethod()); assertEquals("http://somewhere.com/path/page.html", httpRequest.getURI().toString()); }
From source file:org.jasig.portlet.proxy.service.web.HttpContentServiceImplTest.java
@Test public void testNonForm() { when(request.getParameter(HttpContentServiceImpl.IS_FORM_PARAM)).thenReturn("false"); when(processor.process(any(String.class), any(PortletRequest.class))) .thenReturn("http://somewhere.com/path/page.html"); HttpContentRequestImpl proxyRequest = new HttpContentRequestImpl(request, processor); final HttpUriRequest httpRequest = service.getHttpRequest(proxyRequest, request); assertEquals("GET", httpRequest.getMethod()); assertEquals("http://somewhere.com/path/page.html", httpRequest.getURI().toString()); }
From source file:org.jasig.portlet.proxy.service.web.HttpContentServiceImplTest.java
@Test public void testPostFormNoParams() { when(request.getParameter(HttpContentServiceImpl.IS_FORM_PARAM)).thenReturn("true"); when(request.getParameter(HttpContentServiceImpl.FORM_METHOD_PARAM)).thenReturn("POST"); when(processor.process(any(String.class), any(PortletRequest.class))) .thenReturn("http://somewhere.com/path/page.html"); HttpContentRequestImpl proxyRequest = new HttpContentRequestImpl(request, processor); final HttpUriRequest httpRequest = service.getHttpRequest(proxyRequest, request); assertEquals("POST", httpRequest.getMethod()); assertEquals("http://somewhere.com/path/page.html", httpRequest.getURI().toString()); }