javax.ws.rs.core.Response.getLocation()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中javax.ws.rs.core.Response.getLocation方法的一些代码示例,展示了Response.getLocation的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getLocation方法的具体详情如下:
包路径:javax.ws.rs.core.Response
类名称:Response
方法名:getLocation

Response.getLocation介绍

[英]Get the location.
[中]找到位置。

代码示例

代码示例来源:origin: jersey/jersey

@Override
  public void run() {
    try {
      requestScopeListener.resume(foreignScopeInstance, responder.runtime.injectionManager);
      final Response jaxrsResponse =
          (response instanceof Response) ? (Response) response : Response.ok(response).build();
      if (!responder.runtime.disableLocationHeaderRelativeUriResolution) {
        ServerRuntime.ensureAbsolute(jaxrsResponse.getLocation(), jaxrsResponse.getHeaders(),
            responder.processingContext.request(),
            responder.runtime.rfc7231LocationHeaderRelativeUriResolution);
      }
      responder.process(new ContainerResponse(responder.processingContext.request(), jaxrsResponse));
    } catch (final Throwable t) {
      responder.process(t);
    }
  }
});

代码示例来源:origin: jersey/jersey

@Override
  public void run() {
    try {
      requestScopeListener.resume(foreignScopeInstance, responder.runtime.injectionManager);
      final Response jaxrsResponse =
          (response instanceof Response) ? (Response) response : Response.ok(response).build();
      if (!responder.runtime.disableLocationHeaderRelativeUriResolution) {
        ServerRuntime.ensureAbsolute(jaxrsResponse.getLocation(), jaxrsResponse.getHeaders(),
            responder.processingContext.request(),
            responder.runtime.rfc7231LocationHeaderRelativeUriResolution);
      }
      responder.process(new ContainerResponse(responder.processingContext.request(), jaxrsResponse));
    } catch (final Throwable t) {
      responder.process(t);
    }
  }
});

代码示例来源:origin: confluentinc/ksql

@Test
public void shouldRedirectToInfoIfNoUI() throws Exception {
 // Given:
 final RootDocument doc = new RootDocument();
 final UriInfo uriInfo = uriInfo("http://some/proxy");
 // When:
 final Response response = doc.get(uriInfo);
 // Then:
 assertThat(response.getStatus(), is(HttpStatus.TEMPORARY_REDIRECT_307));
 assertThat(response.getLocation().toString(), is("http://some/proxy/info"));
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

@Override
  public void run() {
    try {
      requestScopeListener.resume(foreignScopeInstance, responder.runtime.injectionManager);
      final Response jaxrsResponse =
          (response instanceof Response) ? (Response) response : Response.ok(response).build();
      if (!responder.runtime.disableLocationHeaderRelativeUriResolution) {
        ServerRuntime.ensureAbsolute(jaxrsResponse.getLocation(), jaxrsResponse.getHeaders(),
            responder.processingContext.request(),
            responder.runtime.rfc7231LocationHeaderRelativeUriResolution);
      }
      responder.process(new ContainerResponse(responder.processingContext.request(), jaxrsResponse));
    } catch (final Throwable t) {
      responder.process(t);
    }
  }
});

代码示例来源:origin: confluentinc/kafka-streams-examples

OrderBean returnedBean = client.target(response.getLocation())
  .queryParam("timeout", MIN / 2)
  .request(APPLICATION_JSON_TYPE)

代码示例来源:origin: org.apache.syncope.client/syncope-client-lib

public BatchResponse(final String boundary, final String jwt, final Response response) {
  this.boundary = boundary;
  this.jwt = jwt;
  this.monitor = response.getLocation();
  this.response = response;
}

代码示例来源:origin: net.thucydides.plugins.jira/thucydides-jira-plugin

public Response followRedirectsIn(Response response) {
    while (response.getStatus() == REDIRECT_REQUEST) {
      response = client.target(response.getLocation()).path(path).request().get();
    }
    return response;
  }
}

代码示例来源:origin: org.jboss.resteasy/jaxrs-api

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: javax/javaee-web-api

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: eclipse-ee4j/jersey

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: org.jboss.spec.javax.ws.rs/jboss-jaxrs-api_2.0_spec

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
   * Get the redirection response location.
   *
   * @return redirection response location.
   */
  public URI getLocation() {
    return getResponse().getLocation();
  }
}

代码示例来源:origin: labsai/EDDI

private List<URI> createNewHttpCalls(List<HttpCallsConfiguration> httpCallsConfigurations)
    throws RestInterfaceFactory.RestInterfaceFactoryException {
  IRestHttpCallsStore restHttpCallsStore = getRestResourceStore(IRestHttpCallsStore.class);
  return httpCallsConfigurations.stream().map(httpCallsConfiguration -> {
    Response httpCallsResponse = restHttpCallsStore.createHttpCalls(httpCallsConfiguration);
    return httpCallsResponse.getLocation();
  }).collect(Collectors.toList());
}

代码示例来源:origin: labsai/EDDI

private List<URI> createNewDictionaries(List<RegularDictionaryConfiguration> dictionaryConfigurations)
    throws RestInterfaceFactory.RestInterfaceFactoryException {
  IRestRegularDictionaryStore restDictionaryStore = getRestResourceStore(IRestRegularDictionaryStore.class);
  return dictionaryConfigurations.stream().map(regularDictionaryConfiguration -> {
    Response dictionaryResponse = restDictionaryStore.createRegularDictionary(regularDictionaryConfiguration);
    return dictionaryResponse.getLocation();
  }).collect(Collectors.toList());
}

代码示例来源:origin: labsai/EDDI

private List<URI> createNewBehaviors(List<BehaviorConfiguration> behaviorConfigurations)
    throws RestInterfaceFactory.RestInterfaceFactoryException {
  IRestBehaviorStore restBehaviorStore = getRestResourceStore(IRestBehaviorStore.class);
  return behaviorConfigurations.stream().map(behaviorConfiguration -> {
    Response behaviorResponse = restBehaviorStore.createBehaviorRuleSet(behaviorConfiguration);
    return behaviorResponse.getLocation();
  }).collect(Collectors.toList());
}

代码示例来源:origin: hibernate/hibernate-ogm

public HttpNeo4jTransaction beginTx() {
  Response response = neo4jFacade.beginTransaction();
  try {
    Long txId = transactionId( response.getLocation() );
    HttpNeo4jTransaction transaction = new HttpNeo4jTransaction( this, txId );
    return transaction;
  }
  finally {
    response.close();
  }
}

代码示例来源:origin: trellis-ldp/trellis

@Test
public void testBinaryEntity() throws IOException {
  when(mockTrellisRequest.getContentType()).thenReturn("text/plain");
  final PostHandler handler = buildPostHandler("/simpleData.txt", "new-resource", null);
  final Response res = handler.createResource(handler.initialize(mockParent, MISSING_RESOURCE))
    .toCompletableFuture().join().build();
  assertEquals(CREATED, res.getStatusInfo(), "Incorrect response code!");
  assertEquals(create(baseUrl + "new-resource"), res.getLocation(), "Incorrect Location header!");
  assertAll("Check LDP type Link headers", checkLdpType(res, LDP.NonRDFSource));
  assertAll("Check Binary response", checkBinaryEntityResponse());
}

相关文章