本文整理了Java中org.jboss.resteasy.spi.HttpRequest.getUri()
方法的一些代码示例,展示了HttpRequest.getUri()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getUri()
方法的具体详情如下:
包路径:org.jboss.resteasy.spi.HttpRequest
类名称:HttpRequest
方法名:getUri
[英]This method MUST always return the same instance.
[中]此方法必须始终返回相同的实例。
代码示例来源:origin: resteasy/Resteasy
@Override
public UriInfo getUri()
{
return delegate.getUri();
}
代码示例来源:origin: resteasy/Resteasy
@Override
public UriInfo getUriInfo()
{
return httpRequest.getUri();
}
代码示例来源:origin: resteasy/Resteasy
public boolean isAsynchrnousRequest(HttpRequest in)
{
MultivaluedMap<String, String> queryParameters = in.getUri().getQueryParameters();
return queryParameters.get("asynch") != null || queryParameters.get("oneway") != null;
}
代码示例来源:origin: resteasy/Resteasy
@Override
public CompletionStage<Object> inject(HttpRequest request, HttpResponse response, boolean unwrapAsync)
{
if (encode)
{
List<String> list = request.getUri().getQueryParameters(false).get(encodedName);
return CompletableFuture.completedFuture(extractValues(list));
}
else
{
List<String> list = request.getUri().getQueryParameters().get(paramName);
return CompletableFuture.completedFuture(extractValues(list));
}
}
代码示例来源:origin: resteasy/Resteasy
public ResourceInvoker getResourceInvoker(HttpRequest request)
{
try
{
String currentUri = ((ResteasyUriInfo)request.getUri()).getEncodedMatchedPaths().get(0);
int startAt = currentUri.length();
return root.match(request, startAt);
}
catch (RuntimeException e)
{
throw e;
}
}
}
代码示例来源:origin: resteasy/Resteasy
public void invoke(HttpRequest in, HttpResponse response, ResourceInvoker invoker)
{
MultivaluedMap<String, String> queryParameters = in.getUri().getQueryParameters();
if (queryParameters.get("asynch") != null)
{
postJob(in, response, invoker);
}
else if (queryParameters.get("oneway") != null)
{
oneway(in, response, invoker);
}
else
{
super.invoke(in, response, invoker);
}
}
代码示例来源:origin: resteasy/Resteasy
private String requestToString(HttpRequest request) {
return "\"" + request.getHttpMethod() + " " + request.getUri().getPath() + "\"";
}
代码示例来源:origin: resteasy/Resteasy
@Override
public CompletionStage<Object> inject(HttpRequest request, HttpResponse response, boolean unwrapAsync)
{
ArrayList<String> values = new ArrayList<String>();
if (encode)
{
for (PathSegment segment : request.getUri().getPathSegments(false))
{
List<String> list = segment.getMatrixParameters().get(paramName);
if (list != null) values.addAll(list);
}
}
else
{
for (PathSegment segment : request.getUri().getPathSegments())
{
List<String> list = segment.getMatrixParameters().get(paramName);
if (list != null) values.addAll(list);
}
}
if (values.size() == 0) return CompletableFuture.completedFuture(extractValues(null));
else return CompletableFuture.completedFuture(extractValues(values));
}
代码示例来源:origin: resteasy/Resteasy
public void populatePathParams(HttpRequest request, Matcher matcher, String path)
ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
for (Group group : groups)
if (segmentIndex + numSegments > request.getUri().getPathSegments().size())
for (int i = 0; i < numSegments; i++)
decodedSegments[i] = request.getUri().getPathSegments().get(segmentIndex + i);
encodedSegments[i] = request.getUri().getPathSegments(false).get(segmentIndex + i);
代码示例来源:origin: resteasy/Resteasy
@Override
public Response.ResponseBuilder location(URI location)
{
if (location == null)
{
metadata.remove(HttpHeaderNames.LOCATION);
return this;
}
if (!location.isAbsolute() && ResteasyContext.getContextData(HttpRequest.class) != null)
{
String path = location.toString();
if (path.startsWith("/")) path = path.substring(1);
URI baseUri = ResteasyContext.getContextData(HttpRequest.class).getUri().getBaseUri();
location = baseUri.resolve(path);
}
metadata.putSingle(HttpHeaderNames.LOCATION, location);
return this;
}
代码示例来源:origin: resteasy/Resteasy
@Override
public Response.ResponseBuilder contentLocation(URI location)
{
if (location == null)
{
metadata.remove(HttpHeaderNames.CONTENT_LOCATION);
return this;
}
if (!location.isAbsolute() && ResteasyContext.getContextData(HttpRequest.class) != null)
{
String path = location.toString();
if (path.startsWith("/")) path = path.substring(1);
URI baseUri = ResteasyContext.getContextData(HttpRequest.class).getUri().getBaseUri();
location = baseUri.resolve(path);
}
metadata.putSingle(HttpHeaderNames.CONTENT_LOCATION, location);
return this;
}
代码示例来源:origin: resteasy/Resteasy
public void pushContextObjects(final HttpRequest request, final HttpResponse response)
{
Map contextDataMap = ResteasyContext.getContextDataMap();
contextDataMap.put(HttpRequest.class, request);
contextDataMap.put(HttpResponse.class, response);
contextDataMap.put(HttpHeaders.class, request.getHttpHeaders());
contextDataMap.put(UriInfo.class, request.getUri());
contextDataMap.put(Request.class, new RequestImpl(request, response));
contextDataMap.put(ResteasyAsynchronousContext.class, request.getAsyncContext());
ResourceContext resourceContext = new ResourceContext()
{
@Override
public <T> T getResource(Class<T> resourceClass)
{
return providerFactory.injectedInstance(resourceClass, request, response);
}
@Override
public <T> T initResource(T resource)
{
providerFactory.injectProperties(resource, request, response);
return resource;
}
};
contextDataMap.put(ResourceContext.class, resourceContext);
contextDataMap.putAll(defaultContextObjects);
contextDataMap.put(Cleanables.class, new Cleanables());
contextDataMap.put(PostResourceMethodInvokers.class, new PostResourceMethodInvokers());
}
代码示例来源:origin: resteasy/Resteasy
public static MockHttpRequest deepCopy(HttpRequest request) throws IOException
{
MockHttpRequest mock = new MockHttpRequest();
mock.uri = (ResteasyUriInfo) request.getUri();
mock.httpHeaders = (ResteasyHttpHeaders) request.getHttpHeaders();
mock.httpMethod = request.getHttpMethod();
byte[] bytes = ReadFromStream.readFromStream(1024, request.getInputStream());
mock.inputStream = new ByteArrayInputStream(bytes);
return mock;
}
代码示例来源:origin: resteasy/Resteasy
jobs.put(id, future);
response.setStatus(HttpResponseCodes.SC_ACCEPTED);
URI uri = request.getUri().getBaseUriBuilder().path(basePath).path(id).build();
response.getOutputHeaders().add(HttpHeaderNames.LOCATION, uri);
代码示例来源:origin: resteasy/Resteasy
protected Response handleFailure(HttpRequest request, Failure failure) {
if (failure.isLoggable())
LogMessages.LOGGER.failedExecutingError(request.getHttpMethod(), request.getUri().getPath(), failure);
else
LogMessages.LOGGER.failedExecutingDebug(request.getHttpMethod(), request.getUri().getPath(), failure);
Response response = failure.getResponse();
if (response != null) {
return response;
} else {
Response.ResponseBuilder builder = Response.status(failure.getErrorCode());
if (failure.getMessage() != null)
builder.type(MediaType.TEXT_HTML).entity(failure.getMessage());
Response resp = builder.build();
return resp;
}
}
代码示例来源:origin: resteasy/Resteasy
public RootNode match(HttpRequest request, int start)
String path = ((ResteasyUriInfo) request.getUri()).getMatchingPath();
if (start < path.length() && path.charAt(start) == '/') start++;
List<ClassExpression> potentials = new ArrayList<ClassExpression>();
ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
int length = matcher.start(expression.getNumGroups() + 1);
if (length == -1)
throw new NotFoundException(Messages.MESSAGES.couldNotFindResourceForFullPath(request.getUri().getRequestUri()));
代码示例来源:origin: resteasy/Resteasy
public CompletionStage<BuiltResponse> invoke(HttpRequest request, HttpResponse response, Object target)
{
request.setAttribute(ResourceMethodInvoker.class.getName(), this);
incrementMethodCount(request.getHttpMethod());
ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
if (method.getPath() != null)
{
uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
}
uriInfo.pushCurrentResource(target);
BuiltResponse rtn = invokeOnTarget(request, response, target);
// FIXME: async
return CompletableFuture.completedFuture(rtn);
}
代码示例来源:origin: resteasy/Resteasy
public ResourceInvoker getInvoker(HttpRequest request)
throws Failure
{
LogMessages.LOGGER.pathInfo(request.getUri().getPath());
if (!request.isInitial())
{
throw new InternalServerErrorException(Messages.MESSAGES.isNotInitialRequest(request.getUri().getPath()));
}
ResourceInvoker invoker = registry.getResourceInvoker(request);
if (invoker == null)
{
throw new NotFoundException(Messages.MESSAGES.unableToFindJaxRsResource(request.getUri().getPath()));
}
RESTEasyTracingLogger logger = RESTEasyTracingLogger.getInstance(request);
logger.log("MATCH_RESOURCE", invoker);
logger.log("MATCH_RESOURCE_METHOD", invoker.getMethod());
return invoker;
}
代码示例来源:origin: resteasy/Resteasy
public CompletionStage<Object> invokeDryRun(HttpRequest request, HttpResponse response, Object target)
{
request.setAttribute(ResourceMethodInvoker.class.getName(), this);
incrementMethodCount(request.getHttpMethod());
ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
if (method.getPath() != null)
{
uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
}
uriInfo.pushCurrentResource(target);
return invokeOnTargetDryRun(request, response, target);
}
代码示例来源:origin: resteasy/Resteasy
NotFoundException notFound = new NotFoundException(Messages.MESSAGES.nullSubresource(request.getUri().getAbsolutePath()));
throw notFound;
内容来源于网络,如有侵权,请联系作者删除!