You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John <jo...@quivinco.com> on 2013/02/15 23:28:49 UTC

createPageRenderLinkWithContext in jquery.gallery

I am using createPageRenderLinkWithContext with a jquery.gallery to obtain a file path link e.g. "/uploads/1/2" passed to the page that serves the images. The link is odd though, it has $002F codes in it and the gallery component malfunctions in both IE and Chrome. In IE text appears when an image is selected but no picture or frame, in Chrome crude stream data is displayed as characters!

<a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7" class="cboxElement"><img width="75" height="75" src="/webapp/img/$002fuploads$002f1$002f7"></a>

In Chrome a long gallery wraps to fit the enclosing container and in IE it breaks out.

Any ideas what the problem is?

John


Re: createPageRenderLinkWithContext in jquery.gallery

Posted by John <jo...@quivinco.com>.
thanks, this could help, any ideas about the $002f in the urls?
  ----- Original Message ----- 
  From: ICE Ernesto Arteaga Zavala 
  To: Tapestry users 
  Sent: Saturday, February 16, 2013 12:20 AM
  Subject: Re: createPageRenderLinkWithContext in jquery.gallery


  Hi, I was in the same situation, but my issue there was the extension of
  the url, seems like gallery component expects an url like
  http://host/picture/image.png instead of http://host/picture/image

  So i solve my proble like follows:

  tml
  <a href="${getFileLink(picture.id)}.jpg" id="image${picture.id}"
  rel="gal1" title="${picture.title}" style="display: none;"/>

  java
          public Link getFile(long id) {

  return pageRenderLinkSource.createPageRenderLinkWithContext(
  FileLookUp.class, new Object[] { id });

  }

          /** call from invocation like  =>  id.png **/
  public StreamResponse onActivate(String name) {
   String id = "";
   if (name.contains(".")) {
  id = name.substring(0, name.length() - 4);
  } else {
  id = name;
  }
   return onActivate(new Long(id));
  }

          /**  Call common for all other **/
  public StreamResponse onActivate(long id) {

  file = fileService.getFileById(id);

  return new StreamResponse() {

  @Override
  public void prepareResponse(Response response) {

  response.setHeader("Content-Disposition", file.toString());

  }

  @Override
  public InputStream getStream() throws IOException {

  return new ByteArrayInputStream(file.getContent());

  }

  @Override
  public String getContentType() {
  return file.getType();
  }

  };

  }

  hope this help!


  2013/2/15 John <jo...@quivinco.com>

  > I am using createPageRenderLinkWithContext with a jquery.gallery to obtain
  > a file path link e.g. "/uploads/1/2" passed to the page that serves the
  > images. The link is odd though, it has $002F codes in it and the gallery
  > component malfunctions in both IE and Chrome. In IE text appears when an
  > image is selected but no picture or frame, in Chrome crude stream data is
  > displayed as characters!
  >
  > <a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7"
  > class="cboxElement"><img width="75" height="75"
  > src="/webapp/img/$002fuploads$002f1$002f7"></a>
  >
  > In Chrome a long gallery wraps to fit the enclosing container and in IE it
  > breaks out.
  >
  > Any ideas what the problem is?
  >
  > John
  >
  >


  -- 
  Saludos,

  -------------------------------------------------------------------
  "Nada que se consiga sin pena y sin trabajo
   es verdaderamente valioso."
                                            Joseph Addison
  -------------------------------------------------------------------

  ICE Ernesto Arteaga Zavala
  Ingeniero de Desarrollo

Re: createPageRenderLinkWithContext in jquery.gallery

Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
And about the url humm no ideas...
El 15/02/2013 18:32, "ICE Ernesto Arteaga Zavala" <ar...@gmail.com>
escribió:

> I add the style to the project you need to override the css the jquery
> project does not add it
> El 15/02/2013 18:28, "John" <jo...@quivinco.com> escribió:
>
>> The .jpg extension fixed the images appearing, but still the borders and
>> buttons on the pop up image are absent so I just see the full size image
>> with text links underneath.
>>
>> Perhaps a clash of styles? The gallery demos present various styles, do I
>> need to provide some JSON params from my page class?
>>   ----- Original Message -----
>>   From: ICE Ernesto Arteaga Zavala
>>   To: Tapestry users
>>   Sent: Saturday, February 16, 2013 12:20 AM
>>   Subject: Re: createPageRenderLinkWithContext in jquery.gallery
>>
>>
>>   Hi, I was in the same situation, but my issue there was the extension of
>>   the url, seems like gallery component expects an url like
>>   http://host/picture/image.png instead of http://host/picture/image
>>
>>   So i solve my proble like follows:
>>
>>   tml
>>   <a href="${getFileLink(picture.id)}.jpg" id="image${picture.id}"
>>   rel="gal1" title="${picture.title}" style="display: none;"/>
>>
>>   java
>>           public Link getFile(long id) {
>>
>>   return pageRenderLinkSource.createPageRenderLinkWithContext(
>>   FileLookUp.class, new Object[] { id });
>>
>>   }
>>
>>           /** call from invocation like  =>  id.png **/
>>   public StreamResponse onActivate(String name) {
>>    String id = "";
>>    if (name.contains(".")) {
>>   id = name.substring(0, name.length() - 4);
>>   } else {
>>   id = name;
>>   }
>>    return onActivate(new Long(id));
>>   }
>>
>>           /**  Call common for all other **/
>>   public StreamResponse onActivate(long id) {
>>
>>   file = fileService.getFileById(id);
>>
>>   return new StreamResponse() {
>>
>>   @Override
>>   public void prepareResponse(Response response) {
>>
>>   response.setHeader("Content-Disposition", file.toString());
>>
>>   }
>>
>>   @Override
>>   public InputStream getStream() throws IOException {
>>
>>   return new ByteArrayInputStream(file.getContent());
>>
>>   }
>>
>>   @Override
>>   public String getContentType() {
>>   return file.getType();
>>   }
>>
>>   };
>>
>>   }
>>
>>   hope this help!
>>
>>
>>   2013/2/15 John <jo...@quivinco.com>
>>
>>   > I am using createPageRenderLinkWithContext with a jquery.gallery to
>> obtain
>>   > a file path link e.g. "/uploads/1/2" passed to the page that serves
>> the
>>   > images. The link is odd though, it has $002F codes in it and the
>> gallery
>>   > component malfunctions in both IE and Chrome. In IE text appears when
>> an
>>   > image is selected but no picture or frame, in Chrome crude stream
>> data is
>>   > displayed as characters!
>>   >
>>   > <a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7"
>>   > class="cboxElement"><img width="75" height="75"
>>   > src="/webapp/img/$002fuploads$002f1$002f7"></a>
>>   >
>>   > In Chrome a long gallery wraps to fit the enclosing container and in
>> IE it
>>   > breaks out.
>>   >
>>   > Any ideas what the problem is?
>>   >
>>   > John
>>   >
>>   >
>>
>>
>>   --
>>   Saludos,
>>
>>   -------------------------------------------------------------------
>>   "Nada que se consiga sin pena y sin trabajo
>>    es verdaderamente valioso."
>>                                             Joseph Addison
>>   -------------------------------------------------------------------
>>
>>   ICE Ernesto Arteaga Zavala
>>   Ingeniero de Desarrollo
>>
>

Re: createPageRenderLinkWithContext in jquery.gallery

Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
I add the style to the project you need to override the css the jquery
project does not add it
El 15/02/2013 18:28, "John" <jo...@quivinco.com> escribió:

> The .jpg extension fixed the images appearing, but still the borders and
> buttons on the pop up image are absent so I just see the full size image
> with text links underneath.
>
> Perhaps a clash of styles? The gallery demos present various styles, do I
> need to provide some JSON params from my page class?
>   ----- Original Message -----
>   From: ICE Ernesto Arteaga Zavala
>   To: Tapestry users
>   Sent: Saturday, February 16, 2013 12:20 AM
>   Subject: Re: createPageRenderLinkWithContext in jquery.gallery
>
>
>   Hi, I was in the same situation, but my issue there was the extension of
>   the url, seems like gallery component expects an url like
>   http://host/picture/image.png instead of http://host/picture/image
>
>   So i solve my proble like follows:
>
>   tml
>   <a href="${getFileLink(picture.id)}.jpg" id="image${picture.id}"
>   rel="gal1" title="${picture.title}" style="display: none;"/>
>
>   java
>           public Link getFile(long id) {
>
>   return pageRenderLinkSource.createPageRenderLinkWithContext(
>   FileLookUp.class, new Object[] { id });
>
>   }
>
>           /** call from invocation like  =>  id.png **/
>   public StreamResponse onActivate(String name) {
>    String id = "";
>    if (name.contains(".")) {
>   id = name.substring(0, name.length() - 4);
>   } else {
>   id = name;
>   }
>    return onActivate(new Long(id));
>   }
>
>           /**  Call common for all other **/
>   public StreamResponse onActivate(long id) {
>
>   file = fileService.getFileById(id);
>
>   return new StreamResponse() {
>
>   @Override
>   public void prepareResponse(Response response) {
>
>   response.setHeader("Content-Disposition", file.toString());
>
>   }
>
>   @Override
>   public InputStream getStream() throws IOException {
>
>   return new ByteArrayInputStream(file.getContent());
>
>   }
>
>   @Override
>   public String getContentType() {
>   return file.getType();
>   }
>
>   };
>
>   }
>
>   hope this help!
>
>
>   2013/2/15 John <jo...@quivinco.com>
>
>   > I am using createPageRenderLinkWithContext with a jquery.gallery to
> obtain
>   > a file path link e.g. "/uploads/1/2" passed to the page that serves the
>   > images. The link is odd though, it has $002F codes in it and the
> gallery
>   > component malfunctions in both IE and Chrome. In IE text appears when
> an
>   > image is selected but no picture or frame, in Chrome crude stream data
> is
>   > displayed as characters!
>   >
>   > <a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7"
>   > class="cboxElement"><img width="75" height="75"
>   > src="/webapp/img/$002fuploads$002f1$002f7"></a>
>   >
>   > In Chrome a long gallery wraps to fit the enclosing container and in
> IE it
>   > breaks out.
>   >
>   > Any ideas what the problem is?
>   >
>   > John
>   >
>   >
>
>
>   --
>   Saludos,
>
>   -------------------------------------------------------------------
>   "Nada que se consiga sin pena y sin trabajo
>    es verdaderamente valioso."
>                                             Joseph Addison
>   -------------------------------------------------------------------
>
>   ICE Ernesto Arteaga Zavala
>   Ingeniero de Desarrollo
>

Re: createPageRenderLinkWithContext in jquery.gallery

Posted by John <jo...@quivinco.com>.
The .jpg extension fixed the images appearing, but still the borders and buttons on the pop up image are absent so I just see the full size image with text links underneath.

Perhaps a clash of styles? The gallery demos present various styles, do I need to provide some JSON params from my page class?
  ----- Original Message -----  
  From: ICE Ernesto Arteaga Zavala 
  To: Tapestry users 
  Sent: Saturday, February 16, 2013 12:20 AM
  Subject: Re: createPageRenderLinkWithContext in jquery.gallery


  Hi, I was in the same situation, but my issue there was the extension of
  the url, seems like gallery component expects an url like
  http://host/picture/image.png instead of http://host/picture/image

  So i solve my proble like follows:

  tml
  <a href="${getFileLink(picture.id)}.jpg" id="image${picture.id}"
  rel="gal1" title="${picture.title}" style="display: none;"/>

  java
          public Link getFile(long id) {

  return pageRenderLinkSource.createPageRenderLinkWithContext(
  FileLookUp.class, new Object[] { id });

  }

          /** call from invocation like  =>  id.png **/
  public StreamResponse onActivate(String name) {
   String id = "";
   if (name.contains(".")) {
  id = name.substring(0, name.length() - 4);
  } else {
  id = name;
  }
   return onActivate(new Long(id));
  }

          /**  Call common for all other **/
  public StreamResponse onActivate(long id) {

  file = fileService.getFileById(id);

  return new StreamResponse() {

  @Override
  public void prepareResponse(Response response) {

  response.setHeader("Content-Disposition", file.toString());

  }

  @Override
  public InputStream getStream() throws IOException {

  return new ByteArrayInputStream(file.getContent());

  }

  @Override
  public String getContentType() {
  return file.getType();
  }

  };

  }

  hope this help!


  2013/2/15 John <jo...@quivinco.com>

  > I am using createPageRenderLinkWithContext with a jquery.gallery to obtain
  > a file path link e.g. "/uploads/1/2" passed to the page that serves the
  > images. The link is odd though, it has $002F codes in it and the gallery
  > component malfunctions in both IE and Chrome. In IE text appears when an
  > image is selected but no picture or frame, in Chrome crude stream data is
  > displayed as characters!
  >
  > <a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7"
  > class="cboxElement"><img width="75" height="75"
  > src="/webapp/img/$002fuploads$002f1$002f7"></a>
  >
  > In Chrome a long gallery wraps to fit the enclosing container and in IE it
  > breaks out.
  >
  > Any ideas what the problem is?
  >
  > John
  >
  >


  -- 
  Saludos,

  -------------------------------------------------------------------
  "Nada que se consiga sin pena y sin trabajo
   es verdaderamente valioso."
                                            Joseph Addison
  -------------------------------------------------------------------

  ICE Ernesto Arteaga Zavala
  Ingeniero de Desarrollo

Re: createPageRenderLinkWithContext in jquery.gallery

Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
Hi, I was in the same situation, but my issue there was the extension of
the url, seems like gallery component expects an url like
http://host/picture/image.png instead of http://host/picture/image

So i solve my proble like follows:

tml
<a href="${getFileLink(picture.id)}.jpg" id="image${picture.id}"
rel="gal1" title="${picture.title}" style="display: none;"/>

java
        public Link getFile(long id) {

return pageRenderLinkSource.createPageRenderLinkWithContext(
FileLookUp.class, new Object[] { id });

}

        /** call from invocation like  =>  id.png **/
public StreamResponse onActivate(String name) {
 String id = "";
 if (name.contains(".")) {
id = name.substring(0, name.length() - 4);
} else {
id = name;
}
 return onActivate(new Long(id));
}

        /**  Call common for all other **/
public StreamResponse onActivate(long id) {

file = fileService.getFileById(id);

return new StreamResponse() {

@Override
public void prepareResponse(Response response) {

response.setHeader("Content-Disposition", file.toString());

}

@Override
public InputStream getStream() throws IOException {

return new ByteArrayInputStream(file.getContent());

}

@Override
public String getContentType() {
return file.getType();
}

};

}

hope this help!


2013/2/15 John <jo...@quivinco.com>

> I am using createPageRenderLinkWithContext with a jquery.gallery to obtain
> a file path link e.g. "/uploads/1/2" passed to the page that serves the
> images. The link is odd though, it has $002F codes in it and the gallery
> component malfunctions in both IE and Chrome. In IE text appears when an
> image is selected but no picture or frame, in Chrome crude stream data is
> displayed as characters!
>
> <a rel="gal1" id="image1" href="/webapp/img/$002fuploads$002f1$002f7"
> class="cboxElement"><img width="75" height="75"
> src="/webapp/img/$002fuploads$002f1$002f7"></a>
>
> In Chrome a long gallery wraps to fit the enclosing container and in IE it
> breaks out.
>
> Any ideas what the problem is?
>
> John
>
>


-- 
Saludos,

-------------------------------------------------------------------
"Nada que se consiga sin pena y sin trabajo
 es verdaderamente valioso."
                                          Joseph Addison
-------------------------------------------------------------------

ICE Ernesto Arteaga Zavala
Ingeniero de Desarrollo

Re: createPageRenderLinkWithContext in jquery.gallery

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 15 Feb 2013 20:28:49 -0200, John <jo...@quivinco.com> wrote:

> I am using createPageRenderLinkWithContext with a jquery.gallery to  
> obtain a file path link e.g. "/uploads/1/2" passed to the page that  
> serves the images. The link is odd though, it has $002F codes in it and  
> the gallery component malfunctions in both IE and Chrome.

What exactly is the original context you're passing to  
createPageRenderLinkWithContext()?

> In IE text appears when an image is selected but no picture or frame,in  
> Chrome crude stream data is displayed as characters!

Are you sure you defined the content type of the image in the  
StreamResponse you're returning? Could you post your image serving page  
source?

-- 
Thiago H. de Paula Figueiredo

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