Package org.apache.jena.atlas.web

Examples of org.apache.jena.atlas.web.HttpException


                // Check for successful login
                if (response.getStatusLine().getStatusCode() >= 400) {
                    LOG.warn("Failed to login against " + login.getLoginFormURL() + " to obtain authentication for access to "
                            + target.toString());
                    throw new HttpException(response.getStatusLine().getStatusCode(), "Login attempt failed - "
                            + response.getStatusLine().getReasonPhrase());
                }

                // Otherwise assume a successful login
                LOG.info("Successfully logged in against " + login.getLoginFormURL()
                        + " and obtained authentication for access to " + target.toString());
                login.setCookies(client.getCookieStore());

                // Consume the response to free up the connection
                EntityUtils.consumeQuietly(response.getEntity());
            } catch (UnsupportedEncodingException e) {
                throw new HttpException("UTF-8 encoding not supported on your platform", e);
            } catch (IOException e) {
                throw new HttpException("Error making login request", e);
            }
        }
    }
View Full Code Here


            if (HttpSC.isClientError(statusCode) || HttpSC.isServerError(statusCode)) {
                log.debug(format("[%d] %s %s", id, statusLine.getStatusCode(), statusLine.getReasonPhrase()));
                // Error responses can have bodies so it is important to clear
                // up.
                EntityUtils.consume(response.getEntity());
                throw new HttpException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
            }
            // Redirects are followed by HttpClient.
            if (handler != null)
                handler.handle(baseURI, response);
        } catch (IOException ex) {
            throw new HttpException(ex);
        }
    }
View Full Code Here

            int statusCode = statusLine.getStatusCode();
            if (HttpSC.isClientError(statusCode) || HttpSC.isServerError(statusCode)) {
                log.debug(format("[%d] %s %s", id, statusLine.getStatusCode(), statusLine.getReasonPhrase()));
                // Error responses can have bodies so it is important to clear up.
                EntityUtils.consume(response.getEntity());
                throw new HttpException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
            }
            // Redirects are followed by HttpClient.
            if (handler != null)
                handler.handle(baseURI, response);
        } catch (IOException ex) {
            throw new HttpException(ex);
        }
    }
View Full Code Here

                // Check for successful login
                if (response.getStatusLine().getStatusCode() >= 400) {
                    LOG.warn("Failed to login against " + login.getLoginFormURL() + " to obtain authentication for access to "
                            + target.toString());
                    throw new HttpException(response.getStatusLine().getStatusCode(), "Login attempt failed - "
                            + response.getStatusLine().getReasonPhrase());
                }

                // Otherwise assume a successful login
                LOG.info("Successfully logged in against " + login.getLoginFormURL()
                        + " and obtained authentication for access to " + target.toString());
                login.setCookies(client.getCookieStore());

                // Consume the response to free up the connection
                EntityUtils.consumeQuietly(response.getEntity());
            } catch (UnsupportedEncodingException e) {
                throw new HttpException("UTF-8 encoding not supported on your platform", e);
            } catch (IOException e) {
                throw new HttpException("Error making login request", e);
            }
        }
    }
View Full Code Here

                return null ;
            }
            if ( statusLine.getStatusCode() >= 400 )
            {
                log.debug(format("[%d] %s %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase())) ;
                throw new HttpException(statusLine.getStatusCode()+" "+statusLine.getReasonPhrase()) ;
            }
   
            HttpEntity entity = response.getEntity() ;
            if ( entity == null )
            {
View Full Code Here

        try {
            StatusLine statusLine = response.getStatusLine() ;
            if ( statusLine.getStatusCode() >= 400 )
            {
                log.debug(format("[%d] %s %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase())) ;
                throw new HttpException(statusLine.getStatusCode()+" "+statusLine.getReasonPhrase()) ;
            }

            String ct = "*" ;
            MediaType mt = null ;
            if ( statusLine.getStatusCode() == 200 )
View Full Code Here

            if (HttpSC.isClientError(statusCode) || HttpSC.isServerError(statusCode)) {
                log.debug(format("[%d] %s %s", id, statusLine.getStatusCode(), statusLine.getReasonPhrase()));
                // Error responses can have bodies so it is important to clear
                // up.
        final String contentPayload = readPayload(response.getEntity());
        throw new HttpException(statusLine.getStatusCode(), statusLine.getReasonPhrase(), contentPayload);
            }
            // Redirects are followed by HttpClient.
            if (handler != null)
                handler.handle(baseURI, response);
        } catch (IOException ex) {
            throw new HttpException(ex);
        }
    }
View Full Code Here

        // Check for successful login
                if (response.getStatusLine().getStatusCode() >= 400) {
                    LOG.warn("Failed to login against " + login.getLoginFormURL() + " to obtain authentication for access to "
                            + target.toString());
                    throw new HttpException(response.getStatusLine().getStatusCode(), "Login attempt failed - "
                            + response.getStatusLine().getReasonPhrase(), payload);
                }

                // Otherwise assume a successful login
                LOG.info("Successfully logged in against " + login.getLoginFormURL()
                        + " and obtained authentication for access to " + target.toString());
                login.setCookies(client.getCookieStore());

            } catch (UnsupportedEncodingException e) {
                throw new HttpException("UTF-8 encoding not supported on your platform", e);
            } catch (IOException e) {
                throw new HttpException("Error making login request", e);
            }
        }
    }
View Full Code Here

                return null ;
            }
            if ( statusLine.getStatusCode() >= 400 )
            {
                log.debug(format("[%d] %s %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase())) ;
                throw new HttpException(statusLine.getStatusCode()+" "+statusLine.getReasonPhrase()) ;
            }
   
            HttpEntity entity = response.getEntity() ;
            if ( entity == null )
            {
View Full Code Here

        try {
            StatusLine statusLine = response.getStatusLine() ;
            if ( statusLine.getStatusCode() >= 400 )
            {
                log.debug(format("[%d] %s %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase())) ;
                throw new HttpException(statusLine.getStatusCode()+" "+statusLine.getReasonPhrase()) ;
            }

            String ct = "*" ;
            MediaType mt = null ;
            if ( statusLine.getStatusCode() == 200 )
View Full Code Here

TOP

Related Classes of org.apache.jena.atlas.web.HttpException

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.