I wonder if there is  another way to capture wicket stream but
definitely you can just capture the url stream:

  public static byte[] getRemoteData(String urlString) {
    try {
      URL url = new URL(urlString);
      HttpURLConnection uc = (HttpURLConnection) url.openConnection();
      try {
        final int size;

        InputStream inputStream;
        {
          int tmp = uc.getContentLength();

          if (tmp < 0) {
            inputStream = new BufferedInputStream(uc.getInputStream());
            inputStream.mark(Integer.MAX_VALUE);
            while (0 <= inputStream.read()) {
              // read
            }
            inputStream.reset();
            size = inputStream.available();
          } else {
            size = tmp;
            inputStream = uc.getInputStream();
          }
        }

        int filled = 0;
        byte[] imageData = new byte[size];
        do {
          byte[] tmpData = new byte[size-filled];
          int read = inputStream.read(tmpData);
          System.arraycopy(tmpData, 0, imageData, filled, read);
          filled += read;
        } while (filled < size);
        return imageData;
      } finally {
        uc.getInputStream().close();
        uc.disconnect();
      }
    } catch (IOException e) {
      Utils.errorLog(MarkupUtils.class, "Failed to load remote data", e);
    }

    return new byte[] {};
  }

**
Martin

2009/6/25 Martin Makundi <martin.maku...@koodaripalvelut.com>
>
> In my experience WicketTester works in a single thread only ... at
> least when I tried load testing with it it did not work. Ended up
> using HTTPUnit. Maybe that works for you too?
>
> **
> Martin
>
> 2009/6/25 Mathias Nilsson <wicket.program...@gmail.com>:
> >
> > I must add....
> >
> > I have managed to get it to work by loading the applicationContext but that
> > initiates hibernate mapping etc and I do not want to do that
> > every 10th second
> >
> > UploadApplication webApp = new UploadApplication(){
> >                                //note in this case the application context 
> > is in the default
> > package
> >                                ApplicationContext context = new 
> > ClassPathXmlApplicationContext(
> >                                        new String[] 
> > {"applicationContext.xml"});
> >                               �...@override
> >                                public void init() {
> >                                        addComponentInstantiationListener(new
> > SpringComponentInjector(this, context));
> >                                    }
> >                        };
> >
> >                        WicketTester tester = new WicketTester( webApp );
> > --
> > View this message in context: 
> > http://www.nabble.com/Html-mail-with-WicketTester-tp24196423p24196515.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to