Package javax.ws.rs.core

Examples of javax.ws.rs.core.UriBuilder.segment()


        builder.segment("seg1/{var1}");
        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1", uri.toString());

        builder.segment("seg2/{var1}");
        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1", uri.toString());
        uri = builder.build("segment2");
        assertEquals("path1/seg1%2Fsegment2/seg2%2Fsegment2", uri.toString());
View Full Code Here


        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1", uri.toString());
        uri = builder.build("segment2");
        assertEquals("path1/seg1%2Fsegment2/seg2%2Fsegment2", uri.toString());

        builder.segment("{var2}").segment("{var1}");
        uri = builder.build("segment1", "segment2");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());

        uri = builder.build("segment1", "segment2", "segment3");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());
View Full Code Here

        uri = builder.build("segment1", "segment2", "segment3");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());

        // vars with special character
        builder = new UriBuilderImpl();
        builder.segment("path1").segment("{var1}");
        uri = builder.build("/s1,s2");
        assertEquals("path1//s1,s2", uri.toString());

        builder.replacePath("/r1/{v1}");
        uri = builder.build("r2");
View Full Code Here

        assertEquals("r1/r2", uri.toString());
    }

    public void testMatrix() {
        UriBuilder builder = new UriBuilderImpl();
        builder.segment("path1");

        builder.matrixParam("mat1", "val1");
        String uriString = builder.build().toString();
        assertEquals("path1;mat1=val1", uriString);
View Full Code Here

    }

    public void testClone() {
        UriBuilder builder1 = new UriBuilderImpl();
        builder1.scheme("http").host("localhost").port(80);
        builder1.segment("path1", "path2");
        builder1.matrixParam("mat1", "{var1}", "v2");
        builder1.queryParam("q1", "abc");
        builder1.fragment("fragment");
        UriBuilder builder2 = builder1.clone();
        String uri1 = builder1.build("v1").toString();
View Full Code Here

            List<PathSegment> sourcePathSegments = sourceUriInfo.getPathSegments();
            List<PathSegment> forwardPathSegmentsHead =  sourcePathSegments.subList(0, TARGET_INSTANCE_NAME_PATH_INDEX - 1); //path that precedes proxy/<instancenName>
            List<PathSegment> forwardPathSegmentsTail =  sourcePathSegments.subList(TARGET_INSTANCE_NAME_PATH_INDEX + 1, sourcePathSegments.size()); //path that follows <instanceName>  
            UriBuilder forwardUriBuilder = sourceUriInfo.getBaseUriBuilder(); // Gives /management/domain
            for (PathSegment pathSegment : forwardPathSegmentsHead) { //append domain
                forwardUriBuilder.segment(pathSegment.getPath());
            }

            for (PathSegment pathSegment : forwardPathSegmentsTail) { //append forwardSegment1/forwardSegment2/....
                forwardUriBuilder.segment(pathSegment.getPath());
            }
View Full Code Here

            for (PathSegment pathSegment : forwardPathSegmentsHead) { //append domain
                forwardUriBuilder.segment(pathSegment.getPath());
            }

            for (PathSegment pathSegment : forwardPathSegmentsTail) { //append forwardSegment1/forwardSegment2/....
                forwardUriBuilder.segment(pathSegment.getPath());
            }
            return forwardUriBuilder;
        }

        @Override
View Full Code Here

    ArgumentChecker.notNull(dataField, "dataField");
    try {
      final FudgeDeserializer fdc = new FudgeDeserializer(getFudgeContext());
      final UriBuilder uri = UriBuilder.fromUri(getBaseUri()).path("resolve");
      for (ExternalId id : identifierBundle) {
        uri.segment("id", id.toString());
      }
      if (identifierValidityDate != null) {
        uri.segment("identifierValidityDate", identifierValidityDate.toString());
      }
      if (dataSource != null) {
View Full Code Here

      final UriBuilder uri = UriBuilder.fromUri(getBaseUri()).path("resolve");
      for (ExternalId id : identifierBundle) {
        uri.segment("id", id.toString());
      }
      if (identifierValidityDate != null) {
        uri.segment("identifierValidityDate", identifierValidityDate.toString());
      }
      if (dataSource != null) {
        uri.segment("dataSource", dataSource);
      }
      if (dataProvider != null) {
View Full Code Here

      }
      if (identifierValidityDate != null) {
        uri.segment("identifierValidityDate", identifierValidityDate.toString());
      }
      if (dataSource != null) {
        uri.segment("dataSource", dataSource);
      }
      if (dataProvider != null) {
        uri.segment("dataProvider", dataProvider);
      }
      if (dataField != null) {
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.