Re: [Wicket-user] Image upload
I guess the same can be provided for file links. For example, I am writing a demo application using Wicket for an online voting application for a UK broadcaster and one of the outputs is a file which gets emailed out to a user. I also want it to be accessible from a link (at the moment it exists in /var/tmp on my server) so as per the image resource it could just be streamed. It seems a lot of work though to do it like this for a simple file link - is there an easier way in Wicket that you might think of (I'm a newbie at this framework so any suggestions would be helpful) -- View this message in context: http://www.nabble.com/Image-upload-tf1487150.html#a5126218 Sent from the Wicket - User forum at Nabble.com. Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
Though that will only work when your servlet container is configured to have access to that directory as one to serve files from, right? Eelco On 5/6/06, Timo Stamm [EMAIL PROTECTED] wrote: Igor Vaynberg schrieb: so what you need is something that maps to some url and when invoked streams the image back to the user. i see two possible ways to do this one: use a separate servlet to do this public class WeblibServlet extends HttpServlet { private static final String base = /WEB-INF/classes/META-INF/admin/weblib; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String p = base + request.getPathInfo().replace(.., ); RequestDispatcher d = getServletContext().getRequestDispatcher(p); if (d != null) { d.forward(request, response); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } } --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
Eelco Hillenius schrieb: Though that will only work when your servlet container is configured to have access to that directory as one to serve files from, right? No, you can deliver files from anywhere Java has access to. The example was copied from production code. Timo On 5/6/06, Timo Stamm [EMAIL PROTECTED] wrote: Igor Vaynberg schrieb: so what you need is something that maps to some url and when invoked streams the image back to the user. i see two possible ways to do this one: use a separate servlet to do this public class WeblibServlet extends HttpServlet { private static final String base = /WEB-INF/classes/META-INF/admin/weblib; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String p = base + request.getPathInfo().replace(.., ); RequestDispatcher d = getServletContext().getRequestDispatcher(p); if (d != null) { d.forward(request, response); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } } --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=kkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
What I meant is that it only concerns paths in the scope of the servlet context. And the problem with that is that you can't be sure you have access to that and/ or that that's a normal file system (it might be from a zip or jar/war). So you code might work for absolute paths outside the servlet context - I've never tried that - but it's not guaranteed according to the spec. Eelco On 5/6/06, Timo Stamm [EMAIL PROTECTED] wrote: Eelco Hillenius schrieb: Though that will only work when your servlet container is configured to have access to that directory as one to serve files from, right? No, you can deliver files from anywhere Java has access to. The example was copied from production code. --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight!Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Philip A. ChapmanDesktop and Web Application Development:Java, .NET, PostgreSQL, MySQL, MSSQLLinux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBEVjqCAdpynRSGw3URAiqOAKCDsSpRHf8WQ8EGaneJoAGS4WD5bwCfaYED Kb0kHbQYO8P7wOBWUVGWw7I= =x7ml -END PGP SIGNATURE- -- Philip A. ChapmanDesktop and Web Application Development:Java, .NET, PostgreSQL, MySQL, MSSQLLinux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE-Version: GnuPG v1.4.1 (GNU/Linux)iD8DBQBEV4M6AdpynRSGw3URAhkvAJ4tHqn2wYOd9LuuD43MWsGhnGGgxACffIoBEKdVHMEHbsM6PC+E9nkwcFw==GFH9-END PGP SIGNATURE-
Re: [Wicket-user] Image upload
this is already described in philip's wiki article under download image sectionwhat you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more.On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a
Re: [Wicket-user] Image upload
OK, the last part is what I think was missing. Wow, that's rather confusing for referencing a resource outside of the web app root.I'll see what I can do, thanks!On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image sectionwhat you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource { // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the
Re: [Wicket-user] Image upload
I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not.I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or
Re: [Wicket-user] Image upload
hmmis the static location accessible from the web?!?!?!?-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you
Re: [Wicket-user] Image upload
I added a section Registering and Using the Image Resource that documents how to register and use the ImageResource. On Fri, 2006-05-05 at 09:00 -0700, Igor Vaynberg wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource: public class ImageResource extends DynamicWebResource { // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data=loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; } private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = data; } @Override public int getLength() { return data.length; } private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS } } then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do this ResourceReference imageResource=... String url=RequestCycle.get().urlFor(imageResource)+?id=+id; hope this clears it up some more. -Igor hope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip, Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help! On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan
Re: [Wicket-user] Image upload
Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot.I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The upload I already had one of my devs build was working fine and I'm not sure (for now anyways) we need your full-on image service. I'm googling around to see if I can figure out how to simply turn the byte array into an image I can display on a page...not something I'm familiar with. I couldn't gather from your example how this would be done, either. Thanks for the help!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource
Re: [Wicket-user] Image upload
You don't *have* to use the ImageService. You can make the ImageResource fatter if you need. I documented the ImageService simply because that's what I have already and I think that using services is generally a good idea. On Fri, 2006-05-05 at 10:56 -0600, Vincent Jenks wrote: I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. The ImageResource uses parameters to determine what image to pass back to the caller. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. The thumbnails is only a happy extra. You still need to know what image. Without thumbnails, you've cut back from two parameters to one. You need a parameter that tells you which image out of that predefined location to return. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List). How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this... On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource: public class ImageResource extends DynamicWebResource { // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data=loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; } private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = data; } @Override public int getLength() { return data.length; } private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS } } then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do this ResourceReference imageResource=... String url=RequestCycle.get().urlFor(imageResource)+?id=+id; hope this clears it up some more. -Igor hope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip, Thanks so much
Re: [Wicket-user] Image upload
so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do thistwo:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType ()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for the sample code and wiki entry...it makes a lot of sense, however, it is a little bit of overkill for the app I built. You gave me a bazooka to take to a gun-fight! Really, what it comes down to is; I need to turn the byte array I'm pulling out of the file system and turn it into an image. The
Re: [Wicket-user] Image upload
Once I do, is this something that should be added to Wicket? Using the uploader for what I'm doing, which I'd imagine would be fairly common, sort of sucks w/o the other half of itthe ability to call those images from non-web folders. On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do this two:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified= getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType (imageEntry.getContentType()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time lastModifiedTime() { return lastModified; } // METHODS }}then you register this as a shared resource and get a resource reference. then when you want to build a url for an image you do thisResourceReference imageResource=... String url="">hope this clears it up some more.-Igorhope this clears it up some more. On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Hi Philip,Thanks so much for
Re: [Wicket-user] Image upload
sure, it depends on how general you end up making it. i think we have sufficient infrastructure in wicket already, so maybe what is needed the most is a wiki example that is far less complicated then the one philip posted and a thin wrapper around our dynamic resource that streams a file from some folder. let me know once you are done and we will see where we are-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Once I do, is this something that should be added to Wicket? Using the uploader for what I'm doing, which I'd imagine would be fairly common, sort of sucks w/o the other half of itthe ability to call those images from non-web folders. On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do this two:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified=getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength() { return data.length; }private Time lastModified; @Override public Time
Re: [Wicket-user] Image upload
Ahh...I got it workingand yeah it was far easier once you guys showed me how to actually call the image as a resource. I was getting the byte[] all along w/o a problem...it was the display that I wasn't familiar with. I *really* stripped Philip's example down to the bare metal...but I can *now* see how a lot of that would be useful...so I may go back and do some refactoring now to take advantage of some of the ideas.Anyhow, it looks great and I really appreciate the help Philip Igor! On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Once I do, is this something that should be added to Wicket? Using the uploader for what I'm doing, which I'd imagine would be fairly common, sort of sucks w/o the other half of itthe ability to call those images from non-web folders. On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do this two:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified=getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void setData(byte[] data) { this.data = ""> }@Override public int getLength()
Re: [Wicket-user] Image upload
Yeah, exactly, just a shortcut component to do this or like you said, a realy basic wiki example - which I'd be happy to contribute once I get this cleaned up a little?On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: sure, it depends on how general you end up making it. i think we have sufficient infrastructure in wicket already, so maybe what is needed the most is a wiki example that is far less complicated then the one philip posted and a thin wrapper around our dynamic resource that streams a file from some folder. let me know once you are done and we will see where we are-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Once I do, is this something that should be added to Wicket? Using the uploader for what I'm doing, which I'd imagine would be fairly common, sort of sucks w/o the other half of itthe ability to call those images from non-web folders. On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do this two:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified=getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override public byte[] getData() { return data; } void
Re: [Wicket-user] Image upload
sounds good! and thanks-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote: Yeah, exactly, just a shortcut component to do this or like you said, a realy basic wiki example - which I'd be happy to contribute once I get this cleaned up a little? On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: sure, it depends on how general you end up making it. i think we have sufficient infrastructure in wicket already, so maybe what is needed the most is a wiki example that is far less complicated then the one philip posted and a thin wrapper around our dynamic resource that streams a file from some folder. let me know once you are done and we will see where we are-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Once I do, is this something that should be added to Wicket? Using the uploader for what I'm doing, which I'd imagine would be fairly common, sort of sucks w/o the other half of itthe ability to call those images from non-web folders. On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: so what you need is something that maps to some url and when invoked streams the image back to the user.i see two possible ways to do thisone:use a separate servlet to do this two:use a wicket shared resource in both approaches the code will be 90% identicalwhat you need is to somehow tell this servlet or wicket resource which file to stream, this is what you pass in as a parameterie: www.server.com/myimageservlet?4this can tell the servlet that you want to stream c:\\app\\images\\img4.gifsame goes for the wicket resourceyou have a resource reference which builds the url that will hit the resource ( urlfor(resourcerefence) ), but you still need to tell it which image you want served so the entire process once you registered a resource and obtained a reference to it goes like thisimg wicket:id=img/String url="" // base resource url url="">WebMarkupContainer img=new WebMarkupContainer(img);img.add(new SimpleAttributeModifier(src, url);or encapsulate this whole thing into a reusable component so you can just do add(new StoredImage(img, imagenum));-IgorOn 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:Obviously not...or we wouldn't be having this conversation. It's a folder outside of the webroot. I'd have a list of strings, basically, to the effect of:C:\\app\\images\\img1.gifC:\\app\\images\\img2.gif C:\\app\\images\\img3.gif C:\\app\\images\\img4.gifI may just start storing them as blobs in the DB...they won't change often so I can cache them. I'm running short on time and starting to bite my nails! :D On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: hmmis the static location accessible from the web?!?!?!?-Igor On 5/5/06, Vincent Jenks [EMAIL PROTECTED] wrote:I guess I'm still a little lost here. Why would I need to use a querystring to build the string? Do I? I'm thinking not. I'm not generating thumbnails...my version of this is much, much, much smaller. I'm uploading images to a pre-defined, static location. That part works great, no problems there. I'm then pulling them from that static location to display them. I know that static path on disk where the images are located and I know the name ahead of time (looping through a ListItem in a ListView from EJB3 entities in a List).How is the id querystring param relevant? Can't I just pass the path + img_name.gif into the urlFor() and be done w/ it? I'm probably just over-complicating this...On 5/5/06, Igor Vaynberg [EMAIL PROTECTED] wrote: this is already described in philip's wiki article under download image section what you want is a stripped down version of the image resource:public class ImageResource extends DynamicWebResource{ // CONSTANTS public static final Log logger = LogFactory.getLog(ImageResource.class); private static final long serialVersionUID = 1L; // CONSTRUCTORS public ImageResource() { super(); } public ImageResource(Locale local) { super(local); } // METHODS // MEMBERS @Override protected ResourceState getResourceState() { ValueMap params = getParameters(); String imageId=params.get(id); byte[] data="" style="color: rgb(255, 0, 0);">loadImageData(id); Date lastModified=getImageLastMod(id); ImageResourceState state = new ImageResourceState(Time.valueOf(lastModified)); state.setContentType(imageEntry.getContentType()); state.setData(imageService.getImage(imageEntry)); return state; } class ImageResourceState extends ResourceState { // CONSTRUCTORS ImageResourceState(Time lastModified) { super(); this.lastModified = lastModified; } // MEMBERS private String contentType; @Override public String getContentType() { return contentType; } void setContentType(String contentType) { this.contentType = contentType; }private byte[] data; @Override
Re: [Wicket-user] Image upload
Igor Vaynberg schrieb: so what you need is something that maps to some url and when invoked streams the image back to the user. i see two possible ways to do this one: use a separate servlet to do this public class WeblibServlet extends HttpServlet { private static final String base = /WEB-INF/classes/META-INF/admin/weblib; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String p = base + request.getPathInfo().replace(.., ); RequestDispatcher d = getServletContext().getRequestDispatcher(p); if (d != null) { d.forward(request, response); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } } --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Philip A. Chapman Desktop and Web Application Development: Java, .NET, PostgreSQL, MySQL, MSSQL Linux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBEVjqCAdpynRSGw3URAiqOAKCDsSpRHf8WQ8EGaneJoAGS4WD5bwCfaYED Kb0kHbQYO8P7wOBWUVGWw7I= =x7ml -END PGP SIGNATURE- -- Philip A. Chapman Desktop and Web Application Development: Java, .NET, PostgreSQL, MySQL, MSSQL Linux, Windows 2000, Windows XP signature.asc Description: This is a digitally signed message part
Re: [Wicket-user] Image upload
I honestly haven't had the opportunity to integrate it into my app yet. I'm going to have to pick it apart a bit to conform to my shopping cart.I'll probably rip into it today sometime and I'll post my progress. I really appreciate the hand, thanks!On 5/2/06, Philip A. Chapman [EMAIL PROTECTED] wrote: How was it? Do I need to make any edits to make it easier to understand? On Mon, 2006-05-01 at 11:28 -0600, Vincent Jenks wrote: I'll read through this, thanks a ton! On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Philip A. ChapmanDesktop and Web Application Development:Java, .NET, PostgreSQL, MySQL, MSSQLLinux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBEVjqCAdpynRSGw3URAiqOAKCDsSpRHf8WQ8EGaneJoAGS4WD5bwCfaYED Kb0kHbQYO8P7wOBWUVGWw7I= =x7ml -END PGP SIGNATURE- -- Philip A. ChapmanDesktop and Web Application Development:Java, .NET, PostgreSQL, MySQL, MSSQLLinux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE-Version: GnuPG v1.4.1 (GNU/Linux)iD8DBQBEV4M6AdpynRSGw3URAhkvAJ4tHqn2wYOd9LuuD43MWsGhnGGgxACffIoBEKdVHMEHbsM6PC+E9nkwcFw==GFH9-END PGP SIGNATURE-
Re: [Wicket-user] Image upload
This all sounds fantastic to me...and I'm sure it's second nature to you...but means nothing to me ;) I've never used struts. Is there an example in wicket-examples? It's not obvious to me if there is one in there. Sorry for the hand-holding but I'm not at all familiar w/ this concept yet. On 4/27/06, Johan Compagner [EMAIL PROTECTED] wrote: WebDynamicResource is new in the latest 1.2 releases just a rename of DynamicByteArrayResource just make a ResourceState (inner class of DynamicByteArrayResource) and in getDate() you lazy load youre byte array from somewhere johan On 4/27/06, Vincent Jenks [EMAIL PROTECTED] wrote: I definitely don't want to use blobs Where can I find an example of doing what I need using WebDynamicResource? I don't even see this class listed in the 1.2 Javadoc... Where do I start? Thanks! On 4/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote: wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. Eelco On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
yes, thats it.basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -IgorOn 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource?On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks.Steve ---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Philip A. Chapman Desktop and Web Application Development: Java, .NET, PostgreSQL, MySQL, MSSQL Linux, Windows 2000, Windows XP signature.asc Description: This is a digitally signed message part
Re: [Wicket-user] Image upload
I'll read through this, thanks a ton!On 5/1/06, Philip A. Chapman [EMAIL PROTECTED] wrote: Sorry for the delay, but I spent the time to create a wiki page so that hopefully others can benefit from what little I have to say on the subject: http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload On Mon, 2006-05-01 at 08:01 -0700, Igor Vaynberg wrote: yes, thats it. basically you would create a that resource that takes the filename/fileid/whatever off the url and streams the file. there is an example of this, i will ask one of my friends to post it here. stay tuned. -Igor On 5/1/06, Vincent Jenks [EMAIL PROTECTED] wrote: Did you mean to say DynamicWebResource? On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server. Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Philip A. ChapmanDesktop and Web Application Development:Java, .NET, PostgreSQL, MySQL, MSSQLLinux, Windows 2000, Windows XP -BEGIN PGP SIGNATURE-Version: GnuPG v1.4.1 (GNU/Linux)iD8DBQBEVjqCAdpynRSGw3URAiqOAKCDsSpRHf8WQ8EGaneJoAGS4WD5bwCfaYEDKb0kHbQYO8P7wOBWUVGWw7I==x7ml-END PGP SIGNATURE-
Re: [Wicket-user] Image upload
What is this going to do to speed/scalability? This is for a shopping cart and these images will be what the users see on the first (and busiest) page of the app. On 4/27/06, Johan Compagner [EMAIL PROTECTED] wrote: WebDynamicResource is new in the latest 1.2 releases just a rename of DynamicByteArrayResource just make a ResourceState (inner class of DynamicByteArrayResource) and in getDate() you lazy load youre byte array from somewhere johan On 4/27/06, Vincent Jenks [EMAIL PROTECTED] wrote: I definitely don't want to use blobs Where can I find an example of doing what I need using WebDynamicResource? I don't even see this class listed in the 1.2 Javadoc... Where do I start? Thanks! On 4/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote: wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. Eelco On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
not much. if you used struts you would build it the same way.-IgorOn 4/28/06, Vincent Jenks [EMAIL PROTECTED] wrote:What is this going to do to speed/scalability?This is for a shopping cart and these images will be what the users see on the first (andbusiest) page of the app.On 4/27/06, Johan Compagner [EMAIL PROTECTED] wrote: WebDynamicResource is new in the latest 1.2 releases just a rename of DynamicByteArrayResource just make a ResourceState (inner class of DynamicByteArrayResource) and in getDate() you lazy load youre byte array from somewhere johan On 4/27/06, Vincent Jenks [EMAIL PROTECTED] wrote: I definitely don't want to use blobs Where can I find an example of doing what I need using WebDynamicResource?I don't even see this class listed in the 1.2 Javadoc... Where do I start? Thanks! On 4/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote: wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. EelcoOn 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user--- Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642___ Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
I definitely don't want to use blobs Where can I find an example of doing what I need using WebDynamicResource? I don't even see this class listed in the 1.2 Javadoc... Where do I start? Thanks! On 4/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote: wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. Eelco On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
WebDynamicResource is new in the latest 1.2 releasesjust a rename of DynamicByteArrayResourcejust make a ResourceState (inner class of DynamicByteArrayResource)and in getDate() you lazy load youre byte array from somewhere johanOn 4/27/06, Vincent Jenks [EMAIL PROTECTED] wrote: I definitely don't want to use blobsWhere can I find an example of doing what I need usingWebDynamicResource?I don't even see this class listed in the 1.2Javadoc...Where do I start?Thanks! On 4/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote: wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. Eelco On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages.How should I go about uploading the images so that they can be used in Wicket Image components on the other pages?The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image.Where should I save the images to make this work? Thanks. Steve--- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user--- Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642___ Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] image upload
I'm sure this has been asked before but I couldn't find an example. I'm using JBoss 4 and Wicket 1.2RC2...and I'm trying to upload images into a specific folder inside of a deployed .ear project. The folder in the web app would be /ear-name/assets/images However, that folder doesn't exist after I deploy the EAR file, there technically is no folder to upload *to* - unless you count the stuff that's created in /tmp and /workand that's not something that can be hard-coded. How can I get around this? Thanks! --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] image upload
can you upload into the ear's unpacked folder? is that safe, will images still be there after you redeploy?usually you set a dir that you want to use that is outside the webserver, ie d:/assets/myapp/images and you pass that as a config param to your app. -IgorOn 4/26/06, Vincent Jenks [EMAIL PROTECTED] wrote: I'm sure this has been asked before but I couldn't find an example.I'm using JBoss 4 and Wicket 1.2RC2...and I'm trying to upload imagesinto a specific folder inside of a deployed .ear project.The folder in the web app would be /ear-name/assets/imagesHowever, that folder doesn't exist after I deploy the EAR file, theretechnically is no folder to upload *to* - unless you count the stuffthat's created in /tmp and /workand that's not something that can be hard-coded.How can I get around this?Thanks!---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] image upload
you only have one directorly (besides tmp dir of java) where you can save youre files if you don;t have full control over youre app server:javax.servlet.context.tempdirsee http://tomcat.apache.org/tomcat-4.1-doc/config/host.htmljohanOn 4/26/06, Vincent Jenks [EMAIL PROTECTED] wrote:I'm sure this has been asked before but I couldn't find an example. I'm using JBoss 4 and Wicket 1.2RC2...and I'm trying to upload imagesinto a specific folder inside of a deployed .ear project.The folderin the web app would be /ear-name/assets/imagesHowever, that folder doesn't exist after I deploy the EAR file, there technically is no folder to upload *to* - unless you count the stuffthat's created in /tmp and /workand that's not something that canbe hard-coded.How can I get around this?Thanks! ---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642___ Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] image upload
but again thats a temp directory, your prob dont want to use it for persistent files.-IgorOn 4/26/06, Johan Compagner [EMAIL PROTECTED] wrote:you only have one directorly (besides tmp dir of java) where you can save youre files if you don;t have full control over youre app server: javax.servlet.context.tempdirsee http://tomcat.apache.org/tomcat-4.1-doc/config/host.htmljohanOn 4/26/06, Vincent Jenks [EMAIL PROTECTED] wrote: I'm sure this has been asked before but I couldn't find an example. I'm using JBoss 4 and Wicket 1.2RC2...and I'm trying to upload imagesinto a specific folder inside of a deployed .ear project.The folderin the web app would be /ear-name/assets/imagesHowever, that folder doesn't exist after I deploy the EAR file, there technically is no folder to upload *to* - unless you count the stuffthat's created in /tmp and /workand that's not something that canbe hard-coded.How can I get around this?Thanks! ---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmdlnkkid0709bid3057dat1642 ___ Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Image upload
wicket-contrib-examples of wicket-stuff has the cdapp example that does this. It uses hibernate and stores uploaded images in the database as a blob. Eelco On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work? Thanks. Steve --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Image upload
I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work?Thanks.Steve
Re: [Wicket-user] Image upload
you could save those images to a DB or to a working dir on the server.Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image.johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work?Thanks. Steve
Re: [Wicket-user] Image upload
I do this and save the files off to a working directory on the server, while the metadata is stored in the database. I didn't know about WebDynamicResource, so I wrote a simple servlet filter to handle it for me. On 4/21/06, Johan Compagner [EMAIL PROTECTED] wrote: you could save those images to a DB or to a working dir on the server.Then have a DynamicByteArrayResource or the 1.2 one: WebDynamicResource to load the image from the location you stored the image. johan On 4/21/06, Steve Knight [EMAIL PROTECTED] wrote: I am creating a form that will allow users to upload image files that will be displayed on other pages. How should I go about uploading the images so that they can be used in Wicket Image components on the other pages? The upload part is not problem, I just don't know where I should put them. On my view pages, I am using ThumbnailImageResource which takes a WebResource in it's contructor to find the image. Where should I save the images to make this work?Thanks. Steve