Package org.apache.abdera.protocol.server

Examples of org.apache.abdera.protocol.server.Target


            link.setHref(href);
        }
    }

    public ResponseContext postEntry(RequestContext request) {
        Target target = request.getTarget();
        String feed = target.getParameter("feed");
        Session session = new Session(host, port);
        Database db = session.getDatabase(feed);
        try {
            CharArrayWriter cwriter = new CharArrayWriter();
            setEditDetail(request);
View Full Code Here


        }
        return Sanitizer.sanitize(slug, "", true, Normalizer.Form.D);
    }

    public ResponseContext getEntry(RequestContext request) {
        Target target = request.getTarget();
        String feed = target.getParameter("feed");
        String entry = target.getParameter("entry");
        Session session = new Session(host, port);
        Database db = session.getDatabase(feed);
        Document doc = null;
        try {
            doc = db.getDocument(entry);
View Full Code Here

        else
            return ProviderHelper.notfound(request);
    }

    public ResponseContext putEntry(RequestContext request) {
        Target target = request.getTarget();
        String feed = target.getParameter("feed");
        Session session = new Session(host, port);
        Database db = session.getDatabase(feed);
        try {
            CharArrayWriter cwriter = new CharArrayWriter();
            setEditDetail(request);
            request.getDocument().getRoot().writeTo("json", cwriter);
            String json = new String(cwriter.toCharArray());
            JSONObject obj = JSONObject.fromObject(json);
            String key = target.getParameter("entry");
            Document doc = null;
            try {
                doc = db.getDocument(key);
            } catch (Exception e) {
                // error if the doc isn't found, we deal with the null result below
View Full Code Here

        // .mapTargetParameter("o", "outputEncoding"));

    }

    public ResponseContext process(RequestContext request) {
        Target target = request.getTarget();
        if (target == null || target.getType() == TargetType.TYPE_NOT_FOUND) {
            return ProviderHelper.notfound(request);
        }

        TargetType type = target.getType();
        RequestProcessor processor = this.requestProcessors.get(type);
        if (processor == null) {
            return ProviderHelper.notfound(request);
        }
View Full Code Here

        feed.getDocument(), 200, null);
  }
     
  public ResponseContext deleteEntry(
    RequestContext request) {
      Target target = request.getTarget();
      String key = target.getParameter("entry");
      File file = getFile(key,false);
      if (file.exists()) file.delete();
      return ProviderHelper.nocontent();
  }
View Full Code Here

      return ProviderHelper.nocontent();
  }
 
  public ResponseContext getEntry(
    RequestContext request) {
      Target target = request.getTarget();
      String key = target.getParameter("entry");
      File file = getFile(key,false);
      Entry entry = getEntry(file);
      if (entry != null)
        return ProviderHelper.returnBase(entry.getDocument(), 200, null);
      else
View Full Code Here

  private void setEditDetail(
    RequestContext request,
    Entry entry,
    String key)
      throws IOException {
    Target target = request.getTarget();
    String feed = target.getParameter("feed");
    String id = key;
    entry.setEdited(new Date());
    Link link = entry.getEditLink();
    Map<String,Object> params = new HashMap<String,Object>();
    params.put("feed", feed);
View Full Code Here

 
  public ResponseContext filter(
    RequestContext request,
    FilterChain chain) {
   
      Target target = request.getTarget();
      TargetType type = target.getType();
      if (type == TYPE_OPENSEARCH_DESCRIPTION) {
        return getOpenSearchDescription(request);
      } else {
        for (Entry<String,String> entry : map.entrySet()) {
          String value = target.getParameter(entry.getKey());
          if (value != null)
            request.setAttribute(
              OS_PREFIX + "_" + entry.getValue(), value);
        }
        return chain.next(request);
View Full Code Here

 
  protected abstract Resolver<Target> getTargetResolver(RequestContext request);

  public ResponseContext process(
    RequestContext request) {   
      Target target = request.getTarget();
      if (target == null ||
          target.getType() == TargetType.TYPE_NOT_FOUND)
        return ProviderHelper.notfound(request);
      String method = request.getMethod();
      TargetType type = target.getType();
      if (type == TargetType.TYPE_SERVICE &&
          method.equalsIgnoreCase("GET")) {
          return getServiceDocument(request);
      }
      WorkspaceManager wm = getWorkspaceManager(request);
View Full Code Here

          .setEntityTag(res.getRev());
  }
     
  public ResponseContext deleteEntry(
    RequestContext request) {
      Target target = request.getTarget();
      String feed = target.getParameter("feed");
      String entry = target.getParameter("entry");
      Session session = new Session(host,port);
      Database db = session.getDatabase(feed);
      Document doc = null;
      try {
        doc = db.getDocument(entry);
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.Target

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.