Package org.apache.pivot.web

Examples of org.apache.pivot.web.QueryException


     * @param path
     *
     * @throws QueryException
     */
    protected void doDelete(Path path) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here


     * The result of the GET.
     *
     * @throws QueryException
     */
    protected Object doGet(Path path) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here

            synchronized (this) {
                value = expenseMap.get(id);
            }

            if (value == null) {
                throw new QueryException(Query.Status.NOT_FOUND);
            }
        }

        return value;
    }
View Full Code Here

    }

    @Override
    protected URL doPost(Path path, Object value) throws QueryException {
        if (value == null) {
            throw new QueryException(Query.Status.BAD_REQUEST);
        }

        Expense expense = (Expense)value;

        // Add the expense to the list/map
        int id;
        synchronized (this) {
            id = nextID++;
            expense.setID(id);
            expenses.add(expense);
            expenseMap.put(id, expense);
        }

        // Return the location of the newly-created resource
        URL location = getLocation();
        try {
            location = new URL(location, Integer.toString(id));
        } catch (MalformedURLException exception) {
            throw new QueryException(Query.Status.INTERNAL_SERVER_ERROR);
        }

        return location;
    }
View Full Code Here

    @Override
    protected boolean doPut(Path path, Object value) throws QueryException {
        if (path.getLength() == 0
            || value == null) {
            throw new QueryException(Query.Status.BAD_REQUEST);
        }

        // Get the ID of the expense to retrieve from the path
        int id = Integer.parseInt(path.get(0));
View Full Code Here

    }

    @Override
    protected void doDelete(Path path) throws QueryException {
        if (path.getLength() == 0) {
            throw new QueryException(Query.Status.BAD_REQUEST);
        }

        // Get the ID of the expense to retrieve from the path
        int id = Integer.parseInt(path.get(0));

        // Update the list/map
        Expense expense;
        synchronized (this) {
            expense = expenseMap.remove(id);
            expenses.remove(expense);
        }

        if (expense == null) {
            throw new QueryException(Query.Status.NOT_FOUND);
        }
    }
View Full Code Here

     * The result of the GET.
     *
     * @throws QueryException
     */
    protected Object doGet(Path path) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here

     * operation did not result in the creation of a resource.
     *
     * @throws QueryException
     */
    protected URL doPost(Path path, Object value) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here

     * <tt>false</tt>, otherwise.
     *
     * @throws QueryException
     */
    protected boolean doPut(Path path, Object value) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here

     * @param path
     *
     * @throws QueryException
     */
    protected void doDelete(Path path) throws QueryException {
        throw new QueryException(Query.Status.METHOD_NOT_ALLOWED);
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.web.QueryException

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.