Package org.apache.http.protocol

Examples of org.apache.http.protocol.HttpRequestHandler


    @Test
    public void testHandledRuntimeException() throws Exception {
        final CountDownLatch requestConns = new CountDownLatch(1);

        HttpRequestHandler requestHandler = new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here


    }

    @Test
    public void testBufferedInput() throws Exception {
        final int[] result = new int[1];
        HttpRequestHandler requestHandler = new HttpRequestHandler() {
            public void handle(HttpRequest request, HttpResponse response,
                    HttpContext context) throws HttpException, IOException {
                result[0]++;
                synchronized (result) {
                    result.notify();
View Full Code Here

public class TestFluent extends LocalServerTestBase {

    @Before
    public void setUp() throws Exception {
        this.localServer = new LocalTestServer(null, null);
        localServer.register("/", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                response.setEntity(new StringEntity("All is well", ContentType.TEXT_PLAIN));
            }

        });
        localServer.register("/echo", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here

     *
     * @throws Exception
     *             if there was a problem
     */
    public void testResponseWithNoContent() throws Exception {
        this.localServer.register("*", new HttpRequestHandler() {

            /**
             * {@inheritDoc}
             */
            public void handle(
View Full Code Here

        final String entityText = "Hello, this is some plain text coming back.";

        /* Assume that server will see an Accept-Encoding header. */
        final boolean [] sawAcceptEncodingHeader = { true };
       
        this.localServer.register("*", new HttpRequestHandler() {
           
            /**
             * {@inheritDoc}
             */
            public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
View Full Code Here

     *            then it will return an RFC2616 compliant deflate encoded zlib stream.
     * @return a non-null {@link HttpRequestHandler}
     */
    private HttpRequestHandler createDeflateEncodingRequestHandler(
            final String entityText, final boolean rfc1951) {
        return new HttpRequestHandler() {

            /**
             * {@inheritDoc}
             */
            public void handle(
View Full Code Here

     * @param entityText
     *            the non-null String entity to be returned by the server
     * @return a non-null {@link HttpRequestHandler}
     */
    private HttpRequestHandler createGzipEncodingRequestHandler(final String entityText) {
        return new HttpRequestHandler() {

            /**
             * {@inheritDoc}
             */
            public void handle(
View Full Code Here

        mgr.shutdown();
    }

    public void testReleaseOnIOException() throws Exception {
       
        localServer.register("/dropdead", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here

            if (!CollectionUtils.isEmpty(classes)) {
                for (final String key : keys) {
                    final Object value = handlers.get(key);
                    final String[] tokens = CollectionUtils.delimitedListToStringArray(value.toString(), ":");
                    if (tokens.length == 2 && "true".equalsIgnoreCase(tokens[0])) {
                        final HttpRequestHandler handler = getHandler(listener,
                                classes.get(key));
                        if (null != handler) {
                            final String regKey = getRegistryPattern(tokens[1]);
                            reqistry.register(regKey, handler);
                            logHandler(regKey, handler.getClass());
                        }
                    }
                }
            }
        }
View Full Code Here

    @Test
    public void testBasicRedirect302NoLocation() throws Exception {
        String host = this.target.getHostName();
        int port = this.target.getPort();
        this.localServer.register("*", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here

TOP

Related Classes of org.apache.http.protocol.HttpRequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.