diff options
author | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-24 14:45:36 +0000 |
---|---|---|
committer | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-24 14:45:36 +0000 |
commit | edf99237651912c729ae89464ca8cc1305c55957 (patch) | |
tree | eb4facbffd59c0d7fc590af412c5a1523c50402d /src/uk/org/ury/backend/handlers/LibraryRequestHandler.java | |
parent | cb0a78131286b1a312351308d2cb6e59ed122fef (diff) |
Documentation refresh; classpath update; CODECHANGE: moved content serving in request handling to abstract request handler.
Diffstat (limited to 'src/uk/org/ury/backend/handlers/LibraryRequestHandler.java')
-rw-r--r-- | src/uk/org/ury/backend/handlers/LibraryRequestHandler.java | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java b/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java index b175485..dd992a4 100644 --- a/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java +++ b/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java @@ -1,6 +1,14 @@ -/** +/* + * LibraryRequestHandler.java + * -------------------------- + * + * Part of the URY Backend Platform + * + * V0.00 2011/03/24 * + * (C) 2011 URY Computing */ + package uk.org.ury.backend.handlers; import java.io.UnsupportedEncodingException; @@ -12,9 +20,6 @@ import java.util.Map; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.entity.StringEntity; -import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; import uk.org.ury.backend.database.DatabaseDriver; @@ -34,9 +39,6 @@ import uk.org.ury.common.library.LibraryUtils; import uk.org.ury.common.library.exceptions.EmptySearchException; import uk.org.ury.common.library.item.LibraryItem; import uk.org.ury.common.protocol.Directive; -import uk.org.ury.common.protocol.ProtocolUtils; -import uk.org.ury.common.protocol.Status; -import uk.org.ury.common.protocol.exceptions.EncodeFailureException; /** * A request handler for library queries. @@ -74,7 +76,6 @@ public class LibraryRequestHandler extends AbstractRequestHandler { * @throws HandleFailureException * if an error occurs that thwarts the handling of the request. */ - private void doSearch(Map<String, String> parameters, Map<String, Object> response, Server server) throws HandleFailureException { @@ -170,23 +171,7 @@ public class LibraryRequestHandler extends AbstractRequestHandler { } else { throw new UnknownFunctionException(path); } - - response.setStatusLine(request.getProtocolVersion(), HttpStatus.SC_OK, - "OK"); - - content.put(Directive.STATUS.toString(), Status.OK.toString()); - - StringEntity entity = null; - - try { - entity = new StringEntity(ProtocolUtils.encode(content)); - } catch (UnsupportedEncodingException e) { - throw new HandlerSetupFailureException(getClass().getName(), e); - } catch (EncodeFailureException e) { - throw new HandleFailureException(e); - } - entity.setContentType(HTTP.PLAIN_TEXT_TYPE); - response.setEntity(entity); + serveContent(request, response, content); } } |