You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-dev@incubator.apache.org by Avdhesh Yadav <av...@avdheshyadav.com> on 2010/02/03 03:46:00 UTC

Displaying images stored in JCR with Tuscany

Right now the uploaded images from admin-ui saved into the file system
according to this convention(/gallery/albumname/image) and a key goes to the
JCR repository.Images should go to JCR repository not to filesystem.what I
am looking for is how to show the images(inputsream) returned rom the JCR
repository using tuscany.I know it can be done using a servlet.But is it
possible to do it with tuscany ?

Thoughts.


-- 
Avdhesh Yadav
http://www.avdheshyadav.com

Re: Displaying images stored in JCR with Tuscany

Posted by Luciano Resende <lu...@gmail.com>.
On Fri, Feb 5, 2010 at 8:38 AM, Avdhesh Yadav <av...@avdheshyadav.com> wrote:
> Thanks..Now its working.
>

Great, btw the image url should probably be a attribute in the image
model object and retrieved from the server when you interact with the
album/gallery services...

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Displaying images stored in JCR with Tuscany

Posted by Avdhesh Yadav <av...@avdheshyadav.com>.
Thanks..Now its working.

On Fri, Feb 5, 2010 at 9:07 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Fri, Feb 5, 2010 at 7:20 AM, Avdhesh Yadav <av...@avdheshyadav.com>
> wrote:
> > I tried second way.implemented Collection interface.and able to show the
> > image at path http://192.168.1.3:8080/photark/PhotoDisplayer..i hard
> coded
> > image key in get method..
> >
> > Now i want to make it dynamic..show image with provided image key.(
> > http://192.168.1.3:8080/photark/PhotoDisplayer?image=test.jpg)
> >
>
> The HTTP Binding expects a REST style uri, and not a query string.
> You should try something like:
>
> http://192.168.1.3:8080/photark/PhotoDisplayer/test.jpg
>
> >
> > public InputStream get(String key)throws NotFoundException{
> >        System.out.println("get Key:"+key);
> >        ------
> >        ---}
> >
> > somehow the key is always printing splayer.How to get the parameter in
> the
> > get method. i suppose that i should get it with key.but i always getthing
> > the splayer.
> >
>
> BTW, with the query string, I would expect the query method from
> collection to be invoked instead of the get.... unless you have the
> simplified version of the collection api that dos not make use of the
> query method.
>
> --
> Luciano Resende
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>



-- 
Avdhesh Yadav
http://www.avdheshyadav.com

Re: Displaying images stored in JCR with Tuscany

Posted by Luciano Resende <lu...@gmail.com>.
On Fri, Feb 5, 2010 at 7:20 AM, Avdhesh Yadav <av...@avdheshyadav.com> wrote:
> I tried second way.implemented Collection interface.and able to show the
> image at path http://192.168.1.3:8080/photark/PhotoDisplayer..i hard coded
> image key in get method..
>
> Now i want to make it dynamic..show image with provided image key.(
> http://192.168.1.3:8080/photark/PhotoDisplayer?image=test.jpg)
>

The HTTP Binding expects a REST style uri, and not a query string.
You should try something like:

http://192.168.1.3:8080/photark/PhotoDisplayer/test.jpg

>
> public InputStream get(String key)throws NotFoundException{
>        System.out.println("get Key:"+key);
>        ------
>        ---}
>
> somehow the key is always printing splayer.How to get the parameter in the
> get method. i suppose that i should get it with key.but i always getthing
> the splayer.
>

BTW, with the query string, I would expect the query method from
collection to be invoked instead of the get.... unless you have the
simplified version of the collection api that dos not make use of the
query method.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Displaying images stored in JCR with Tuscany

Posted by Avdhesh Yadav <av...@avdheshyadav.com>.
I tried second way.implemented Collection interface.and able to show the
image at path http://192.168.1.3:8080/photark/PhotoDisplayer..i hard coded
image key in get method..

Now i want to make it dynamic..show image with provided image key.(
http://192.168.1.3:8080/photark/PhotoDisplayer?image=test.jpg)



public InputStream get(String key)throws NotFoundException{
        System.out.println("get Key:"+key);
        ------
        ---}

somehow the key is always printing splayer.How to get the parameter in the
get method. i suppose that i should get it with key.but i always getthing
the splayer.


On Fri, Feb 5, 2010 at 11:19 AM, Luciano Resende <lu...@gmail.com>wrote:

> On Tue, Feb 2, 2010 at 7:46 PM, Avdhesh Yadav <av...@avdheshyadav.com>
> wrote:
> > Right now the uploaded images from admin-ui saved into the file system
> > according to this convention(/gallery/albumname/image) and a key goes to
> the
> > JCR repository.Images should go to JCR repository not to filesystem.what
> I
> > am looking for is how to show the images(inputsream) returned rom the JCR
> > repository using tuscany.I know it can be done using a servlet.But is it
> > possible to do it with tuscany ?
> >
> > Thoughts.
> >
>
> Two ways come to mind:
>
>   - Create a REST service based on the Servlet interface [1]
>
>   - Create a service based on the Tuscany Collection of InputStream,
> and then expose it with the HTTP Binding. [2] This will make a HTTP
> Get file.jpg to be translated to a Collection.get("file.jpg") and the
> file contents are returned to the HTTP client application.
>
> Well, this is very high level, but can get you started... please fire
> questions my way ... I'll have more time in the next couple days to
> take a look at this with more time.
>
> [1]
> https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
> [2]
> https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java
>
> --
> Luciano Resende
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>



-- 
Avdhesh Yadav
http://www.avdheshyadav.com

Re: Displaying images stored in JCR with Tuscany

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, Feb 2, 2010 at 7:46 PM, Avdhesh Yadav <av...@avdheshyadav.com> wrote:
> Right now the uploaded images from admin-ui saved into the file system
> according to this convention(/gallery/albumname/image) and a key goes to the
> JCR repository.Images should go to JCR repository not to filesystem.what I
> am looking for is how to show the images(inputsream) returned rom the JCR
> repository using tuscany.I know it can be done using a servlet.But is it
> possible to do it with tuscany ?
>
> Thoughts.
>

Two ways come to mind:

   - Create a REST service based on the Servlet interface [1]

   - Create a service based on the Tuscany Collection of InputStream,
and then expose it with the HTTP Binding. [2] This will make a HTTP
Get file.jpg to be translated to a Collection.get("file.jpg") and the
file contents are returned to the HTTP client application.

Well, this is very high level, but can get you started... please fire
questions my way ... I'll have more time in the next couple days to
take a look at this with more time.

[1] https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
[2] https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/