Examples of ResponseContext


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

        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.ResponseContext

        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.ResponseContext

        return new StringResponseContext("Version successfully created", 200);
    }

    private ResponseContext buildResponseContextFromFeed(Feed feed) {
        Document<Feed> docFeed = feed.getDocument();
        ResponseContext rc = new BaseResponseContext<Document<Feed>>(docFeed);
        rc.setEntityTag(calculateEntityTag(docFeed.getRoot()));
        Date updated = feed.getUpdated();
        if (updated != null) {
            rc.setLastModified(updated);
        }
        return rc;
    }
View Full Code Here

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

  implements Filter {
 
  public ResponseContext filter(
    RequestContext request,
    FilterChain chain) {
      ResponseContext resp = chain.next(request);
      String format = request.getParameter("format");
      return (resp.getContentType() != null &&
        jsonPreferred(request,resp.getContentType().toString())) ||
        (format != null && format.equalsIgnoreCase("json")) ?
        new JsonResponseContext(resp,request.getAbdera()) :
        resp;
  }
View Full Code Here

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

    public ResponseContext search(RequestContext request, Map<String, String> parameters) {
        List<T> searchResults = this.doSearch(request, parameters);
        Feed feed = this.createFeed(request, parameters, searchResults);
        Document<Feed> document = feed.getDocument();
        ResponseContext response = new BaseResponseContext<Document<Feed>>(document);
        return response;
    }
View Full Code Here

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

    public ResponseContext process(RequestContext requestContext, WorkspaceManager workspaceManager, CollectionAdapter collectionAdapter) {
        String method = requestContext.getMethod();
        if (method.equalsIgnoreCase("GET")) {
            OpenSearchDescription description = this.openSearchInfo.asOpenSearchDescriptionElement(requestContext);
            ResponseContext response = new BaseResponseContext(description);
            response.setContentType(OpenSearchConstants.OPENSEARCH_DESCRIPTION_CONTENT_TYPE);
            return response;
        } else {
            return null;
        }
    }
View Full Code Here

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

  }
 
  public ResponseContext filter(
    RequestContext request,
    FilterChain chain) {
      ResponseContext response = super.filter(request,chain);
      DHContext context = getDHContext(request);
      response.setHeader(
        Constants.CONTENT_ENCRYPTED,
        context.getResponseString());
      return response;
  }
View Full Code Here

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

    RequestContext request) {}

  public ResponseContext filter(
    RequestContext request,
    FilterChain chain) {
      ResponseContext response = super.filter(request, chain);
      String method = request.getMethod();
      // include a Accept-Encryption header in the response to GET, HEAD and OPTIONS requests
      // the header will specify all the information the client needs to construct
      // it's own DH context and encrypt the request
      if ("GET".equalsIgnoreCase(method) ||
          "HEAD".equalsIgnoreCase(method) ||
          "OPTIONS".equalsIgnoreCase(method)) {
        DHContext context =
          (DHContext) request.getAttribute(
            Scope.SESSION,
            "dhcontext");
        if (context == null) {
          context = new DHContext();
          request.setAttribute(Scope.SESSION, "dhcontext", context);
        }
        response.setHeader(
          Constants.ACCEPT_ENCRYPTION,
          context.getRequestString());
      }
      return response;
  }
View Full Code Here

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

* parameter
*/
public class JSONFilter implements Filter {

    public ResponseContext filter(RequestContext request, FilterChain chain) {
        ResponseContext resp = chain.next(request);
        String format = request.getParameter("format");
        return (resp.getContentType() != null && jsonPreferred(request, resp.getContentType().toString())) || (format != null && format
            .equalsIgnoreCase("json")) ? new JsonResponseContext(resp, request.getAbdera()) : resp;
    }
View Full Code Here

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

                EasyMock.replay(requestMock);
               
                EasyMock.expect(adapterMock.getEntry(requestMock)).andReturn(responseMock);
                EasyMock.replay(adapterMock);
               
                ResponseContext response = processor.processEntry(requestMock, adapterMock);
                assertNotNull(response);
        }
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.