Hi. DId you mean that I need to listen to the headersframe of A sent by server and let the B & C depend on the streamId of the headersframe we heard.
Best Regards Muhui Jiang 2015-09-17 2:47 GMT+08:00 Simone Bordet <[email protected]>: > Hi, > > On Wed, Sep 16, 2015 at 6:35 PM, Muhui Jiang <[email protected]> wrote: > > Hi > > > > I run the main method successfully, and it seems the result still not > good. > > > > Here is the code, I am using the phase to start the thread at the same > time: > > > > public class Client > > > > { > > > > static String host = "127.0.0.1"; > > > > static int port = 8081; > > > > static ArrayList<String> childpath = new ArrayList<String>(); > > > > static ArrayList<HeadersFrame> myHeadersFrames = new > > ArrayList<HeadersFrame>(); > > > > public static void main(String[] args) throws Exception > > > > { > > > > childpath.add("index.html"); > > > > childpath.add("js/preloadjs.min.js"); > > > > childpath.add("css/foundation.css"); > > > > > > > > > > HTTP2Client client = new HTTP2Client(); > > > > SslContextFactory sslContextFactory = new SslContextFactory(); > > > > client.addBean(sslContextFactory); > > > > client.start(); > > > > FuturePromise<Session> sessionPromise = new FuturePromise<>(); > > > > client.connect(sslContextFactory, new InetSocketAddress(host, > port), > > new ServerSessionListener.Adapter(), sessionPromise); > > > > Session session = sessionPromise.get(5, TimeUnit.SECONDS); > > > > > > HttpFields requestFields = new HttpFields(); > > > > requestFields.put("User-Agent", client.getClass().getName() + > "/" + > > Jetty.VERSION); > > > > > > > > > > > > for(int id =0;id<childpath.size();id++) > > > > { > > > > MetaData.Request metaData = new MetaData.Request("GET", new > > HttpURI("https://"+host+":"+port+"/"+childpath.get(id)), > HttpVersion.HTTP_2, > > requestFields); > > > > if(id == 0) > > > > { > > > > HeadersFrame headersFrame = new HeadersFrame( metaData, null, true); > > > > myHeadersFrames.add(headersFrame); > > > > } > > > > if(id == 1) > > > > { > > > > HeadersFrame headersFrame = new HeadersFrame( metaData, new > > PriorityFrame(myHeadersFrames.get(0).getStreamId(), 256, false), true); > > > > myHeadersFrames.add(headersFrame); > > No, at this point myHeadersFrames.get(0).getStreamId() returns 0 which > is not what you want. > > You have to send the first frame, so you can get the real streamId > back, and then prepare and send the other frames. > > -- > Simone Bordet > ---- > http://cometd.org > http://webtide.com > Developer advice, training, services and support > from the Jetty & CometD experts. > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users >
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
