本文整理了Java中org.eclipse.jetty.server.Request.getContentLength
方法的一些代码示例,展示了Request.getContentLength
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getContentLength
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getContentLength
暂无
代码示例来源: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)
内容来源于网络,如有侵权,请联系作者删除!