Examples of UriInfoImpl


Examples of org.apache.wink.server.internal.contexts.UriInfoImpl

    private void initContexts() {
        setAttribute(Providers.class, new ProvidersImpl(getDeploymentConfiguration()
            .getProvidersRegistry(), this));
        setAttribute(HttpHeaders.class, new HttpHeadersImpl(this));
        setAttribute(UriInfo.class, new UriInfoImpl(this));
        setAttribute(SecurityContext.class, new SecurityContextImpl(this));
        setAttribute(Request.class, new RequestImpl(this));
        setAttribute(LinkBuilders.class, new LinkBuildersImpl(this));
    }
View Full Code Here

Examples of org.apache.wink.server.internal.contexts.UriInfoImpl

    private void initContexts() {
        setAttribute(Providers.class, new ProvidersImpl(getDeploymentConfiguration()
            .getProvidersRegistry(), this));
        setAttribute(HttpHeaders.class, new HttpHeadersImpl(this));
        UriInfoImpl uriInfoImpl = new UriInfoImpl(this);
        setAttribute(UriInfo.class, uriInfoImpl);
        setAttribute(UriInfoImpl.class, uriInfoImpl);
        setAttribute(SecurityContext.class, new SecurityContextImpl(this));
        setAttribute(Request.class, new RequestImpl(this));
        setAttribute(LinkBuilders.class, new LinkBuildersImpl(this));
View Full Code Here

Examples of org.apache.wink.server.internal.contexts.UriInfoImpl

        matcher.storeVariablesPathSegments(segments, offset, headSegmentsCount, result.getData()
            .getMatchedVariablesPathSegments());

        // for sub resources with annotated method parameters, we need to reload
        // path parameters so that they are injected when invoked
        UriInfoImpl uriInfoImpl = context.getAttribute(UriInfoImpl.class);
        if (uriInfoImpl != null && matcher.getVariables().size() > 0)
            uriInfoImpl.resetPathParameters();
    }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

      return pathExpression;
   }

   protected void populatePathParams(HttpRequest request, Matcher matcher, String path)
   {
      UriInfoImpl uriInfo = (UriInfoImpl) request.getUri();
      for (Group group : groups)
      {
         String value = matcher.group(group.group);
         uriInfo.addEncodedPathParameter(group.name, value);
         int index = matcher.start(group.group);

         int start = 0;
         if (path.charAt(0) == '/') start++;
         int segmentIndex = 0;

         if (start < path.length())
         {
            int count = 0;
            for (int i = start; i < index && i < path.length(); i++)
            {
               if (path.charAt(i) == '/') count++;
            }
            segmentIndex = count;
         }

         int numSegments = 1;
         for (int i = 0; i < value.length(); i++)
         {
            if (value.charAt(i) == '/') numSegments++;
         }

         if (segmentIndex + numSegments > request.getUri().getPathSegments().size())
         {

            throw new BadRequestException("Number of matched segments greater than actual");
         }
         PathSegment[] encodedSegments = new PathSegment[numSegments];
         PathSegment[] decodedSegments = new PathSegment[numSegments];
         for (int i = 0; i < numSegments; i++)
         {
            encodedSegments[i] = request.getUri().getPathSegments().get(segmentIndex + i);
            decodedSegments[i] = request.getUri().getPathSegments(false).get(segmentIndex + i);
         }
         uriInfo.getEncodedPathParameterPathSegments().add(group.name, encodedSegments);
         uriInfo.getPathParameterPathSegments().add(group.name, decodedSegments);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

   public ResourceInvoker matchPattern(HttpRequest
                                               request, String
           path, int start)
   {
      UriInfoImpl uriInfo = (UriInfoImpl) request.getUri();
      Matcher matcher = pattern.matcher(path);
      matcher.region(start, path.length());

      if (matcher.matches())
      {
         // we consumed entire path string
         ResourceInvoker invoker = match(request.getHttpMethod(), request);
         if (invoker == null)
            throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());
         uriInfo.pushMatchedURI(path, Encode.decode(path));
         populatePathParams(request, matcher, path);
         return invoker;
      }
      if (locator == null)
      {
         throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());
      }
      if (matcher.find(start) && matcher.start() == start)
      {
         // a non-matched locator path must have a '/' immediately after.  A locator cannot match a partial segment
         String group0 = matcher.group(0);
         int charAt = start + group0.length();

         char c = path.charAt(charAt);
         if (c == '/')
         {
            String matched = path.substring(0, start + matcher.group(0).length());
            uriInfo.pushMatchedURI(matched, Encode.decode(matched));
            populatePathParams(request, matcher, path);
            return locator;
         }
      }
      throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

      return segment;
   }

   public ResourceInvoker matchSimple(HttpRequest request, String path, int start)
   {
      UriInfoImpl uriInfo = (UriInfoImpl) request.getUri();
      if (start + segment.length() == path.length()) // we've reached end of string
      {
         ResourceInvoker invoker = match(request.getHttpMethod(), request);
         if (invoker == null)
            throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());

         uriInfo.pushMatchedURI(path, Encode.decode(path));
         return invoker;
      }
      else
      {
         try
         {
            return matchChildren(request, path, start + segment.length() + 1); // + 1 to ignore '/'
         }
         catch (Failure e)
         {
            if (locator != null)
            {
               String matched = path.substring(0, start + segment.length());
               uriInfo.pushMatchedURI(matched, Encode.decode(matched));
               return locator;
            }
            else throw e;
         }
      }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

      request.httpHeaders.setAcceptableMediaTypes(new ArrayList<MediaType>());
      request.httpHeaders.setCookies(new HashMap<String, Cookie>());
      request.httpHeaders.setRequestHeaders(new Headers<String>());
      //request.uri = new UriInfoImpl(absoluteUri, absoluteUri, absoluteUri.getPath(), absoluteUri.getQuery(), PathSegmentImpl.parseSegments(absoluteUri.getPath()));
      List<PathSegment> encodedPathSegments = PathSegmentImpl.parseSegments(absoluteUri.getRawPath(), false);
      request.uri = new UriInfoImpl(absoluteUri, baseUri, absoluteUri.getRawPath(), absoluteUri.getRawQuery(), encodedPathSegments);
      request.preprocessedPath = request.uri.getPath(false);
      return request;
   }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

         if (!tmpContextPath.endsWith("/")) tmpContextPath += "/";
         baseURI = UriBuilder.fromUri(absolutePath).replacePath(tmpContextPath).build();
      }
      //System.out.println("path: " + path);
      //System.out.println("query string: " + request.getQueryString());
      UriInfoImpl uriInfo = new UriInfoImpl(absolutePath, baseURI, path, request.getQueryString(), pathSegments);
      return uriInfo;
   }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.push(providerFactory);
         }
         HttpHeaders headers = null;
         UriInfoImpl uriInfo = null;
         try
         {
            headers = ServletUtil.extractHttpHeaders(request);
            uriInfo = ServletUtil.extractUriInfo(request, servletMappingPrefix);
         }
View Full Code Here

Examples of org.jboss.resteasy.specimpl.UriInfoImpl

   }

   protected Object createResource(HttpRequest request, HttpResponse response, Object locator)
   {
      UriInfoImpl uriInfo = (UriInfoImpl) request.getUri();
      Object[] args = methodInjector.injectArguments(request, response);
      try
      {
         uriInfo.pushCurrentResource(locator);
         Object subResource = method.invoke(locator, args);
         warnIfJaxRSAnnotatedFields(subResource);

         return subResource;
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.