Examples of UriInfo


Examples of javax.ws.rs.core.UriInfo

            SamlpRequestComponentBuilder.createRequestedAuthnCtxPolicy(
                AuthnContextComparisonTypeEnumeration.EXACT,
                Collections.singletonList(authnCtxClassRef), null
            );
       
        UriInfo ui = new UriInfoImpl(m);
        //CHECKSTYLE:OFF
        return SamlpRequestComponentBuilder.createAuthnRequest(
                ui.getRequestUri().toString(),
                false,
                false,
                "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
                SAMLVersion.VERSION_20,
                issuer,
View Full Code Here

Examples of javax.ws.rs.core.UriInfo

        if (!"GET".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
            return null;
        }

        UriInfo ui = new UriInfoImpl(m);
        if (!ui.getQueryParameters().containsKey(WADL_QUERY)) {
            if (!schemaLocationMap.isEmpty()) {
                String path = ui.getPath(false);
                if (path.startsWith("/") && path.length() > 0) {
                    path = path.substring(1);
                }
                if (schemaLocationMap.containsKey(path)) {
                    return getExistingSchema(m, ui, path);
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.UriInfo

  // ---------------------------- Common Code Start ---------------- TODO - common in ODataJPAProcessorDefaultTest as
  // well

  private DeleteUriInfo getDeletetUriInfo() {
    UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
    EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
    EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
    EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
    EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
    EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
    EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
    EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
    EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
    EasyMock.replay(objUriInfo);
    return objUriInfo;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.UriInfo

    return getLocalUriInfo();
  }

  private GetEntitySetUriInfo getEntitySetUriInfo() {

    UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
    EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
    EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
    EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
    EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
    EasyMock.expect(objUriInfo.getSkipToken()).andReturn("5");
    EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
    EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
    EasyMock.expect(objUriInfo.getFunctionImport()).andStubReturn(null);
    EasyMock.expect(objUriInfo.getCustomQueryOptions()).andStubReturn(null);
    EasyMock.replay(objUriInfo);
    return objUriInfo;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.UriInfo

  /**
   * @return
   */
  private UriInfo getLocalUriInfo() {
    UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
    EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
    EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
    EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
    EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
    EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
    EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
    EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
    EasyMock.replay(objUriInfo);
    return objUriInfo;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.UriInfo

  @Test
  public void uri() throws Exception {
    final ODataContext context = mockContext(ODataHttpMethod.GET);
    final ODataResponse wrappedResponse = mockResponse(HttpStatusCodes.OK, null, null);

    UriInfo uriInfo = mock(UriInfo.class);
    final FilterExpression filter = UriParser.parseFilter(null, null, "true");
    when(uriInfo.getFilter()).thenReturn(filter);
    final OrderByExpression orderBy = UriParser.parseOrderBy(null, null, "true");
    when(uriInfo.getOrderBy()).thenReturn(orderBy);
    List<ArrayList<NavigationPropertySegment>> expand = new ArrayList<ArrayList<NavigationPropertySegment>>();
    NavigationPropertySegment segment = mock(NavigationPropertySegment.class);
    EdmNavigationProperty navigationProperty = mock(EdmNavigationProperty.class);
    when(navigationProperty.getName()).thenReturn("nav");
    when(segment.getNavigationProperty()).thenReturn(navigationProperty);
    ArrayList<NavigationPropertySegment> segments = new ArrayList<NavigationPropertySegment>();
    segments.add(segment);
    expand.add(segments);
    when(uriInfo.getExpand()).thenReturn(expand);
    SelectItem select1 = mock(SelectItem.class);
    SelectItem select2 = mock(SelectItem.class);
    EdmProperty property = mock(EdmProperty.class);
    when(property.getName()).thenReturn("property");
    when(select1.getProperty()).thenReturn(property);
    when(select2.getProperty()).thenReturn(property);
    when(select2.getNavigationPropertySegments()).thenReturn(segments);
    when(uriInfo.getSelect()).thenReturn(Arrays.asList(select1, select2));

    ODataResponse response = new ODataDebugResponseWrapper(context, wrappedResponse, uriInfo, null,
        ODataDebugResponseWrapper.ODATA_DEBUG_JSON).wrapResponse();
    String entity = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertEquals(EXPECTED.replace("null}}", "null,"
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.spi.UriInfo

    return pathExpression;
  }

  protected void populatePathParams(HttpRequest request, Matcher matcher, String path)
  {
    UriInfo uriInfo = (UriInfo) 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", "Can not invoke requested service");
      }
      PathSegment[] encodedSegments = new PathSegment[numSegments];
      PathSegment[] decodedSegments = new PathSegment[numSegments];
      for (int i = 0; i < numSegments; i++)
      {
        decodedSegments[i] = request.getUri().getPathSegments().get(segmentIndex + i);
        encodedSegments[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.cruxframework.crux.core.server.rest.spi.UriInfo

    }
  }

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

    if (matcher.matches())
    {
      // we consumed entire path string
      ResourceMethod 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;
    }
    throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());
  }
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.spi.UriInfo

      return segment;
   }

   public ResourceMethod matchSimple(HttpRequest request, String path, int start)
   {
      UriInfo uriInfo = request.getUri();
      if (start + segment.length() == path.length()) // we've reached end of string
      {
        ResourceMethod 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
      {
           return matchChildren(request, path, start + segment.length() + 1); // + 1 to ignore '/'
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.spi.UriInfo

    if (!RestServiceFactoryInitializer.isFactoryInitialized())
    {
      RestServiceFactoryInitializer.initialize(getServletContext());
    }
    HttpHeaders headers = null;
    UriInfo uriInfo = null;
    try
    {
      headers = HttpUtil.extractHttpHeaders(req);
      uriInfo = HttpUtil.extractUriInfo(req);
    }
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.