Examples of EmptyResponseContext


Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

                    importURL,
                    resource);
        } catch (Exception e) {
            return new StringResponseContext(e, 500);
        }
        ResponseContext rc = new EmptyResponseContext(200);
        try {
            rc.setLocation(
                    URLDecoder.decode(getAtomURI(location, request), "UTF-8").replaceAll(" ", "+"));
        } catch (UnsupportedEncodingException e) {
            // no action
        }
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

        return rc;
    }

    private ResponseContext processRenameRequest(RequestContext request, String path) {
        if (!request.getMethod().equals("POST")) {
            ResponseContext rc = new EmptyResponseContext(405, "Method not allowed");
            rc.setAllow("POST");
            return rc;
        }

        try {
            InputStream is = request.getInputStream();
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

        return new StringResponseContext("Rename successful.", 200);
    }

    private ResponseContext processCopyRequest(RequestContext request, String path) {
        if (!request.getMethod().equals("POST")) {
            ResponseContext rc = new EmptyResponseContext(405, "Method not allowed");
            rc.setAllow("POST");
            return rc;
        }

        try {
            InputStream is = request.getInputStream();
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

        return new StringResponseContext("Copy successful.", 200);
    }

    private ResponseContext processMoveRequest(RequestContext request, String path) {
        if (!request.getMethod().equals("POST")) {
            ResponseContext rc = new EmptyResponseContext(405, "Method not allowed");
            rc.setAllow("POST");
            return rc;
        }

        try {
            InputStream is = request.getInputStream();
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

                getSecureRegistry(request).delete(path);
            }
        } catch (RegistryException e) {
            return new StackTraceResponseContext(e);
        }
        return new EmptyResponseContext(200);
    }
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

                        "ratings");
                Collection c;
                if (r instanceof Collection) {
                    c = (Collection) r;
                } else {
                    EmptyResponseContext res =
                            new EmptyResponseContext(400, "Empty Ratings result'");
                    myRegistry.get(path + RegistryConstants.URL_SEPARATOR + "ratings");
                    return res;
                }
                String[] ratings = (String[]) c.getContent();
                if (ratings != null && ratings.length > 0) {
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

        if (query == null) {
            parameters = new HashMap();
        } else {
            parameters = RemoteRegistry.decodeQueryString(query);
            if (parameters == null) {
                return new EmptyResponseContext(400,
                        "URI decoding failed on " + query + " at path " + path);
            }
        }

        Feed feed;
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

        String dateStr = parameters.get("from");
        if (dateStr != null) {
            try {
                fromDate = format.parse(dateStr);
            } catch (ParseException e) {
                return new EmptyResponseContext(400, "Bad 'from' date format '" + dateStr + "'");
            }
        }
        dateStr = parameters.get("to");
        if (dateStr != null) {
            try {
                toDate = format.parse(dateStr);
            } catch (ParseException e) {
                return new EmptyResponseContext(400, "Bad 'to' date format '" + dateStr + "'");
            }
        }
        boolean recentFirst = recentParam == null || recentParam.equals("true");
        int action = -1;
        LogEntry[] logs;
        try {
            final Registry reg = getSecureRegistry(request);
            logs = reg.getLogs(path, action, user, fromDate, toDate, recentFirst);
        } catch (RegistryException e) {
            return new StackTraceResponseContext(e);
        }
        String uri = request.getUri().toString();
        int colonIdx = uri.indexOf(':');
        if (colonIdx > -1 && uri.length() > colonIdx + 1) {
            int entryIdx;
            try {
                entryIdx = Integer.parseInt(uri.substring(colonIdx + 1));
            } catch (NumberFormatException e) {
                return new EmptyResponseContext(400, "Bad log entry id '" +
                        uri.substring(colonIdx + 1) + "'");
            }
            if (entryIdx < 0 || entryIdx > logs.length - 1) {
                return new EmptyResponseContext(400, "Bad log entry id '" + entryIdx + "'");
            }
            LogEntry logentry = logs[logs.length - 1 - entryIdx];
            Entry entry = factory.newEntry();
            entry.setUpdated(new Date());
            entry.setId("http://wso2.org/jdbcregistry,2007:logs:" + entryIdx);
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

                    final Registry registry = getSecureRegistry(request);
                    registry.applyTag(path, tag);
                } catch (Exception e) {
                    return new StackTraceResponseContext(e);
                }
                final EmptyResponseContext response = new EmptyResponseContext(200, "Tag applied");
                try {
                    response.setLocation(URLDecoder.decode(getAbsolutePath(request, path), "UTF-8")
                            .replaceAll(" ", "+") +
                            RegistryConstants.URL_SEPARATOR + "tags:" + tag);
                } catch (UnsupportedEncodingException e) {
                    // no action
                }
                return response;
            }
            String firstTag = null;
            try {
                InputStream is = request.getInputStream();
                String tagText = readToString(is);
                String[] tags = tagText.split(" ");
                for (String tag : tags) {
                    if (firstTag == null) {
                        firstTag = tag;
                    }
                    try {
                        final Registry registry = getSecureRegistry(request);
                        registry.applyTag(path, tag);
                    } catch (RegistryException e) {
                        return new StackTraceResponseContext(e);
                    }
                }
            } catch (IOException e) {
                return new StackTraceResponseContext(e);
            }
            final EmptyResponseContext response = new EmptyResponseContext(200, "Tag applied");
            try {
                response.setLocation(URLDecoder.decode(getAbsolutePath(request, path), "UTF-8")
                        .replaceAll(" ", "+") +
                        RegistryConstants.URL_SEPARATOR + "tags:" + firstTag);
            } catch (UnsupportedEncodingException e) {
                // no action
            }
View Full Code Here

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext

            registry.put(path, ret);
        } catch (Exception e) {
            return new StackTraceResponseContext(e);
        }

        return new EmptyResponseContext(200);
    }
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.