当前位置: 首页>>代码示例>>Java>>正文


Java DataFrame类代码示例

本文整理汇总了Java中org.eclipse.jetty.http2.frames.DataFrame的典型用法代码示例。如果您正苦于以下问题:Java DataFrame类的具体用法?Java DataFrame怎么用?Java DataFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataFrame类属于org.eclipse.jetty.http2.frames包,在下文中一共展示了DataFrame类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMutExc

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
private synchronized void sendMutExc(String method, HeadersFrame headersFrame, FuturePromise<Stream> streamPromise,
		HTTP2StreamHandler http2StreamHandler, DataPostContent dataPostContent, HTTP2SampleResult sampleResult)
		throws Exception {
	session.newStream(headersFrame, streamPromise, http2StreamHandler);
	if (method.equals("POST")) {
		Stream actualStream = streamPromise.get();
		int streamID = actualStream.getId();
		DataCallBack dataCallback = new DataCallBack();
		DataFrame data = new DataFrame(streamID,
				ByteBuffer.wrap(dataPostContent.getPayload(), 0, dataPostContent.getPayload().length), true);
		actualStream.data(data, dataCallback);
		this.addDataCallbackHandler(dataCallback);
		sampleResult.setQueryString(data.toString());// TODO revisar si es este metodo
		// add byte size of the queryString
		sampleResult.setBytes(sampleResult.getBytesAsLong() + (long) sampleResult.getQueryString().length()); 
	}

}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:19,代码来源:HTTP2Connection.java

示例2: setup

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
@Before
public void setup() throws MalformedURLException {
	TestJMeterUtils.createJmeterEnv();
	JMeterUtils.setProperty("HTTPResponse.parsers", "htmlParser");
	JMeterUtils.setProperty("htmlParser.className","org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser");
	JMeterUtils.setProperty("htmlParser.types","text/html application/xhtml+xml application/xml text/xml");
	url = new URL("http://www.tenfieldigital.com.uy");
	http2Connection = Mockito.mock(HTTP2Connection.class);
	stream = Mockito.mock(Stream.class);
	pushPromisFrame = Mockito.mock(PushPromiseFrame.class);
	headersFrame = Mockito.mock(HeadersFrame.class);
	responseMetadata = Mockito.mock(MetaData.Response.class);
	callback = Mockito.mock(Callback.class);
	dataFrame = Mockito.mock(DataFrame.class);
	
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:17,代码来源:HTTP2StreamHandlerTest.java

示例3: onData

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
@Override
public void onData(Stream stream, DataFrame frame, Callback callback) {
  LOG.info(frame);
  callback.succeeded();
  if (frame.isEndStream()) {
    phaser.arrive();
  }
}
 
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:9,代码来源:StreamListener.java

示例4: setUp

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
@Before
public void setUp() {
  phaser = mock(Phaser.class);
  headersFrame = mock(HeadersFrame.class);
  dataFrame = mock(DataFrame.class);
  stream = mock(Stream.class);
  pushPromiseFrame = mock(PushPromiseFrame.class);
  callback = mock(Callback.class);
  sut = new StreamListener(phaser);

  when(headersFrame.isEndStream()).thenReturn(Boolean.TRUE);
  when(dataFrame.isEndStream()).thenReturn(Boolean.TRUE);
}
 
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:14,代码来源:StreamListenerAdapterTest.java

示例5: onData

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
@Override
public void onData(Stream stream, DataFrame frame, Callback callback) {
    byte[] bytes = new byte[frame.getData().remaining()];
    frame.getData().get(bytes);
    System.out.println("[" + frame.getStreamId() + "] DATA " + new String(bytes));
    callback.succeeded();
    
    if (frame.isEndStream()) {
        completedFuture.complete(null);
    }
}
 
开发者ID:grro,项目名称:http2,代码行数:12,代码来源:PrintingFramesHandler.java

示例6: main

import org.eclipse.jetty.http2.frames.DataFrame; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    long startTime = System.nanoTime();

    // Create and start HTTP2Client.
    HTTP2Client client = new HTTP2Client();
    SslContextFactory sslContextFactory = new SslContextFactory(true);
    client.addBean(sslContextFactory);
    client.start();

    // Connect to host.
    String host = "localhost";
    int port = 8443;

    FuturePromise<Session> sessionPromise = new FuturePromise<>();
    client.connect(sslContextFactory, new InetSocketAddress(host, port), new ServerSessionListener.Adapter(), sessionPromise);

    // Obtain the client Session object.
    Session session = sessionPromise.get(5, TimeUnit.SECONDS);

    // Prepare the HTTP request headers.
    HttpFields requestFields = new HttpFields();
    requestFields.put("User-Agent", client.getClass().getName() + "/" + Jetty.VERSION);
    // Prepare the HTTP request object.
    MetaData.Request request = new MetaData.Request("GET", new HttpURI("https://" + host + ":" + port + "/"), HttpVersion.HTTP_2, requestFields);
    // Create the HTTP/2 HEADERS frame representing the HTTP request.
    HeadersFrame headersFrame = new HeadersFrame(request, null, true);

    // Prepare the listener to receive the HTTP response frames.
    Stream.Listener responseListener = new Stream.Listener.Adapter()
    {
        @Override
        public void onData(Stream stream, DataFrame frame, Callback callback)
        {
            byte[] bytes = new byte[frame.getData().remaining()];
            frame.getData().get(bytes);
            int duration = (int) TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime);
            System.out.println("After " + duration + " seconds: " + new String(bytes));
            callback.succeeded();
        }
    };

    session.newStream(headersFrame, new FuturePromise<>(), responseListener);
    session.newStream(headersFrame, new FuturePromise<>(), responseListener);
    session.newStream(headersFrame, new FuturePromise<>(), responseListener);

    Thread.sleep(TimeUnit.SECONDS.toMillis(20));

    client.stop();
}
 
开发者ID:fstab,项目名称:http2-examples,代码行数:50,代码来源:JettyClientExample.java


注:本文中的org.eclipse.jetty.http2.frames.DataFrame类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。