WebResource in Wicket 1.5

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

WebResource in Wicket 1.5

nazeem
I have a open flash chart implementation following the link below.

https://cwiki.apache.org/WICKET/open-flash-chart-and-wicket.html

But when i upgrade to wicket 1.5 im stuck at this..

In class OpenFlashChart,

     WebResource jsonResource = new WebResource() {
      @Override
      public IResourceStream getResourceStream() {
        return json;
      }
    };
    jsonResource.setCacheable(false);

 ...

public void onResourceRequested() {
    jsonResource.onResourceRequested();
  }



 
What is the replacement for this in wicket 1.5 ?

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

vineetsemwal
hi
use bytearrayresource

On Fri, Nov 25, 2011 at 7:49 AM, nazeem <[hidden email]> wrote:

> I have a open flash chart implementation following the link below.
>
> https://cwiki.apache.org/WICKET/open-flash-chart-and-wicket.html
>
> But when i upgrade to wicket 1.5 im stuck at this..
>
> In class OpenFlashChart,
>
>     WebResource jsonResource = new WebResource() {
>      @Override
>      public IResourceStream getResourceStream() {
>        return json;
>      }
>    };
>    jsonResource.setCacheable(false);
>
>  ...
>
> public void onResourceRequested() {
>    jsonResource.onResourceRequested();
>  }
>
>
>
>
> What is the replacement for this in wicket 1.5 ?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WebResource-in-Wicket-1-5-tp4106181p4106181.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
thank you,

regards,
Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

nazeem
Thanks Vineet, I managed to change WebResource to ByteArrayResource.

But I am stuck with a problem in the url for json constructed.

CharSequence dataPath = RequestCycle.get().urlFor(OpenFlashChart.this, IResourceListener.INTERFACE);
String url =  RequestUtils.toAbsolutePath(dataPath.toString());

When i deploy to my server and access it using the ip address, the json data url was still referring to
http://127.0.0.1:8080/erp/app/home/wicket:interface.....

so the js to embed did not work
swfobject.embedSWF('resources/com.company.charts.ForceChartResource/ofc/resr/open-flash-chart.swf','chart8', '100%', '200', '9.0.0', 'expressInstall.swf', {'data-file':'http://127.0.0.1:8080/erp/app/home/wicket:interface/:3:dashboard:layout:lcontent-list:3:lcss-cntr:lcontent:dsb-content:chart::IResourceListener::'}, {} );


RequestUtils.toAbsolutePath is not working as expected ? Any clue ?


DEBUG MESSAGES FROM LOG
-----------------------------------
data path >> home/wicket:interface/:3:dashboard:layout:lcontent-list:3:lcss-cntr:lcontent:dsb-content:chart::IResourceListener::
req.getRequestURI /erp/app/home
req.getRequestURL http://127.0.0.1:8080/erp/app/home
req.getContextPath /erp
req.getPathInfo /home
req.getPathTranslated /home/ec2-user/server/apache-tomcat-7.0.8/webapps/erp/home
req.getServletPath /app
req.getRemoteHost 127.0.0.1
req.getRemotePort 33230
req.getLocalName() localhost

----



Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Martin Grigorov-4
On Wed, Nov 30, 2011 at 2:31 PM, nazeem <[hidden email]> wrote:

> Thanks Vineet, I managed to change WebResource to ByteArrayResource.
>
> But I am stuck with a problem in the url for json constructed.
>
> CharSequence dataPath = RequestCycle.get().urlFor(OpenFlashChart.this,
> IResourceListener.INTERFACE);
> String url =  RequestUtils.toAbsolutePath(dataPath.toString());
>
> When i deploy to my server and access it using the ip address, the json data
> url was still referring to
> http://127.0.0.1:8080/erp/app/home/wicket:interface.....

wicket:interface is only in Wicket 1.4
Wicket 1.5 wont construct url with this parameter.

>
> so the js to embed did not work
> swfobject.embedSWF('resources/com.company.charts.ForceChartResource/ofc/resr/open-flash-chart.swf','chart8',
> '100%', '200', '9.0.0', 'expressInstall.swf',
> {'data-file':'http://127.0.0.1:8080/erp/app/home/wicket:interface/:3:dashboard:layout:lcontent-list:3:lcss-cntr:lcontent:dsb-content:chart::IResourceListener::'},
> {} );
>
>
> RequestUtils.toAbsolutePath is not working as expected ? Any clue ?
>
>
> DEBUG MESSAGES FROM LOG
> -----------------------------------
> data path >>
> home/wicket:interface/:3:dashboard:layout:lcontent-list:3:lcss-cntr:lcontent:dsb-content:chart::IResourceListener::
> req.getRequestURI /erp/app/home
> req.getRequestURL http://127.0.0.1:8080/erp/app/home
> req.getContextPath /erp
> req.getPathInfo /home
> req.getPathTranslated
> /home/ec2-user/server/apache-tomcat-7.0.8/webapps/erp/home
> req.getServletPath /app
> req.getRemoteHost 127.0.0.1
> req.getRemotePort 33230
> req.getLocalName() localhost
>
> ----
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WebResource-in-Wicket-1-5-tp4106181p4122979.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

nazeem
Yes, I am not yet thru with my wicket 1.5 migration. so was changing my 1.4 version and testing the same.

I think its some thing to do with apache proxy. If i directly access the <ipaddress>:8080/erp it works but when i access thru the apache <ipaddress>/erp i face this problem.

my apache config
-----------------
ProxyPass /erp http://127.0.0.1:8080/erp
ProxyPassReverse /erp http://127.0.0.1:8080/erp
Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Decebal Suiu
In reply to this post by nazeem
Hi

I have the same problem. I changed WebResource to ByteArrayResource but I don't know how I can migrate the following lines:

public void onResourceRequested() {
        createJsonResource();
        // TODO wicket 1.5
// jsonResource.onResourceRequested();
}
No method onResourceRequested() in ByteArrayResource.


// CharSequence dataPath = RequestCycle.get().urlFor(OpenFlashChart.this, IResourceListener.INTERFACE);
CharSequence dataPath = RequestCycle.get().urlFor(new ComponentRenderingRequestHandler(this));
System.out.println("*** " + dataPath);

datePath is null after migration to wicket 1.5


Best regards,
Decebal
Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Martin Grigorov-4
ByteArrayResource resource = ...
path = urlFor(new ResourceRequestHandler(resource))

On Fri, Mar 23, 2012 at 3:45 PM, Decebal Suiu <[hidden email]> wrote:

> Hi
>
> I have the same problem. I changed WebResource to ByteArrayResource but I
> don't know how I can migrate the following lines:
>
> public void onResourceRequested() {
>        createJsonResource();
>        // TODO wicket 1.5
> //      jsonResource.onResourceRequested();
> }
> No method onResourceRequested() in ByteArrayResource.
>
>
> // CharSequence dataPath = RequestCycle.get().urlFor(OpenFlashChart.this,
> IResourceListener.INTERFACE);
> CharSequence dataPath = RequestCycle.get().urlFor(new
> ComponentRenderingRequestHandler(this));
> System.out.println("*** " + dataPath);
>
> datePath is null after migration to wicket 1.5
>
>
> Best regards,
> Decebal
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WebResource-in-Wicket-1-5-tp4106181p4498851.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Decebal Suiu
Thanks Martin for the your prompt response.

In constructor of OpenFlashChart I have these lines:
 
jsonResource = new ByteArrayResource("text/plain", getJsonData().getBytes());
CharSequence dataPath = urlFor(new ResourceRequestHandler(jsonResource, null));
System.out.println("*** " + dataPath);

dataPath is null

the wicket version is 1.5.4

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Martin Grigorov-4
Right. This will work only for static resources. Sorry.

ResourceReference ref = new ResourceReference("jsonRes") { public
IResource getResource() {return resource;} }
urlFor(new ResourceReferenceHandler(reference))

On Fri, Mar 23, 2012 at 4:29 PM, Decebal Suiu <[hidden email]> wrote:

> Thanks Martin for the your prompt response.
>
> In constructor of OpenFlashChart I have these lines:
>
> jsonResource = new ByteArrayResource("text/plain",
> getJsonData().getBytes());
> CharSequence dataPath = urlFor(new ResourceRequestHandler(jsonResource,
> null));
> System.out.println("*** " + dataPath);
>
> dataPath is null
>
> the wicket version is 1.5.4
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WebResource-in-Wicket-1-5-tp4106181p4499017.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Decebal Suiu
Works but I have a question:
The json data path is wicket/resource/org.apache.wicket.Application/jsonRes and I think that if I have many charts on the same page (my case), each chart with another json data, on your solution I am in treble. Right?

Best regards,
Decebal
Reply | Threaded
Open this post in threaded view
|

Re: WebResource in Wicket 1.5

Martin Grigorov-4
you can give different names (constructor parameter) for the ResourceReference's

On Fri, Mar 23, 2012 at 5:12 PM, Decebal Suiu <[hidden email]> wrote:

> Works but I have a question:
> The json data path is wicket/resource/org.apache.wicket.Application/jsonRes
> and I think that if I have many charts on the same page (my case), each
> chart with another json data, on your solution I am in treble. Right?
>
> Best regards,
> Decebal
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WebResource-in-Wicket-1-5-tp4106181p4499129.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]