You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by oggie <go...@gmail.com> on 2012/09/27 14:37:18 UTC
Re: Wicket 1.5 - Generic JSON Response
Ahijah wrote
>
> Martin Grigorov-4 wrote
>> On Thu, Apr 12, 2012 at 7:38 AM, Ahijah <
>> darren.greer@
>> > wrote:
>>
>> mountResource("/Feed2", new MyResourceReference());
>>
>> class MyResourceReference extends ResourceReference {
>> public IResource getResource() { return new MyResource(); }
>> }
> Thanks Martin! For everyone else's reference, the final code that is
> working looks like this:
>
> --------------Feed.class----------------
> public class Feed extends AbstractResource {
>
> private static final long serialVersionUID = 1L;
>
> protected ResourceResponse newResourceResponse(Attributes a) {
> ResourceResponse r = new ResourceResponse();
> r.setContentType("application/json");
> r.setWriteCallback(new WriteCallback() {
> public void writeData(Attributes a) {
>
> a.getResponse().write("[{\"id\":111,\"title\":\"MainEvent\",\"start\":\"2012-04-10T07:00:00\",\"end\":\"2012-04-10T09:30:00\",\"url\":\"?EventID=111\",\"allDay\":false}]");
> }
> });
> return r;
> }
>
> }
> -----------End Feed.class--------------
>
> --------------Application.class----------------
> @Override
> protected void init() {
> super.init();
> mountResource("/Feed", new FeedReference());
> }
>
> public class FeedReference extends ResourceReference {
> public FeedReference() {
> super(FeedReference.class, "feed");
> }
> public IResource getResource() { return new Feed(); }
> }
> -----------End Application.class-------------
Is there any way to tie this to the standard wicket security model? Right
now, our web pages are all annotated with @AuthorizeInstantiation("admin"),
so how would we be able to apply it to this scenario?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652432.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Generic JSON Response
Posted by Martin Grigorov <mg...@apache.org>.
There is no code in Wicket that will check for this annotation in
non-Component classes.
On Thu, Sep 27, 2012 at 4:17 PM, oggie <go...@gmail.com> wrote:
> Any suggestions on how I might roll my own? I tried a few things like
> injecting the Feed class and annotating it, but I suspect it's too late at
> that point.
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652442.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Generic JSON Response
Posted by oggie <go...@gmail.com>.
Any suggestions on how I might roll my own? I tried a few things like
injecting the Feed class and annotating it, but I suspect it's too late at
that point.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652442.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Generic JSON Response
Posted by Martin Grigorov <mg...@apache.org>.
IAuthorizationStrategy is not used for IResource at the moment.
You need to roll something yours for this check.
On Thu, Sep 27, 2012 at 3:37 PM, oggie <go...@gmail.com> wrote:
> Ahijah wrote
>>
>> Martin Grigorov-4 wrote
>>> On Thu, Apr 12, 2012 at 7:38 AM, Ahijah <
>
>>> darren.greer@
>
>>> > wrote:
>>>
>>> mountResource("/Feed2", new MyResourceReference());
>>>
>>> class MyResourceReference extends ResourceReference {
>>> public IResource getResource() { return new MyResource(); }
>>> }
>> Thanks Martin! For everyone else's reference, the final code that is
>> working looks like this:
>>
>> --------------Feed.class----------------
>> public class Feed extends AbstractResource {
>>
>> private static final long serialVersionUID = 1L;
>>
>> protected ResourceResponse newResourceResponse(Attributes a) {
>> ResourceResponse r = new ResourceResponse();
>> r.setContentType("application/json");
>> r.setWriteCallback(new WriteCallback() {
>> public void writeData(Attributes a) {
>>
>> a.getResponse().write("[{\"id\":111,\"title\":\"MainEvent\",\"start\":\"2012-04-10T07:00:00\",\"end\":\"2012-04-10T09:30:00\",\"url\":\"?EventID=111\",\"allDay\":false}]");
>> }
>> });
>> return r;
>> }
>>
>> }
>> -----------End Feed.class--------------
>>
>> --------------Application.class----------------
>> @Override
>> protected void init() {
>> super.init();
>> mountResource("/Feed", new FeedReference());
>> }
>>
>> public class FeedReference extends ResourceReference {
>> public FeedReference() {
>> super(FeedReference.class, "feed");
>> }
>> public IResource getResource() { return new Feed(); }
>> }
>> -----------End Application.class-------------
>
> Is there any way to tie this to the standard wicket security model? Right
> now, our web pages are all annotated with @AuthorizeInstantiation("admin"),
> so how would we be able to apply it to this scenario?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4652432.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org