WebResponse ContentLength > 2G

2010-06-15 Thread Louis Letourneau
I'm trying to send a file >2G using ResourceStreamRequestTarget +
FileResourceStream, but the content-type is always set to a big negative
value typical of a long(>2G) to int conversion.
This is non-standard and the proxy we use refuses it (most browser just
ignore it, but the RFC states that the value must be >0).

After looking deeper in the code I see that, in wicket, longs are used
for the content length across the board, but when this is transfered to
a HttpServletResponse there is an (int) cast.

Shouldn't wicket use ints to remove the confusion, or if not (and I
think this is the best course), shouldn't a test be made
if > Integer.MAX_VALUE
  httpServletResponse.addHeader("Content-Length", Long.toString(length));

instead
?

I tried the last approach overriding newWebResponse on WebApplication
with my custom WebResponse and it fixed my problem.

Should I open a bug?

Thanks
Louis

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



Re: AjaxLink setResponsePage > Channel busy - postponing

2008-09-16 Thread Louis Letourneau

Issue created
WICKET-1838

Thanks
Louis

Matej Knopp wrote:

Hi,

this is probably a bug in wicket where the queue is not resumed after
redirect. Normally this is not needed, but since your redirect is an
attachement the page stays active. Can you please open a jira issue for
this? It shouldn't be difficult to fix.

-Matej

On Tue, Sep 16, 2008 at 6:27 PM, Louis Letourneau <
[EMAIL PROTECTED]> wrote:


The redirect works (firefox pops up the filedownload window)

the problem is since I'm not actually redirected to a page (I get a file
instead) I stay on the same page with the links but the links do not work
anymore.

If I click on them I get 'Channel busy - postponing'.

I'm using wicket 1.3.4.

The redirect seems to happen, but only once.

Say there are 3 files to download on the page, I would need to:
click link1 -> download the file -> refresh the page -> click link2 -. etc.

I shouldn't need to refresh the page.

If I don't refresh the page, when I click link2 I'll get 'Channel busy -
postponing'.

BTW:
On the first link click in firebug I get this in the response headers:
Ajax-Location   ../../../../fileDownload?type=RUN_REGION_READS_FILE&id=246


which makes sens since the QueryStringUrlCodingStrategy is mounted on
'fileDownload'.

Louis


Matej Knopp wrote:


For some reason the redirect didn't happen. What wicket version are you
using?

-Matej

On Tue, Sep 16, 2008 at 5:43 PM, Louis Letourneau <
[EMAIL PROTECTED]> wrote:

 When I click on an AjaxLink that does a setResponsePage towards a

ResourceStreamRequestTarget, afetr the download, the links on the page
become non-clickable. In the Ajax debug window I get a 'Channel busy -
postponing'.

Details:
I have a page with many AjaxLinks. The links check whether some data is
available. If the data is available it does a setResponsePage towards a
BookmarkablePage that can work with the data.

The Page that handles the data is mounted on a 'custom'
QueryStringUrlCodingStrategy. In 'decode()' the strategy checks if
manipulations are needed. If not the strategy answers with a
ResourceStreamRequestTarget.

So here's the path that causes the error:
onClick->setResponsePage->decode->ResourceStreamRequestTarget

Once a link has been clicked no other links are clickable on the page.

AjaxLink Code:
>
public void onClick(AjaxRequestTarget target)
  {
  if(file.isOnline()) {
  PageParameters params = new PageParameters();
  params.add("id", String.valueOf(typeId));
  params.add("type", type.toString());

  setResponsePage(StageableFilePage.class, params);
  }
  else {
  modal.show(target);
  }
  }

>
QueryStringUrlCodingStrategy Code:
>
  public IRequestTarget decode(RequestParameters requestParameters) {
  [..get id and fileType and make sure the user has priviledges..]
  final StageableFile file = resolveFile(id, fileType);
  if(file.isOnline()) {
  IResourceStream resourceStream = new FileResourceStream(file);

  //Content-type will be set by the ResourceStreamRequestTarget

  ResourceStreamRequestTarget rsrt = new
ResourceStreamRequestTarget(resourceStream) {
  @Override
  public String getFileName() {
  return file.getName();
  }
  };

  return rsrt;
  }
  else {
  return super.decode(requestParameters);
  }
  }
>

Any clues?
Louis

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AjaxLink setResponsePage > Channel busy - postponing

2008-09-16 Thread Louis Letourneau

The redirect works (firefox pops up the filedownload window)

the problem is since I'm not actually redirected to a page (I get a file 
instead) I stay on the same page with the links but the links do not 
work anymore.


If I click on them I get 'Channel busy - postponing'.

I'm using wicket 1.3.4.

The redirect seems to happen, but only once.

Say there are 3 files to download on the page, I would need to:
click link1 -> download the file -> refresh the page -> click link2 -. etc.

I shouldn't need to refresh the page.

If I don't refresh the page, when I click link2 I'll get 'Channel busy - 
postponing'.


BTW:
On the first link click in firebug I get this in the response headers:
Ajax-Location   ../../../../fileDownload?type=RUN_REGION_READS_FILE&id=246


which makes sens since the QueryStringUrlCodingStrategy is mounted on 
'fileDownload'.


Louis

Matej Knopp wrote:

For some reason the redirect didn't happen. What wicket version are you
using?

-Matej

On Tue, Sep 16, 2008 at 5:43 PM, Louis Letourneau <
[EMAIL PROTECTED]> wrote:


When I click on an AjaxLink that does a setResponsePage towards a
ResourceStreamRequestTarget, afetr the download, the links on the page
become non-clickable. In the Ajax debug window I get a 'Channel busy -
postponing'.

Details:
I have a page with many AjaxLinks. The links check whether some data is
available. If the data is available it does a setResponsePage towards a
BookmarkablePage that can work with the data.

The Page that handles the data is mounted on a 'custom'
QueryStringUrlCodingStrategy. In 'decode()' the strategy checks if
manipulations are needed. If not the strategy answers with a
ResourceStreamRequestTarget.

So here's the path that causes the error:
onClick->setResponsePage->decode->ResourceStreamRequestTarget

Once a link has been clicked no other links are clickable on the page.

AjaxLink Code:
>
public void onClick(AjaxRequestTarget target)
   {
   if(file.isOnline()) {
   PageParameters params = new PageParameters();
   params.add("id", String.valueOf(typeId));
   params.add("type", type.toString());

   setResponsePage(StageableFilePage.class, params);
   }
   else {
   modal.show(target);
   }
   }

>
QueryStringUrlCodingStrategy Code:
>
   public IRequestTarget decode(RequestParameters requestParameters) {
   [..get id and fileType and make sure the user has priviledges..]
   final StageableFile file = resolveFile(id, fileType);
   if(file.isOnline()) {
   IResourceStream resourceStream = new FileResourceStream(file);

   //Content-type will be set by the ResourceStreamRequestTarget

   ResourceStreamRequestTarget rsrt = new
ResourceStreamRequestTarget(resourceStream) {
   @Override
   public String getFileName() {
   return file.getName();
   }
   };

   return rsrt;
   }
   else {
   return super.decode(requestParameters);
   }
   }
>

Any clues?
Louis

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AjaxLink setResponsePage > Channel busy - postponing

2008-09-16 Thread Louis Letourneau
When I click on an AjaxLink that does a setResponsePage towards a 
ResourceStreamRequestTarget, afetr the download, the links on the page 
become non-clickable. In the Ajax debug window I get a 'Channel busy - 
postponing'.


Details:
I have a page with many AjaxLinks. The links check whether some data is 
available. If the data is available it does a setResponsePage towards a 
BookmarkablePage that can work with the data.


The Page that handles the data is mounted on a 'custom' 
QueryStringUrlCodingStrategy. In 'decode()' the strategy checks if 
manipulations are needed. If not the strategy answers with a 
ResourceStreamRequestTarget.


So here's the path that causes the error:
onClick->setResponsePage->decode->ResourceStreamRequestTarget

Once a link has been clicked no other links are clickable on the page.

AjaxLink Code:
>
public void onClick(AjaxRequestTarget target)
{
if(file.isOnline()) {
PageParameters params = new PageParameters();
params.add("id", String.valueOf(typeId));
params.add("type", type.toString());

setResponsePage(StageableFilePage.class, params);
}
else {
modal.show(target);
}
}

>
QueryStringUrlCodingStrategy Code:
>
public IRequestTarget decode(RequestParameters requestParameters) {
[..get id and fileType and make sure the user has priviledges..]
final StageableFile file = resolveFile(id, fileType);
if(file.isOnline()) {
IResourceStream resourceStream = new FileResourceStream(file);

//Content-type will be set by the ResourceStreamRequestTarget

ResourceStreamRequestTarget rsrt = new 
ResourceStreamRequestTarget(resourceStream) {

@Override
public String getFileName() {
return file.getName();
}
};

return rsrt;
}
else {
return super.decode(requestParameters);
}
}
>

Any clues?
Louis

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Popup from a link

2008-08-29 Thread Louis Letourneau

You can check out the example in wicket extensions:
http://www.wicket-library.com/wicket-examples/ajax/modal-window.0;jsessionid=D48A81DCC881B0D8A11DAA7EE39C81B1
http://www.wicketframework.org/wicket-extensions/apidocs/wicket/extensions/ajax/markup/html/modal/ModalWindow.html

If you want to reuse the modal popup elsewere, there is an example on 
how to do this nicely here:

http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup

hope it helps.
Louis

askarzaidi wrote:

Hi ,

I have a link and what I want is that the user clicks the link so that a
popup window appears. This popup will have a very simple page/form with a
couple of fields and ok/cancel button. After the user hits ok, the popup
disappears (the form submits).

Are there any good examples on popups around ? Any leads would be helpful.

thanks,
Askar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to stream a file instead of rendering a page?

2008-08-22 Thread Louis Letourneau
I need to stream a file to the browser, simple enough...but the file 
might be staged (on tape on a SAN).


In which case I want to display page telling the user to come back, the 
file will be ready in X time.


What I did was mount a QueryStringUrlCodingStrategy in which I overrided 
decode. If the file is available I return a  ResourceStreamRequestTarget 
if it is not I let QueryStringUrlCodingStrategy.decode call the 
notification Page.


I works, but I was curious to know if there is a way to do this from 
within the page without the mount?


If I put RequestCycle.get().setRequestTarget() in the constructor, 
it won't work once the page is in the user's session. I can't put it in 
respond() because it's too late in the processing (or is it?).


Any ideas, or the way I did it is the only way.

(I'm still getting my bearings around wicket and I'm trying to find the 
best practices).


Thanks



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]