Examples of MovieDbException


Examples of com.omertron.themoviedbapi.MovieDbException

    public static String request(String url) throws MovieDbException {
        try {
            return request(new URL(url));
        } catch (MalformedURLException ex) {
            throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
        }
    }
View Full Code Here

Examples of com.omertron.themoviedbapi.MovieDbException

                cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword);
            }

            return cnx;
        } catch (IOException ex) {
            throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
        }
    }
View Full Code Here

Examples of com.omertron.themoviedbapi.MovieDbException

            try {
                cnx = (HttpURLConnection) openProxiedConnection(url);

                // If we get a null connection, then throw an exception
                if (cnx == null) {
                    throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, "No HTTP connection could be made.", url);
                }

                if (isDeleteRequest) {
                    cnx.setDoOutput(true);
                    cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                    cnx.setRequestMethod("DELETE");
                }

                sendHeader(cnx);

                if (StringUtils.isNotBlank(jsonBody)) {
                    cnx.setDoOutput(true);
                    wr = new OutputStreamWriter(cnx.getOutputStream());
                    wr.write(jsonBody);
                }

                readHeader(cnx);

                // http://stackoverflow.com/questions/4633048/httpurlconnection-reading-response-content-on-403-error
                if (cnx.getResponseCode() >= 400) {
                    in = new BufferedReader(new InputStreamReader(cnx.getErrorStream(), getCharset(cnx)));
                } else {
                    in = new BufferedReader(new InputStreamReader(cnx.getInputStream(), getCharset(cnx)));
                }

                String line;
                while ((line = in.readLine()) != null) {
                    content.write(line);
                }
            } finally {
                if (wr != null) {
                    wr.flush();
                    wr.close();
                }

                if (in != null) {
                    in.close();
                }

                if (cnx instanceof HttpURLConnection) {
                    ((HttpURLConnection) cnx).disconnect();
                }
            }
            return content.toString();
        } catch (IOException ex) {
            throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, url, ex);
        } finally {
            if (content != null) {
                try {
                    content.close();
                } catch (IOException ex) {
View Full Code Here

Examples of org.ops4j.pax.exam.sample2.movieimport.MovieDbException

        return null;
    }

    public User register(String login, String name, String password) {
        if (findByLogin(login) != null) {
            throw new MovieDbException("login is already taken");
        }
        User user = new User();
        user.setId(login);
        user.setName(name);
        user.setPassword(password);
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.