Examples of ResponseHandler


Examples of org.apache.http.client.ResponseHandler

            HttpPost httpost = new HttpPost(request.getParameter("url"));
            StringEntity se = new StringEntity(jsondata, "UTF-8");
            httpost.setEntity(se);
            httpost.setHeader("Accept", "application/json");
            httpost.setHeader("Content-type", "application/json");
            ResponseHandler responseHandler = new BasicResponseHandler();
            httpclient.execute(httpost, responseHandler);
           
            JSONWriter writer = new JSONWriter(response.getWriter());
            writer.object();
            writer.key("ok");
View Full Code Here

Examples of org.astrogrid.samp.client.ResponseHandler

     * @return   tag
     */
    private synchronized String getTag() {
        if ( tag_ == null ) {
            final String tag = connector_.createTag( this );
            ResponseHandler handler = new ResponseHandler() {
                public boolean ownsTag( String msgTag ) {
                    return tag.equals( msgTag );
                }
                public void receiveResponse( HubConnection connection,
                                             String responderId, String msgTag,
View Full Code Here

Examples of org.jboss.aerogear.controller.router.decorators.ResponseHandler

            final RouteProcessor defaultRouteProcessor = new DefaultRouteProcessor(consumers, endpointInvoker);
            final RouteProcessor paginationHandler = new PaginationHandler(defaultRouteProcessor, pagingInstance, consumers,
                    endpointInvoker);
            final RouteProcessor securityHandler = new SecurityHandler(paginationHandler, securityProviderInstance);
            final RouteProcessor errorHandler = new ErrorHandler(securityHandler, endpointInvoker);
            routeProcessor = new ResponseHandler(errorHandler, mockResponders.getResponders());
            return routeProcessor;
        } else {
            return routeProcessor;
        }
    }
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

        ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
        contextResourceClientFactory.setAcceptedMediaTypes( MediaType.APPLICATION_JSON );
        //END SNIPPET: client-create1

        //START SNIPPET: client-create2
        contextResourceClientFactory.setErrorHandler( new ErrorHandler().onError( ErrorHandler.AUTHENTICATION_REQUIRED, new ResponseHandler()
        {
            boolean tried = false;

            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                    if (tried)
                        throw new ResourceException( response.getStatus() );

                    tried = true;
                    client.getContextResourceClientFactory().getInfo().setUser( new User("rickard", "secret") );

                    // Try again
                    return refresh();
            }
        } ).onError( ErrorHandler.RECOVERABLE_ERROR, new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                // Try to restart
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

            {
                Link link = LinksUtil.withId( "right", result );

                return command( link );
            }
        } ).onCommand( "commandwithvalue", new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                System.out.println( "Done" );
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

                    @Override
                    public HandlerCommand handleResult( Links result, ContextResourceClient client )
                    {
                        Link link = LinksUtil.withId( "right", result );

                        return command( link ).onSuccess( new ResponseHandler()
                        {
                            @Override
                            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
                            {
                                System.out.println( "Done" );
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

    }

    public <T> HandlerCommand onSuccess(final ResultHandler<T> resultHandler)
    {
        final Class<T> resultType = (Class<T>) Classes.RAW_CLASS.map(( (ParameterizedType) resultHandler.getClass().getGenericInterfaces()[ 0 ] ).getActualTypeArguments()[0]);
        this.responseHandler = new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                T result = client.getContextResourceClientFactory().readResponse( response, resultType );
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

    }

    public <T> HandlerCommand onProcessingError(final ResultHandler<T> resultHandler)
    {
        final Class<T> resultType = (Class<T>) Classes.RAW_CLASS.map(( (ParameterizedType) resultHandler.getClass().getGenericInterfaces()[ 0 ] ).getActualTypeArguments()[0]);
        this.processingErrorHandler = new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                T result = client.getContextResourceClientFactory().readResponse( response, resultType );
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

                return null;
            }
        } );

        contextResourceClientFactory.setErrorHandler( new ErrorHandler().onError( ErrorHandler.RECOVERABLE_ERROR, new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                System.out.println( ">> REFRESH on recoverable error: " + response.getStatus() );
View Full Code Here

Examples of org.qi4j.library.rest.client.spi.ResponseHandler

        return this;
    }

    public <T> ContextResourceClient onResource( final ResultHandler<T> handler)
    {
        resourceHandler = new ResponseHandler()
        {
            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
            {
                final Class<T> resultType = (Class<T>) Classes.RAW_CLASS.map(( (ParameterizedType) handler.getClass().getGenericInterfaces()[ 0 ] ).getActualTypeArguments()[0]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.