Package org.springframework.web.util

Examples of org.springframework.web.util.UriComponents$PathSegmentComponent


      } else {
        builder.queryParam(key, parameter.asString());
      }
    }

    UriComponents components = applyUriComponentsContributer(builder, invocation).buildAndExpand(values);
    return new ControllerLinkBuilder(UriComponentsBuilder.fromUriString(components.toUriString()));
  }
View Full Code Here


   */
  public static JaxRsLinkBuilder linkTo(Class<?> service, Object... parameters) {

    JaxRsLinkBuilder builder = new JaxRsLinkBuilder(ServletUriComponentsBuilder.fromCurrentServletMapping());

    UriComponents uriComponents = UriComponentsBuilder.fromUriString(DISCOVERER.getMapping(service)).build();
    UriComponents expandedComponents = uriComponents.expand(parameters);
    return builder.slash(expandedComponents);
  }
View Full Code Here

  @Override
  public ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler,
      String uriTemplate, Object... uriVars) {

    UriComponents uriComponents = UriComponentsBuilder.fromUriString(uriTemplate).buildAndExpand(uriVars).encode();
    return doHandshake(webSocketHandler, null, uriComponents.toUri());
  }
View Full Code Here

    String typePath = getTypeRequestMapping(method.getDeclaringClass());
    String methodPath = getMethodRequestMapping(method);
    String path = pathMatcher.combine(typePath, methodPath);

    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping().path(path);
    UriComponents uriComponents = applyContributors(builder, method, argumentValues);
    return ServletUriComponentsBuilder.newInstance().uriComponents(uriComponents);
  }
View Full Code Here

    String targetUrl = createTargetUrl(model, request);
    targetUrl = updateTargetUrl(targetUrl, model, request, response);

    FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
    if (!CollectionUtils.isEmpty(flashMap)) {
      UriComponents uriComponents = UriComponentsBuilder.fromUriString(targetUrl).build();
      flashMap.setTargetRequestPath(uriComponents.getPath());
      flashMap.addTargetRequestParams(uriComponents.getQueryParams());
      FlashMapManager flashMapManager = RequestContextUtils.getFlashMapManager(request);
      if (flashMapManager == null) {
        throw new IllegalStateException("FlashMapManager not found despite output FlashMap having been set");
      }
      flashMapManager.saveOutputFlashMap(flashMap, request, response);
View Full Code Here

  }


  @Test
  public void testFromController() {
    UriComponents uriComponents = fromController(PersonControllerImpl.class).build();
    assertThat(uriComponents.toUriString(), Matchers.endsWith("/people"));
  }
View Full Code Here

    assertThat(uriComponents.toUriString(), Matchers.endsWith("/people"));
  }

  @Test
  public void testFromControllerUriTemplate() {
    UriComponents uriComponents = fromController(PersonsAddressesController.class).buildAndExpand(15);
    assertThat(uriComponents.toUriString(), endsWith("/people/15/addresses"));
  }
View Full Code Here

    assertThat(uriComponents.toUriString(), endsWith("/people/15/addresses"));
  }

  @Test
  public void testFromControllerSubResource() {
    UriComponents uriComponents = fromController(PersonControllerImpl.class).pathSegment("something").build();

    assertThat(uriComponents.toUriString(), endsWith("/people/something"));
  }
View Full Code Here

    assertThat(uriComponents.toUriString(), endsWith("/people/something"));
  }

  @Test
  public void testFromControllerTwoTypeLevelMappings() {
    UriComponents uriComponents = fromController(InvalidController.class).build();
    assertThat(uriComponents.toUriString(), is("http://localhost/persons"));
  }
View Full Code Here

    assertThat(uriComponents.toUriString(), is("http://localhost/persons"));
  }

  @Test
  public void testFromControllerNotMapped() {
    UriComponents uriComponents = fromController(UnmappedController.class).build();
    assertThat(uriComponents.toUriString(), is("http://localhost/"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.util.UriComponents$PathSegmentComponent

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.