You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by sana <sa...@gmail.com> on 2009/06/18 12:08:18 UTC
registring ressource http
hello,
i 'm trying to registre a picture like a http ressource
http.registerResources("/Vue","/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue",
null);
and i want to use it in the background of my servlet .
pw.print("<html><head>");
pw.print("<meta http-equiv=" + "Content-Type" + "content=" +
"text/html; charset=iso8859-1" + "/>");
pw.print("<title></title>");
pw.print("<style type=\"text/css\"> body
{background:url(\"/Vue/image.jpg\");}</style> ");
pw.print("</head>");
pw.print("<body>");pw.print("</body>");pw.print(</html>);
but i get a white background and when i call
localhost:8080/Vue/image.jpg i get the error 404
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: registring ressource http
Posted by Alin Dreghiciu <ad...@gmail.com>.
I suppose the path you send as second param is a
file system path. That will not work only if you have your custom http
context and looks up resources in the file system.
Here is the part from the specs:
"The second parameter is an internal prefix to
map this resource to the bundle’s name-space. When a request is received,
the HttpService object must remove the external alias from the URI, replace
it with the internal prefix, and call the getResource(String) method with
this new name on the associated HttpContext object."
HTH,
On Thu, Jun 18, 2009 at 1:08 PM, sana <sa...@gmail.com> wrote:
> hello,
>
> i 'm trying to registre a picture like a http ressource
>
>
> http.registerResources("/Vue","/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue",
> null);
>
>
> and i want to use it in the background of my servlet .
> pw.print("<html><head>");
> pw.print("<meta http-equiv=" + "Content-Type" + "content=" +
> "text/html; charset=iso8859-1" + "/>");
> pw.print("<title></title>");
> pw.print("<style type=\"text/css\"> body
> {background:url(\"/Vue/image.jpg\");}</style> ");
>
> pw.print("</head>");
> pw.print("<body>");pw.print("</body>");pw.print(</html>);
>
>
>
> but i get a white background and when i call
> localhost:8080/Vue/image.jpg i get the error 404
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Alin Dreghiciu
Software Developer - Looking for new projects!
My profile: http://www.linkedin.com/in/alindreghiciu
My blog: http://adreghiciu.blogspot.com
http://www.ops4j.org - New Energy for OSS Communities - Open Participation
Software.
http://www.qi4j.org - New Energy for Java - Domain Driven Development.
Re: registring ressource http
Posted by sana <sa...@gmail.com>.
thanks very much guys :)
now it works !!
2009/6/18 Rob Walker <ro...@ascert.com>
> in which case - your alias and path can probably both be "/Vue" when you
> register the resource. There are other options, but this is the simplest. It
> will only work though if it can find the required resource at the registered
> path + resource path within the bundle JAR that calls registerResource.
>
>
> sana wrote:
>
>> /Vue is a package contained in my jar , and image.jpg is in /Vue
>>
>>
>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
> --
>
>
> Ascert - Taking systems to the Edge
> robw@ascert.com
> +44 (0)20 7488 3470
> www.ascert.com
>
>
Re: registring ressource http
Posted by Rob Walker <ro...@ascert.com>.
in which case - your alias and path can probably both be "/Vue" when you
register the resource. There are other options, but this is the
simplest. It will only work though if it can find the required resource
at the registered path + resource path within the bundle JAR that calls
registerResource.
sana wrote:
> /Vue is a package contained in my jar , and image.jpg is in /Vue
>
>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>
>
--
Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.ascert.com
Re: registring ressource http
Posted by sana <sa...@gmail.com>.
/Vue is a package contained in my jar , and image.jpg is in /Vue
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: registring ressource http
Posted by Rob Walker <ro...@ascert.com>.
sana wrote:
> how can i put image.jpg in my bundle ?
>
>
jar -?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: registring ressource http
Posted by sana <sa...@gmail.com>.
how can i put image.jpg in my bundle ?
2009/6/18 Rob Walker <ro...@ascert.com>
> Sana - as the guys say, this will only work if the following resource
> exists in the bundle calling registerResource():
>
>
> /home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue/image.jpg
>
> The handling for default Http context is to strip the alias from the
> resource path (i.e leaving in image.jpg in your case) - and look for this
> *only* in the bundle at the path specified.
>
> If this resource exists elsewhere (e.g. in the local file system) - you
> will need to implement your own HttpContext with a getResource() to find and
> return a URL to your resource.
>
> Regards
>
> -- Rob
>
>
>
> Toni Menzel wrote:
>
>> Hi Sana,
>>
>> the second parameter (resource) is a bundle resource path and not a
>> file path/folder.
>> Are those resources in you bundle ?
>> If you have "/Vue/img1.jpg,/Vue/img2.jpg" in your bundle, you can
>> refer to it exactly this way.
>>
>> On 6/18/09, sana <sa...@gmail.com> wrote:
>>
>>
>>> hello,
>>>
>>> i 'm trying to registre a picture like a http ressource
>>>
>>>
>>> http.registerResources("/Vue","/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue",
>>> null);
>>>
>>>
>>> and i want to use it in the background of my servlet .
>>> pw.print("<html><head>");
>>> pw.print("<meta http-equiv=" + "Content-Type" + "content=" +
>>> "text/html; charset=iso8859-1" + "/>");
>>> pw.print("<title></title>");
>>> pw.print("<style type=\"text/css\"> body
>>> {background:url(\"/Vue/image.jpg\");}</style> ");
>>>
>>> pw.print("</head>");
>>> pw.print("<body>");pw.print("</body>");pw.print(</html>);
>>>
>>>
>>>
>>> but i get a white background and when i call
>>> localhost:8080/Vue/image.jpg i get the error 404
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
> --
>
>
> Ascert - Taking systems to the Edge
> robw@ascert.com
> +44 (0)20 7488 3470
> www.ascert.com
>
>
Re: registring ressource http
Posted by Rob Walker <ro...@ascert.com>.
Sana - as the guys say, this will only work if the following resource
exists in the bundle calling registerResource():
/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue/image.jpg
The handling for default Http context is to strip the alias from the resource path (i.e leaving in image.jpg in your case) - and look for this *only* in the bundle at the path specified.
If this resource exists elsewhere (e.g. in the local file system) - you will need to implement your own HttpContext with a getResource() to find and return a URL to your resource.
Regards
-- Rob
Toni Menzel wrote:
> Hi Sana,
>
> the second parameter (resource) is a bundle resource path and not a
> file path/folder.
> Are those resources in you bundle ?
> If you have "/Vue/img1.jpg,/Vue/img2.jpg" in your bundle, you can
> refer to it exactly this way.
>
> On 6/18/09, sana <sa...@gmail.com> wrote:
>
>> hello,
>>
>> i 'm trying to registre a picture like a http ressource
>>
>> http.registerResources("/Vue","/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue",
>> null);
>>
>>
>> and i want to use it in the background of my servlet .
>> pw.print("<html><head>");
>> pw.print("<meta http-equiv=" + "Content-Type" + "content=" +
>> "text/html; charset=iso8859-1" + "/>");
>> pw.print("<title></title>");
>> pw.print("<style type=\"text/css\"> body
>> {background:url(\"/Vue/image.jpg\");}</style> ");
>>
>> pw.print("</head>");
>> pw.print("<body>");pw.print("</body>");pw.print(</html>);
>>
>>
>>
>> but i get a white background and when i call
>> localhost:8080/Vue/image.jpg i get the error 404
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>
>
>
--
Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.ascert.com
Re: registring ressource http
Posted by Toni Menzel <to...@okidokiteam.com>.
Hi Sana,
the second parameter (resource) is a bundle resource path and not a
file path/folder.
Are those resources in you bundle ?
If you have "/Vue/img1.jpg,/Vue/img2.jpg" in your bundle, you can
refer to it exactly this way.
On 6/18/09, sana <sa...@gmail.com> wrote:
> hello,
>
> i 'm trying to registre a picture like a http ressource
>
> http.registerResources("/Vue","/home/sst/Documents/Versions/21-05-09+saufActionParam/MyPoint/src/Vue",
> null);
>
>
> and i want to use it in the background of my servlet .
> pw.print("<html><head>");
> pw.print("<meta http-equiv=" + "Content-Type" + "content=" +
> "text/html; charset=iso8859-1" + "/>");
> pw.print("<title></title>");
> pw.print("<style type=\"text/css\"> body
> {background:url(\"/Vue/image.jpg\");}</style> ");
>
> pw.print("</head>");
> pw.print("<body>");pw.print("</body>");pw.print(</html>);
>
>
>
> but i get a white background and when i call
> localhost:8080/Vue/image.jpg i get the error 404
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Toni Menzel
Independent Software Developer
Professional Profile: http://okidokiteam.com
toni@okidokiteam.com
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org