Tabnine Logo
Request.getContentLength
Code IndexAdd Tabnine to your IDE (free)

How to use
getContentLength
method
in
org.eclipse.jetty.server.Request

Best Java code snippets using org.eclipse.jetty.server.Request.getContentLength (Showing top 20 results out of 315)

origin: AsyncHttpClient/async-http-client

 @Override
 public void handle(String pathInContext, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException {
  String redirectHeader = httpRequest.getHeader("X-REDIRECT");
  if (redirectHeader != null && !redirectAlreadyPerformed) {
   redirectAlreadyPerformed = true;
   httpResponse.setStatus(Integer.valueOf(redirectHeader));
   httpResponse.setContentLength(0);
   httpResponse.setHeader(LOCATION.toString(), getTargetUrl());
  } else {
   receivedContentType = request.getContentType();
   httpResponse.setStatus(200);
   int len = request.getContentLength();
   httpResponse.setContentLength(len);
   if (len > 0) {
    byte[] buffer = new byte[len];
    IOUtils.read(request.getInputStream(), buffer);
    httpResponse.getOutputStream().write(buffer);
   }
  }
  httpResponse.getOutputStream().flush();
  httpResponse.getOutputStream().close();
 }
};
origin: org.apache.knox/gateway-server

@Override
public void log( Request request, Response response ) {
 if( log.isTraceEnabled() ) {
  StringBuilder sb = new StringBuilder();
  TraceUtil.appendCorrelationContext( sb );
  sb.append( "|" );
  sb.append( request.getRemoteAddr() );
  sb.append( "|" );
  sb.append( request.getMethod() );
  sb.append( "|" );
  sb.append( request.getHttpURI() );
  sb.append( "|" );
  sb.append( request.getContentLength() );
  sb.append( "|" );
  sb.append( response.getStatus() );
  sb.append( "|" );
  sb.append( response.getContentCount() );
  sb.append( "|" );
  sb.append( System.currentTimeMillis() - request.getTimeStamp() );
  log.trace( sb );
 }
}
origin: apache/knox

 @Override
 public void log( Request request, Response response ) {
  if( log.isTraceEnabled() ) {
   StringBuilder sb = new StringBuilder();
   TraceUtil.appendCorrelationContext(sb);
   sb.append('|')
     .append(request.getRemoteAddr())
     .append('|')
     .append(request.getMethod())
     .append('|')
     .append(request.getHttpURI())
     .append('|')
     .append(request.getContentLength())
     .append('|')
     .append(response.getStatus())
     .append('|')
     .append(response.getContentCount())
     .append('|')
     .append(System.currentTimeMillis() - request.getTimeStamp());
   log.trace(sb);
  }
 }
}
origin: kiegroup/droolsjbpm-integration

  @Override
  public void handle( Request request, HttpServletResponse response ) {
    body.set(new String(read()));
    length.set(request.getContentLength());
    response.setStatus(HTTP_OK);
  }
};
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

private void extractContentParameters()
{
  String contentType = getContentType();
  if (contentType == null || contentType.isEmpty())
    _contentParameters=NO_PARAMS;
  else
  {
    _contentParameters=new MultiMap<>();
    contentType = HttpFields.valueParameters(contentType, null);
    int contentLength = getContentLength();
    if (contentLength != 0)
    {
      if (MimeTypes.Type.FORM_ENCODED.is(contentType) && _inputState == __NONE &&
        _channel.getHttpConfiguration().isFormEncodedMethod(getMethod()))
      {
        extractFormParameters(_contentParameters);
      }
      else if (contentType.startsWith("multipart/form-data") &&
          getAttribute(__MULTIPART_CONFIG_ELEMENT) != null &&
          _multiPartInputStream == null)
      {
        extractMultipartParameters(_contentParameters);
      }
    }
  }
}
origin: Nextdoor/bender

int contentLength = getContentLength();
if (contentLength > maxFormContentSize && maxFormContentSize > 0)
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

int contentLength = getContentLength();
if (contentLength > maxFormContentSize && maxFormContentSize > 0)
origin: jenkinsci/winstone

int contentLength = getContentLength();
if (contentLength > maxFormContentSize && maxFormContentSize > 0)
origin: Nextdoor/bender

private MultiMap<String> extractContentParameters()
{
  MultiMap<String> result = new MultiMap<>();
  String contentType = getContentType();
  if (contentType != null && !contentType.isEmpty())
  {
    contentType = HttpFields.valueParameters(contentType, null);
    int contentLength = getContentLength();
    if (contentLength != 0)
    {
      if (MimeTypes.Type.FORM_ENCODED.is(contentType) && _inputState == __NONE &&
          (HttpMethod.POST.is(getMethod()) || HttpMethod.PUT.is(getMethod())))
      {
        extractFormParameters(result);
      }
      else if (contentType.startsWith("multipart/form-data") &&
          getAttribute(__MULTIPART_CONFIG_ELEMENT) != null &&
          _multiPartInputStream == null)
      {
        extractMultipartParameters(result);
      }
    }
  }
  return result;
}
origin: org.eclipse.jetty/server

  && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: com.nesscomputing.components/ness-httpserver

@Test
public void testLog4jLoggerWorks()
{
  Request req = createNiceMock(Request.class);
  Response resp = createNiceMock(Response.class);
  expect(req.getRemoteAddr()).andReturn("1.2.3.4").anyTimes();
  Cookie[] cookies = {new Cookie("trumpet-JSON-api-AUTHORIZATION", "omgwtfbbq")};
  expect(req.getCookies()).andReturn(cookies).anyTimes();
  expect(req.getMethod()).andReturn("GET").anyTimes();
  expect(req.getRequestURL()).andReturn(new StringBuffer("foo")).anyTimes();
  expect(req.getQueryString()).andReturn("?bar").anyTimes();
  expect(req.getContentLength()).andReturn(42).anyTimes();
  expect(req.getTimeStamp()).andReturn(10000L).anyTimes();
  expect(resp.getStatus()).andReturn(201).anyTimes();
  replayAll();
  final Config config = Config.getFixedConfig("ness.httpserver.request-log.log4j.enabled", "true");
  final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new Log4jRequestLogModule(config));
  inj.injectMembers(this);
  Assert.assertNotNull(log);
  log.log(req, resp);
  verifyAll();
}
origin: org.eclipse.jetty.aggregate/jetty-all-server

  && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: org.eclipse.jetty.aggregate/jetty-plus

  && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: org.eclipse.jetty.aggregate/jetty-server

  && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: org.eclipse.jetty.aggregate/jetty-webapp

  && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: com.ovea.tajin.servers/tajin-server-jetty9

(HttpMethod.POST.is(getMethod()) || HttpMethod.PUT.is(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: com.ovea.tajin.server/tajin-server-jetty9

(HttpMethod.POST.is(getMethod()) || HttpMethod.PUT.is(getMethod())))
int content_length = getContentLength();
if (content_length != 0)
origin: jenkinsci/winstone

int contentLength = getContentLength();
if (contentLength != 0 && _inputState == __NONE)
origin: com.ovea.tajin.server/tajin-server-jetty9

long content_length=_channel.getRequest().getContentLength();
int size=getInputBufferSize();
if (size<content_length)
origin: com.ovea.tajin.servers/tajin-server-jetty9

long content_length=_channel.getRequest().getContentLength();
int size=getInputBufferSize();
if (size<content_length)
org.eclipse.jetty.serverRequestgetContentLength

Popular methods of Request

  • setHandled
  • getMethod
  • getRequestURI
  • getHeader
  • getRemoteAddr
  • getTimeStamp
    Get Request TimeStamp
  • getQueryString
  • isHandled
  • setAttribute
  • getAttribute
    Get Request Attribute. Also supports jetty specific attributes to gain access to Jetty APIs:org.ecli
  • getSession
  • getResponse
  • getSession,
  • getResponse,
  • setMethod,
  • getAuthentication,
  • getContentType,
  • getProtocol,
  • getInputStream,
  • setAuthentication,
  • getDispatcherType,
  • getPathInfo

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Reference (javax.naming)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now