Package javax.ws.rs.core

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


        final UriBuilder absoluteUriBuilder = UriBuilder.fromUri(
                request.getRequestURL().toString());

        final URI baseUri = (filterContextPath == null)
                ? absoluteUriBuilder.replacePath(request.getContextPath()).
                path("/").
                build()
                : absoluteUriBuilder.replacePath(request.getContextPath()).
                path(filterContextPath).
                path("/").
View Full Code Here


        final URI baseUri = (filterContextPath == null)
                ? absoluteUriBuilder.replacePath(request.getContextPath()).
                path("/").
                build()
                : absoluteUriBuilder.replacePath(request.getContextPath()).
                path(filterContextPath).
                path("/").
                build();

        final URI requestUri = absoluteUriBuilder.replacePath(requestURI).
View Full Code Here

                : absoluteUriBuilder.replacePath(request.getContextPath()).
                path(filterContextPath).
                path("/").
                build();

        final URI requestUri = absoluteUriBuilder.replacePath(requestURI).
                replaceQuery(ContainerUtils.encodeUnsafeCharacters(queryString)).
                build();

        final int status = service(baseUri, requestUri, request, response).get();
View Full Code Here

        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");
        assertEquals("/r1/r2", uri.toString());

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

        builder.replacePath("/r1/{v1}");
        uri = builder.build("r2");
        assertEquals("/r1/r2", uri.toString());

        builder.replacePath("r1/{v1}");
        uri = builder.build("r2");
        assertEquals("r1/r2", uri.toString());
    }

    public void testMatrix() {
View Full Code Here

        } else {
            builder = UriBuilder.fromUri(baseUri);
            // special treatment if the path resulting from the base uri equals
            // "/"
            if (baseUri.getPath() != null && baseUri.getPath().equals("/")) { //$NON-NLS-1$
                builder.replacePath(path);
            } else {
                builder.path(path);
            }
        }
        return builder;
View Full Code Here

    //this check is in the super class, so I thought I'd keep it here for grins.
    if (!baseUriPath.equals(UriComponent.encode(baseUriPath, UriComponent.Type.PATH))) {
        throw new ContainerException("The servlet context path and/or the servlet path contain characters that are percent enocded");
    }

    final URI baseUri = requestUrl.replacePath(baseUriPath).build();

    String queryParameters = request.getQueryString();
    if (queryParameters == null) {
      queryParameters = "";
    }
View Full Code Here

   private static URI getRequestUri(HttpServletRequest servletRequest)
   {
      // servletRequest.getQueryString() return part of URI after '?', so it
      // return fragment component also
      UriBuilder baseBuilder = UriBuilder.fromUri(getBaseUri(servletRequest));
      return baseBuilder.replacePath(servletRequest.getRequestURI()).replaceQuery(servletRequest.getQueryString())
         .build();
   }

   /**
    * Constructs base request URI from {@link HttpServletRequest} .
View Full Code Here

    public AsyncViewResource uri(URI uri) {
        UriBuilder b = getUriBuilder();
        String path = uri.getRawPath();
        if (path != null && path.length() > 0) {
            if (path.startsWith("/")) {
                b.replacePath(path);
            } else {
                b.path(path);
            }
        }
        String query = uri.getRawQuery();
View Full Code Here

    public WebResource uri(URI uri) {
        UriBuilder b = getUriBuilder();
        String path = uri.getRawPath();
        if (path != null && path.length() > 0) {
            if (path.startsWith("/")) {
                b.replacePath(path);
            } else {
                b.path(path);
            }
        }
        String query = uri.getRawQuery();
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.