spark.Request.raw()方法的使用及代码示例

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

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

Request.raw介绍

[英]Gets the raw HttpServletRequest object handed in by Jetty
[中]获取Jetty提交的原始HttpServletRequest对象

代码示例

代码示例来源:origin: perwendel/spark

@Override
public HttpServletRequest raw() {
  return delegate.raw();
}

代码示例来源:origin: perwendel/spark

private void initQueryMap() {
  if (queryMap == null) {
    queryMap = new QueryParamsMap(raw());
  }
}

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

protected void setMultipartUpload(Request req, Response res) {
  RequestUtils.configureMultipart(req.raw());
}

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

default Long currentUserId(Request request) {
  return SessionUtils.getUserId(request.raw());
}

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

private void verifyConfirmHeader(Request request, Response response) {
    if (!HEADER_CONSTRAINT.isSatisfied(request.raw())) {
      throw haltBecauseDeprecatedConfirmHeaderMissing();
    }
  }
}

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

protected void verifyContentType(Request request, Response response) throws IOException {
  if (!UPDATE_HTTP_METHODS.contains(request.requestMethod().toUpperCase())) {
    return;
  }
  boolean requestHasBody = request.contentLength() >= 1 || request.raw().getInputStream().available() >= 1 || "chunked".equalsIgnoreCase(request.headers("Transfer-Encoding"));
  if (requestHasBody) {
    if (!isJsonContentType(request)) {
      throw haltBecauseJsonContentTypeExpected();
    }
  } else if (request.headers().stream().noneMatch(headerName -> headerName.toLowerCase().equals("x-gocd-confirm"))) {
    throw haltBecauseConfirmHeaderMissing();
  }
}

代码示例来源:origin: openzipkin/brave

public Filter before() {
 return (request, response) -> {
  Span span = handler.handleReceive(extractor, request, request.raw());
  request.attribute(Tracer.SpanInScope.class.getName(), tracer.withSpanInScope(span));
 };
}

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

public static RequestContext requestContext(Request req) {
  return new RequestContext(req.scheme(), req.raw().getServerName(), req.port(), req.contextPath());
}

代码示例来源:origin: openzipkin/brave

public Filter afterAfter() {
 return (request, response) -> {
  Span span = tracer.currentSpan();
  if (span == null) return;
  ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close();
  handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), null, span);
 };
}

代码示例来源:origin: openzipkin/brave

public ExceptionHandler exception(ExceptionHandler delegate) {
  return (exception, request, response) -> {
   Span span = tracer.currentSpan();
   if (span != null) {
    ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close();
    handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), exception, span);
   }
   delegate.handle(exception, request, response);
  };
 }
}

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

Collection<Part> uploads = req.raw().getParts();
Map<String, String> contents = new LinkedHashMap<>();

代码示例来源:origin: stackoverflow.com

public Object handle(Request request, Response response) {
  MultipartConfigElement multipartConfigElement = new MultipartConfigElement("/tmp");
  request.raw().setAttribute("org.eclipse.multipartConfig", multipartConfigElement);
  ....
  Part file = request.raw().getPart("file"); //file is name of the upload form
}

代码示例来源:origin: cinchapi/concourse

private void initQueryMap() {
  if(queryMap == null) {
    queryMap = new QueryParamsMap(raw());
  }
}

代码示例来源:origin: com.sparkjava/spark-core

private void initQueryMap() {
  if (queryMap == null) {
    queryMap = new QueryParamsMap(raw());
  }
}

代码示例来源:origin: dessalines/torrenttunes-client

public static Boolean writeFileToResponse(String path, Request req, Response res) {
  try {
    
    OutputStream wrappedOutputStream = GzipUtils.checkAndWrap(req.raw(), 
        res.raw());
    IOUtils.copy(new FileInputStream(new File(path)), wrappedOutputStream);
    wrappedOutputStream.flush();
    wrappedOutputStream.close();
    
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return true;
}

代码示例来源:origin: neo4j-contrib/rabbithole

public Object handle(Request request, Response response) {
    final String path = request.raw().getRequestURI();
    final Matcher matcher = PATTERN.matcher(path);
    if (matcher.find()) {
      final String id = matcher.group(1);
      response.redirect("/?id="+id);
    } else {
      response.redirect("/");
    }
    return "";
  }
});

代码示例来源:origin: io.zipkin.brave/brave-instrumentation-sparkjava

public Filter before() {
 return (request, response) -> {
  Span span = handler.handleReceive(extractor, request, request.raw());
  request.attribute(Tracer.SpanInScope.class.getName(), tracer.withSpanInScope(span));
 };
}

代码示例来源:origin: io.zipkin.brave/brave-instrumentation-sparkjava

public Filter afterAfter() {
 return (request, response) -> {
  Span span = tracer.currentSpan();
  if (span == null) return;
  ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close();
  handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), null, span);
 };
}

代码示例来源:origin: io.zipkin.brave/brave-instrumentation-sparkjava

public ExceptionHandler exception(ExceptionHandler delegate) {
  return (exception, request, response) -> {
   Span span = tracer.currentSpan();
   if (span != null) {
    ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close();
    handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), exception, span);
   }
   delegate.handle(exception, request, response);
  };
 }
}

代码示例来源:origin: neo4j-contrib/rabbithole

public String createInitialUri(Request request, GraphInfo info) {
  return baseUri(request.raw(),
      encodeParam("init", info.getInit()) +
          encodeParam("query", info.getQuery()) +
          encodeParam("version", info.getVersion()) +
          encodeParam("message", info.getMessage()) +
          encodeParam("no_root", info.hasRoot() ? null : "true"),
      null);
}

相关文章