Package org.restlet.data

Examples of org.restlet.data.Method


     *
     * @throws IOException
     * @throws ResourceException
     */
    public void testSI() throws IOException, ResourceException {
        Method method = AnnotatedResource9TestCase.SI;

        String text = "text";
        Form form = new Form();
        form.add("key", "value");

View Full Code Here


     *
     * @throws IOException
     * @throws ResourceException
     */
    public void testSNI() throws IOException, ResourceException {
        Method method = AnnotatedResource9TestCase.SNI;

        String text = "text";
        Form form = new Form();
        form.add("key", "value");

View Full Code Here

     *
     * @throws IOException
     * @throws ResourceException
     */
    public void testUSI() throws IOException, ResourceException {
        Method method = AnnotatedResource9TestCase.USI;

        String text = "text";
        Form form = new Form();
        form.add("key", "value");

View Full Code Here

     *
     * @throws IOException
     * @throws ResourceException
     */
    public void testUSNI() throws IOException, ResourceException {
        Method method = AnnotatedResource9TestCase.USNI;

        String text = "text";
        Form form = new Form();
        form.add("key", "value");

View Full Code Here

     * @param name
     *            The method name.
     * @return The associated method.
     */
    public static Method valueOf(final String name) {
        Method result = null;

        if ((name != null) && !name.equals("")) {
            if (name.equalsIgnoreCase(ACK.getName())) {
                result = ACK;
            } else if (name.equalsIgnoreCase(BYE.getName())) {
                result = BYE;
            } else if (name.equalsIgnoreCase(CANCEL.getName())) {
                result = CANCEL;
            } else if (name.equalsIgnoreCase(INFO.getName())) {
                result = INFO;
            } else if (name.equalsIgnoreCase(INVITE.getName())) {
                result = INVITE;
            } else if (name.equalsIgnoreCase(NOTIFY.getName())) {
                result = NOTIFY;
            } else if (name.equalsIgnoreCase(OPTIONS.getName())) {
                result = OPTIONS;
            } else if (name.equalsIgnoreCase(PUBLISH.getName())) {
                result = PUBLISH;
            } else if (name.equalsIgnoreCase(REFER.getName())) {
                result = REFER;
            } else if (name.equalsIgnoreCase(REGISTER.getName())) {
                result = REGISTER;
            } else if (name.equalsIgnoreCase(SUBSCRIBE.getName())) {
                result = SUBSCRIBE;
            } else {
                result = new Method(name);
            }
        }

        return result;
    }
View Full Code Here

                        if (bestResMethod == null) {
                            bestResMethod = currentResMethod;
                        } else {
                            if (requHttpMethod.equals(Method.HEAD)) {
                                // special handling for HEAD
                                final Method bestMethodHttp;
                                bestMethodHttp = bestResMethod.getHttpMethod();
                                if (bestMethodHttp.equals(Method.GET)
                                        && currentResMethod.getHttpMethod()
                                                .equals(Method.HEAD)) {
                                    // ignore HEAD method
                                } else if (bestMethodHttp.equals(Method.HEAD)
                                        && currentResMethod.getHttpMethod()
                                                .equals(Method.GET)) {
                                    bestResMethod = currentResMethod;
                                } else {
                                    // use one of the methods, e.g. the first
View Full Code Here

     * @return The response entity.
     * @throws ResourceException
     */
    protected Representation doHandle() throws ResourceException {
        Representation result = null;
        Method method = getMethod();

        if (method == null) {
            setStatus(Status.CLIENT_ERROR_BAD_REQUEST, "No method specified");
        } else {
            if (method.equals(Method.PUT)) {
                result = put(getRequestEntity());
            } else if (isExisting()) {
                if (method.equals(Method.GET)) {
                    result = get();
                } else if (method.equals(Method.POST)) {
                    result = post(getRequestEntity());
                } else if (method.equals(Method.DELETE)) {
                    result = delete();
                } else if (method.equals(Method.HEAD)) {
                    result = head();
                } else if (method.equals(Method.OPTIONS)) {
                    result = options();
                } else {
                    result = doHandle(method, getRequestEntity());
                }
            } else {
View Full Code Here

     * @return The response entity.
     * @throws ResourceException
     */
    protected Representation doHandle(Variant variant) throws ResourceException {
        Representation result = null;
        Method method = getMethod();

        if (method == null) {
            setStatus(Status.CLIENT_ERROR_BAD_REQUEST, "No method specified");
        } else {
            if (method.equals(Method.PUT)) {
                result = put(getRequestEntity(), variant);
            } else if (isExisting()) {
                if (method.equals(Method.GET)) {
                    if (variant instanceof Representation) {
                        result = (Representation) variant;
                    } else {
                        result = get(variant);
                    }
                } else if (method.equals(Method.POST)) {
                    result = post(getRequestEntity(), variant);
                } else if (method.equals(Method.DELETE)) {
                    result = delete(variant);
                } else if (method.equals(Method.HEAD)) {
                    if (variant instanceof Representation) {
                        result = (Representation) variant;
                    } else {
                        result = head(variant);
                    }
                } else if (method.equals(Method.OPTIONS)) {
                    if (variant instanceof Representation) {
                        result = (Representation) variant;
                    } else {
                        result = options(variant);
                    }
View Full Code Here

    private XMLConfiguration xmlConfig;
   
    private TileLayerDispatcher layerDispatcher;
   
    public void handle(Request request, Response response) {
        Method met = request.getMethod();
        try {
            if(met.equals(Method.GET)) {
                doGet(request, response);
            } else {
                // These modify layers, so we reload afterwards
                if (met.equals(Method.POST)) {
                    doPost(request, response);
                } else if (met.equals(Method.PUT)) {
                    doPut(request, response);
                } else if (met.equals(Method.DELETE)) {
                    doDelete(request, response);
                } else {
                    throw new RestletException("Method not allowed",
                        Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
                }
View Full Code Here

    private TileBreeder seeder;

    public void handle(Request request, Response response) {
       
        Method met = request.getMethod();
        try {
            if (met.equals(Method.GET)) {
                doGet(request, response);
            } else if (met.equals(Method.POST)) {
                try {
                    doPost(request, response);
                } catch (GeoWebCacheException e) {
                    throw new RestletException(e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
                }
View Full Code Here

TOP

Related Classes of org.restlet.data.Method

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.