Package org.apache.abdera.protocol.server

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


    }

    private void runTestUrlFor(String expected, Map<String, String> context) {
        RouteManager manager = new RouteManager().addRoute(new Route("entry", "/base/:entry"));

        RequestContext request = createMock(RequestContext.class);
        expect(request.getContextPath()).andReturn("/app");
        replay(request);

        assertEquals(expected, manager.urlFor(request, "entry", context));
    }
View Full Code Here


    public void testStaticResolve() throws Exception {
        RouteManager manager = new RouteManager();
        manager.addRoute(new Route("collection", "/:coll"), TargetType.TYPE_COLLECTION)
            .addRoute(new Route("openSearch", "/openSearch.xml"), TargetType.TYPE_ENTRY);

        RequestContext request = createMock(RequestContext.class);
        expect(request.getTargetPath()).andReturn("/openSearch.xml");
        replay(request);

        RouteTarget target = (RouteTarget)manager.resolve(request);
        assertEquals("/openSearch.xml", target.getRoute().getPattern());
    }
View Full Code Here

public class SimpleSubjectResolver implements Resolver<Subject> {

    public static final Principal ANONYMOUS = new AnonymousPrincipal();

    public Subject resolve(Request request) {
        RequestContext context = (RequestContext)request;
        return resolve(context.getPrincipal());
    }
View Full Code Here

        route2CA.put(route, collectionAdapter);
        return addRoute(route, type);
    }

    public Target resolve(Request request) {
        RequestContext context = (RequestContext)request;
        String uri = context.getTargetPath();
        int idx = uri.indexOf('?');
        if (idx != -1) {
            uri = uri.substring(0, idx);
        }
View Full Code Here

        this.fields.put(p, fields);
        return this;
    }

    public Target resolve(Request request) {
        RequestContext context = (RequestContext)request;
        String uri = context.getTargetPath();
        for (Pattern pattern : patterns.keySet()) {
            Matcher matcher = pattern.matcher(uri);
            if (matcher.matches()) {
                TargetType type = this.patterns.get(pattern);
                String[] fields = this.fields.get(pattern);
View Full Code Here

    }

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
        IOException {
        RequestContext reqcontext = new ServletRequestContext(provider, request, getServletContext());
        FilterChain chain = new FilterChain(provider, reqcontext);
        try {
            output(request, response, chain.next(reqcontext));
        } catch (Throwable t) {
            error("Error servicing request", t, response);
View Full Code Here

            return this;
        }

        // override to exclude BaseTargetPath (and now to use ordered patterns)
        public Target resolve(Request request) {
            RequestContext context = (RequestContext) request;
            String uri = context.getTargetPath();
            if (uri.startsWith(context.getTargetBasePath())) {
                uri = uri.substring(context.getTargetBasePath().length());
            }
            // note: now first matching pattern wins
            for (Pattern pattern : orderedPatterns.keySet()) {
                Matcher matcher = pattern.matcher(uri);
                if (matcher.lookingAt()) {
View Full Code Here

      this.fields.put(p,fields);
      return this;
  }
 
  public Target resolve(Request request) {
    RequestContext context = (RequestContext) request;
    String uri = context.getTargetPath();
    for (Pattern pattern : patterns.keySet()) {
      Matcher matcher = pattern.matcher(uri);
      if (matcher.matches()) {
        TargetType type = this.patterns.get(pattern);
        String[] fields = this.fields.get(pattern);
View Full Code Here

    route2CA.put(route, collectionAdapter);
    return addRoute(route, type);
  }
 
  public Target resolve(Request request) {
    RequestContext context = (RequestContext) request;
    String uri = context.getTargetPath();
    int idx = uri.indexOf('?');
    if (idx != -1) {
      uri = uri.substring(0, idx);
    }
    for(Map.Entry<Route, TargetType> entry : targets.entrySet()) {
      if (entry.getKey().match(uri)) {
        CollectionAdapter ca = route2CA.get(entry.getKey());
        if (ca != null) {
          context.setAttribute(DefaultWorkspaceManager.COLLECTION_ADAPTER_ATTRIBUTE, ca);
        }
        return getTarget(context, entry.getKey(), uri, entry.getValue());
      }
    }
    return null;
View Full Code Here

  @Override
  protected void service(
    HttpServletRequest request,
    HttpServletResponse response)
      throws ServletException, IOException {
    RequestContext reqcontext =
      new ServletRequestContext(provider, request);
    FilterChain chain = new FilterChain(provider,reqcontext);
    try {
      output(
        request,
View Full Code Here

TOP

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

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.