Package org.apache.abdera.protocol.server.provider

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


            if (type == TargetType.TYPE_MEDIA) {
              return provider.deleteMedia(request);
            }
          }
          else if (method == "OPTIONS") {
            AbstractResponseContext rc = new EmptyResponseContext(200);
            rc.addHeader("Allow", combine(getAllowedMethods(type)));
            return rc;
          }
        } else {
          return handler.process(provider, request);
        }
View Full Code Here


        output(response,process(provider, requestContext));
      }
    } catch (Throwable e) {
      logger.error("Error producing output", e);
      try {
        output(response,new EmptyResponseContext(500));
      } catch (Exception ex) {
        logger.error("Error outputting error", ex);
        response.sendError(500);
      }
    } finally {
View Full Code Here

      Abdera abdera = request.getServiceContext().getAbdera();
      Document<Service> service = get_service_doc(abdera);
      AbstractResponseContext rc;
      rc = (full) ?
        new BaseResponseContext<Document<Service>>(service) :
        new EmptyResponseContext(200);
      rc.setEntityTag(service_etag);
      return rc;
  }
View Full Code Here

      Abdera abdera = request.getServiceContext().getAbdera();
      Document<Feed> feed = get_feed_doc(abdera);
      AbstractResponseContext rc;
      rc = (full) ?
        new BaseResponseContext<Document<Feed>>(feed) :
        new EmptyResponseContext(200);
      rc.setEntityTag(calculateEntityTag(feed.getRoot()));
      return rc;
  }
View Full Code Here

      Parser parser = abdera.getParser();
      try {
        MimeType contentType = request.getContentType();
        String ctype = (contentType != null) ? contentType.toString() : null;
        if (ctype != null && !MimeTypeHelper.isAtom(ctype) && !MimeTypeHelper.isXml(ctype))
          return new EmptyResponseContext(415);

        Document<Entry> entry_doc =
          (Document<Entry>) request.getDocument(parser).clone();
        if (entry_doc != null) {
          Entry entry = entry_doc.getRoot();
          if (!isValidEntry(entry))
            return new EmptyResponseContext(400);
          entry.setUpdated(new Date());
          entry.getIdElement().setValue(factory.newUuidUri());
          entry.addLink("feed/" + entry.getId().toString(), "edit");
          Feed feed = get_feed_doc(abdera).getRoot();
          feed.insertEntry(entry);
          feed.setUpdated(new Date());
          BaseResponseContext rc = new BaseResponseContext(entry);
          IRI baseUri = resolveBase(request);
          rc.setLocation(baseUri.resolve(entry.getEditLinkResolvedHref()).toString());
          rc.setContentLocation(rc.getLocation().toString());
          rc.setEntityTag(calculateEntityTag(entry));
          rc.setStatus(201);
          return rc;
        } else {
          return new EmptyResponseContext(400);
        }
      } catch (ParseException pe) {
        return new EmptyResponseContext(415);
      } catch (ClassCastException cce) {
        return new EmptyResponseContext(415);
      } catch (Exception e) {
        return new EmptyResponseContext(400);
      }
  }
View Full Code Here

  public ResponseContext deleteEntry(
    RequestContext request) {
      Entry entry = getEntry(request);
      if (entry != null)
        entry.discard();
      return new EmptyResponseContext(204);
  }
View Full Code Here

        entry = (Entry) entry.clone();
        entry.setSource(feed.getAsSource());
        Document<Entry> entry_doc = entry.getDocument();
        AbstractResponseContext rc = (full) ?
          new BaseResponseContext<Document<Entry>>(entry_doc) :
          new EmptyResponseContext(200);
        rc.setEntityTag(calculateEntityTag(entry));
        return rc;
      } else {
        return new EmptyResponseContext(404);
      }
  }
View Full Code Here

      Entry orig_entry = getEntry(request);
      if (orig_entry != null) {
        try {
          MimeType contentType = request.getContentType();
          if (contentType != null && !MimeTypeHelper.isAtom(contentType.toString()))
            return new EmptyResponseContext(415);
         
          Document<Entry> entry_doc =
            (Document<Entry>) request.getDocument(parser).clone();
          if (entry_doc != null) {
            Entry entry = entry_doc.getRoot();
            if (!entry.getId().equals(orig_entry.getId()))
              return new EmptyResponseContext(409);
            if (!isValidEntry(entry))
              return new EmptyResponseContext(400);
            entry.setUpdated(new Date());
            entry.getIdElement().setValue(factory.newUuidUri());
            entry.addLink("atom/feed/" + entry.getId().toString(), "edit");
            orig_entry.discard();
            Feed feed = get_feed_doc(abdera).getRoot();
            feed.insertEntry(entry);
            feed.setUpdated(new Date());
            return new EmptyResponseContext(204);
          } else {
            return new EmptyResponseContext(400);
          }
        } catch (ParseException pe) {
          return new EmptyResponseContext(415);
        } catch (ClassCastException cce) {
          return new EmptyResponseContext(415);
        } catch (Exception e) {
          return new EmptyResponseContext(400);
        }
      } else {
        return new EmptyResponseContext(404);
      }
  }
View Full Code Here

    return segments[segments.length-1];
  }
 
  public ResponseContext entryPost(
    RequestContext request) {
      return new EmptyResponseContext(403);
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.provider.EmptyResponseContext

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.