Re: efficient resource downloading

2010-05-11 Thread Zilvinas Vilutis
See no problem of using spring services within a servlet, see my servlet
example: http://pastebin.com/6tWstvAL
http://pastebin.com/6tWstvAL
Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com


On Mon, May 10, 2010 at 8:10 PM, Joe Fawzy joewic...@gmail.com wrote:

 Hi dear
 actually , access control and dynamic file generation requires using
 services which is injected by spring
 this cannot be easily done in pure servlet

 my current solution using spring @Controller and write diretly to the
 servlet response is somethingvery similar to writing a servlet
 but as i am planning to deploy on appengine, the startup time for spring
 especially when using spring mvc cannot be accepted (more than 30 sec)

 so i am tring to figure out a pure wicket solution

 thanks for your help
 Joe

 On Mon, May 10, 2010 at 5:34 AM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:

  write a servlet
 
  -igor
 
  On Sun, May 9, 2010 at 6:37 PM, Joe Fawzy joewic...@gmail.com wrote:
   Hi
   i want to know if this is an efficient way to download some files
  
   i want my users to be able to download certain files just to registerd
  users
   only so i can put that logic in the page constructor
   but is this efficient way to do this as this may be called thausands of
   times per hour   (the files generated dynamically)
   does the construction of a page and all the other bits is heavy for
 such
  a
   task
  
   i am using spring MVC right now with its rest style model and
 annotation
  but
   it seems to me too heavyweight for the task
  
   so is this appropriate?
   is there another way more efficient?
  
   public class DownloadManagerPage extends WebPage{
  private static final long serialVersionUID = 1L;
  
  public DownloadManagerPage(PageParameters parameters) {
  super(parameters);
  if (registeredUser(parameters)) {
  getRequestCycle().setRequestTarget(new
   ResourceStreamRequestTarget(new AbstractResourceStreamWriter() {
  private static final long serialVersionUID = 1L;
  public void write(OutputStream output) {
  output
  }
  
  public String getContentType() {
  return ..;
  }
  }));
  }
  }
  
  private boolean registeredUser(PageParameters parameters) {
  return ;
  }
   }
  
   thanks in advance
   Joe
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: efficient resource downloading

2010-05-11 Thread vladimir.kovalyuk

Since you wrote that you employ Spring MCV I presume you don't use any page
state when constructing your dynamic resource, instead you parse URL
parameters. Thus your resource seems to be shared resource.

I used to extend WebResource (provide your own dynamic implementation of
IResourceStream) for that task and register it as a shared resource at the
application initialization time. For the resources that have persistent URLs
I used to mount them with shared resource url coding strategy.

Since shared resources are handled by Wicket filter I always have access to
the session and can check permissions.

I like that I can handle the cache by throwing
AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_MODIFIED)
exception if the resource hasn't changed since recent download.

I would like to ask Igor to comment on that. Code maintainers expressed some
thoughts about future support of IResourceStream.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/efficient-resource-downloading-tp2164866p2174267.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



Re: efficient resource downloading

2010-05-11 Thread Zilvinas Vilutis
If you need to have the current session in a servlet, you may use the
WicketSessionFilter which injects the wicket session into a
ServletRequest.

In any way you want to use it - your chosen implementation of security part
will still be heavyweight.

Not sure if you can submit authentification details using a post request -
but I'd suggest to use some simple web server as lighthttpd or thttpd
for frequent resource access secured lighter then spring.

Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com


On Tue, May 11, 2010 at 11:06 AM, vladimir.kovalyuk koval...@gmail.comwrote:


 Since you wrote that you employ Spring MCV I presume you don't use any page
 state when constructing your dynamic resource, instead you parse URL
 parameters. Thus your resource seems to be shared resource.

 I used to extend WebResource (provide your own dynamic implementation of
 IResourceStream) for that task and register it as a shared resource at the
 application initialization time. For the resources that have persistent
 URLs
 I used to mount them with shared resource url coding strategy.

 Since shared resources are handled by Wicket filter I always have access to
 the session and can check permissions.

 I like that I can handle the cache by throwing
 AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_MODIFIED)
 exception if the resource hasn't changed since recent download.

 I would like to ask Igor to comment on that. Code maintainers expressed
 some
 thoughts about future support of IResourceStream.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/efficient-resource-downloading-tp2164866p2174267.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




Re: efficient resource downloading

2010-05-11 Thread Igor Vaynberg
On Tue, May 11, 2010 at 11:24 AM, Zilvinas Vilutis cika...@gmail.com wrote:
 If you need to have the current session in a servlet, you may use the
 WicketSessionFilter which injects the wicket session into a
 ServletRequest.

rather it binds it to the threadlocal so you can say Session.get()

-igor


 In any way you want to use it - your chosen implementation of security part
 will still be heavyweight.

 Not sure if you can submit authentification details using a post request -
 but I'd suggest to use some simple web server as lighthttpd or thttpd
 for frequent resource access secured lighter then spring.

 Žilvinas Vilutis

 Mobile:   (+370) 652 38353
 E-mail:   cika...@gmail.com


 On Tue, May 11, 2010 at 11:06 AM, vladimir.kovalyuk koval...@gmail.comwrote:


 Since you wrote that you employ Spring MCV I presume you don't use any page
 state when constructing your dynamic resource, instead you parse URL
 parameters. Thus your resource seems to be shared resource.

 I used to extend WebResource (provide your own dynamic implementation of
 IResourceStream) for that task and register it as a shared resource at the
 application initialization time. For the resources that have persistent
 URLs
 I used to mount them with shared resource url coding strategy.

 Since shared resources are handled by Wicket filter I always have access to
 the session and can check permissions.

 I like that I can handle the cache by throwing
 AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_MODIFIED)
 exception if the resource hasn't changed since recent download.

 I would like to ask Igor to comment on that. Code maintainers expressed
 some
 thoughts about future support of IResourceStream.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/efficient-resource-downloading-tp2164866p2174267.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



Re: efficient resource downloading

2010-05-10 Thread Joe Fawzy
Hi dear
actually , access control and dynamic file generation requires using
services which is injected by spring
this cannot be easily done in pure servlet

my current solution using spring @Controller and write diretly to the
servlet response is somethingvery similar to writing a servlet
but as i am planning to deploy on appengine, the startup time for spring
especially when using spring mvc cannot be accepted (more than 30 sec)

so i am tring to figure out a pure wicket solution

thanks for your help
Joe

On Mon, May 10, 2010 at 5:34 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 write a servlet

 -igor

 On Sun, May 9, 2010 at 6:37 PM, Joe Fawzy joewic...@gmail.com wrote:
  Hi
  i want to know if this is an efficient way to download some files
 
  i want my users to be able to download certain files just to registerd
 users
  only so i can put that logic in the page constructor
  but is this efficient way to do this as this may be called thausands of
  times per hour   (the files generated dynamically)
  does the construction of a page and all the other bits is heavy for such
 a
  task
 
  i am using spring MVC right now with its rest style model and annotation
 but
  it seems to me too heavyweight for the task
 
  so is this appropriate?
  is there another way more efficient?
 
  public class DownloadManagerPage extends WebPage{
 private static final long serialVersionUID = 1L;
 
 public DownloadManagerPage(PageParameters parameters) {
 super(parameters);
 if (registeredUser(parameters)) {
 getRequestCycle().setRequestTarget(new
  ResourceStreamRequestTarget(new AbstractResourceStreamWriter() {
 private static final long serialVersionUID = 1L;
 public void write(OutputStream output) {
 output
 }
 
 public String getContentType() {
 return ..;
 }
 }));
 }
 }
 
 private boolean registeredUser(PageParameters parameters) {
 return ;
 }
  }
 
  thanks in advance
  Joe
 

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




Re: efficient resource downloading

2010-05-09 Thread Igor Vaynberg
write a servlet

-igor

On Sun, May 9, 2010 at 6:37 PM, Joe Fawzy joewic...@gmail.com wrote:
 Hi
 i want to know if this is an efficient way to download some files

 i want my users to be able to download certain files just to registerd users
 only so i can put that logic in the page constructor
 but is this efficient way to do this as this may be called thausands of
 times per hour   (the files generated dynamically)
 does the construction of a page and all the other bits is heavy for such a
 task

 i am using spring MVC right now with its rest style model and annotation but
 it seems to me too heavyweight for the task

 so is this appropriate?
 is there another way more efficient?

 public class DownloadManagerPage extends WebPage{
    private static final long serialVersionUID = 1L;

    public DownloadManagerPage(PageParameters parameters) {
        super(parameters);
        if (registeredUser(parameters)) {
            getRequestCycle().setRequestTarget(new
 ResourceStreamRequestTarget(new AbstractResourceStreamWriter() {
                private static final long serialVersionUID = 1L;
                public void write(OutputStream output) {
                            output
                }

                public String getContentType() {
                    return ..;
                }
            }));
        }
    }

    private boolean registeredUser(PageParameters parameters) {
        return ;
    }
 }

 thanks in advance
 Joe


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