Java Code Examples for org.sonatype.nexus.repository.view.Request#Builder

The following examples show how to use org.sonatype.nexus.repository.view.Request#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewServlet.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Build view request from {@link HttpServletRequest}.
 */
private Request buildRequest(final HttpServletRequest httpRequest, final String path) {
  Request.Builder builder = new Request.Builder()
      .headers(new HttpHeadersAdapter(httpRequest))
      .action(httpRequest.getMethod())
      .path(path)
      .parameters(new HttpParametersAdapter(httpRequest))
      .payload(new HttpRequestPayloadAdapter(httpRequest));

  if (HttpPartIteratorAdapter.isMultipart(httpRequest)) {
    builder.multiparts(new HttpPartIteratorAdapter(httpRequest));
  }

  // copy http-servlet-request attributes
  Enumeration<String> attributes = httpRequest.getAttributeNames();
  while (attributes.hasMoreElements()) {
    String name = attributes.nextElement();
    builder.attribute(name, httpRequest.getAttribute(name));
  }

  return builder.build();
}
 
Example 2
Source File: PartialFetchHandlerTest.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
private static Request.Builder createGetRequestBuilder() {
  return createRequestBuilderForAction(GET);
}
 
Example 3
Source File: PartialFetchHandlerTest.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
private static Request.Builder createRequestBuilderForAction(final String action) {
  return new Builder().path("/foo").action(action);
}