You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Mathias P.W Nilsson" <ma...@snyltarna.se> on 2008/08/30 12:15:21 UTC

Mount files outside container

Hi!

I want to mount files

c:/myFolder/files/..... so that I can get it in wicket and from my html.
like /Files/......

Can wicket do this for me? Pointers?
-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19232069.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by James Carman <ja...@carmanconsulting.com>.
I would think you would have to use a servlet (unless they're in some
location that can be served by your web browser).

On Sat, Aug 30, 2008 at 9:16 AM, Mathias P.W Nilsson
<ma...@snyltarna.se> wrote:
>
> Thank you very much for the suggestion. By doing this I must add all my
> images from Wicket code.
>
> Let's say I want to server a logo, background image or something like that.
> And just do it via my markup file. Can this be achieved or do I have to use
> a servlet?
> --
> View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19233284.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Mount files outside container

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
I will look into this immediately. 
-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19252473.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by Ritesh Trivedi <ri...@gmail.com>.
I still dont understand why you are not using custom resource loader instead
of the servlet. If you use that, you have control over which resource files
are loaded first - the ones in the war or the ones outside.

As far as background images in the css, dont quote me on this, but you can
use absolute, relative paths or urls. If you have a fixed folder name where
the images are going to reside, you can specify it any one of those ways. I
dont think css files can read environment variables to avoid this fixed
location. One strategy would be to use the urls, and let apache (or
whichever webserver) serve the images. You can then play with the location
etc in apache config.


Mathias P.W Nilsson wrote:
> 
> I still have struggle with this image, flash, files and Wicket
> 
> Here is my problem.
> 
> I have all my css files, images, flashes pdf etc in a dir let's say 
> 
> c:/mydir/
> 
> To access these files from my webapp I have created a Servlet that get the
> files from my dir outside of the container using this path
> /Files/myimage.gif
> 
> In my web.xml I have the servlet  <url-pattern>/Files/*</url-pattern>
> 
> The reasone I have the files outside the container is so that the css,
> files can be changed without having to deploy the war file again or that
> the css is Changed in the container but after redeploying the changes is
> lost because of a designer changing the css.
> 
> Now, I can't use wicket declarations in my css file and when I have
> background images in my css the servlet is not found. I would like to use
> only wicket and not servlets mapping the files outside of the container.
> How do you add background images in a css?
> 
> Do you keep the background image and the css inside the container? What
> about when we need to change background image?
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19259336.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
I still have struggle with this image, flash, files and Wicket

Here is my problem.

I have all my css files, images, flashes pdf etc in a dir let's say 

c:/mydir/

To access these files from my webapp I have created a Servlet that get the
files from my dir outside of the container using this path
/Files/myimage.gif

In my web.xml I have the servlet  <url-pattern>/Files/*</url-pattern>

The reasone I have the files outside the container is so that the css, files
can be changed without having to deploy the war file again or that the css
is Changed in the container but after redeploying the changes is lost
because of a designer changing the css.

Now, I can't use wicket declarations in my css file and when I have
background images in my css the servlet is not found. I would like to use
only wicket and not servlets mapping the files outside of the container. How
do you add background images in a css?

Do you keep the background image and the css inside the container? What
about when we need to change background image?


-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19258448.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by Ritesh Trivedi <ri...@gmail.com>.
You probably can do this by enclosing your images (and other resources)
inside
<wicket:link> and have custom resource loaded defined for your application,
which will load from whatever path(s) you want.




Mathias P.W Nilsson wrote:
> 
> Thank you very much for the suggestion. By doing this I must add all my
> images from Wicket code.
> 
> Let's say I want to server a logo, background image or something like
> that. And just do it via my markup file. Can this be achieved or do I have
> to use a servlet?
> 

-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19243524.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Thank you very much for the suggestion. By doing this I must add all my
images from Wicket code.

Let's say I want to server a logo, background image or something like that.
And just do it via my markup file. Can this be achieved or do I have to use
a servlet?
-- 
View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19233284.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mount files outside container

Posted by James Carman <ja...@carmanconsulting.com>.
You mean you want Wicket to serve up files from outside of your webapp
directory?  We do that at work with images.  I just created a special
image resource class that basically just streams back the file
contents from the disk.  Try something like this:

public class FileImageResource extends DynamicImageResource
{
    private static final long serialVersionUID = 1L;
    private final String path;

    public FileImageResource( File file, String format )
    {
        super(format);
        this.path = file.getAbsolutePath();
        setCacheable(true);
        setLastModifiedTime(Time.valueOf(file.lastModified()));
    }

    protected byte[] getImageData()
    {
        return FileUtils.getFileContents(new File(path));
    }
}

On Sat, Aug 30, 2008 at 6:15 AM, Mathias P.W Nilsson
<ma...@snyltarna.se> wrote:
>
> Hi!
>
> I want to mount files
>
> c:/myFolder/files/..... so that I can get it in wicket and from my html.
> like /Files/......
>
> Can wicket do this for me? Pointers?
> --
> View this message in context: http://www.nabble.com/Mount-files-outside-container-tp19232069p19232069.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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