incubator-jspwiki-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Mohrmann <mohrm...@mail.upb.de>
Subject Re: Call Plugin via Link
Date Mon, 29 Sep 2008 08:12:20 GMT
Hi,

first of all thx for your support.
I can now say more precisely what seems to be the bug.

If I add my plugin on the Main site and call the following URL 
"http://localhost:8080/JSPWiki/?wid=123" everything works quite well.
But in links like 
"http://localhost:8080/JSPWiki/Wiki.jsp?page=WIDRequestDetailsHeadLess?wid=123" 
the "?" is just not read.
It makes no difference if the link is 
"http://localhost:8080/JSPWiki/Wiki.jsp?page=WIDRequestDetailsHeadLess?wid=123" 
or 
"http://localhost:8080/JSPWiki/Wiki.jsp?page=WIDRequestDetailsHeadLess???????wid=123".
JSPWiki always tries to create the new page 
"WIDRequestDetailsHeadLessWid=123".

As a result it seems as if the "?" is not transmitted or read when I use 
links which contain the "Wiki.jsp?page" construct.
How can I change this?

Best regards
Benedikt


Janne Jalkanen schrieb:
>
> Either use a direct http link, or define an interwiki link for http:, 
> which allows you to use a http: shortcut (which I think has been done 
> below).
>
> That is,
>
> jspwiki.interWikiRef.http = http://%s
>
> /Janne
>
> On 28 Sep 2008, at 18:57, Benedikt Mohrmann wrote:
>
>> Hi,
>>
>> I am still trying to call a plugin via a link!
>> I already created a page called "WIDRequestDetailsHeadLess".
>> Now I created a link 
>> "http://localhost:8080/JSPWiki/Wiki.jsp?page=WIDRequestDetailsHeadLess?wid=123".

>>
>> As you can see, this is a link to the created page with a http 
>> parameter!
>>
>> But JSPWiki always tries to create a new page called 
>> "WIDRequestDetailsHeadLessWid=123".
>>
>> Any hints about that?
>>
>> Have a nice weekend
>> Benedikt
>>
>>
>> Louis.Masters@log-net.com schrieb:
>>> Sorry for the slow response.
>>>
>>> If you could, send me your wiki pages from steps 1 and 2.  I'll plug 
>>> them into my site and see what happens.
>>>
>>> -Lou
>>>
>>>
>>> Benedikt Mohrmann <mohrmann@mail.upb.de> wrote on 09/24/2008 
>>> 08:52:01 AM:
>>>
>>>
>>>> Hi,
>>>>
>>>> hmmm, seems a little more clear, but so far I couldn`t make it.
>>>>
>>>> Here is what I have done:
>>>> 1. Created a new page called "WIDRequestDetailsHeadLess" with the 
>>>> only content "[{'MyTest'}]"  (where MyTest is my Plugin).
>>>>
>>>> 2. Created a link with the target 
>>>> "[http:WIDRequestDetailsHeadLess?wid=123]" on another page.
>>>>
>>>> 3. My Plugin Code:
>>>> public class MyTest implements WikiPlugin {
>>>>
>>>>     public String execute(WikiContext context, Map params)
>>>>             throws PluginException {
>>>>
>>>>         String wid = context.getHttpParameter("wid");
>>>>         if("123"==wid){
>>>>             return "Runs";
>>>>         }
>>>>         else return "Runs not";
>>>>     }
>>>> }
>>>>
>>>> The problem is that when I click on the link, the Wiki wants to 
>>>> create a
>>>
>>>
>>>> new page called "WIDRequestDetailsHeadLess?wid=123".
>>>>
>>>> Regards
>>>>
>>>>
>>>> Louis.Masters@log-net.com schrieb:
>>>>
>>>>> Yes, now that I look at my previous post, it would be nice of me 
>>>>> to explain it.
>>>>>
>>>>> OK, so I had the same question you had - I created a plugin and 
>>>>> put it
>>> on
>>>>> a page, but I needed to pass in a variable before it ran.  The 
>>>>> trouble
>>> is,
>>>>> once you invoke the page, the plugin runs immediately and does not
>>> give
>>>>> you a chance to pass anything in.  So I posted to this group and 
>>>>> was tipped to use a HTTP parm and then read it from the plugin 
>>>>> when the
>>> page
>>>>> opens.  So, to clarify, here is what happens...
>>>>>
>>>>> 1.  The link is clicked with a HTTP parm in the URL:
>>>>>
>>>>> [http:WIDRequestDetailsHeadLess?wid=40803]
>>>>>
>>>>> 2.  The "WIDRequestDetailsHeadLess" is simply a page that invokes 
>>>>> the plugin:
>>>>>
>>>>> [{'WallyWIDDetailsPlugin'}]
>>>>> (This is the entire page!)
>>>>>
>>>>> 3.  Here is the "trick"... At the beginning of the plugin is the
>>> following
>>>>> code:
>>>>>
>>>>>                 wid = c.getHttpParameter("wid");
>>>>>
>>>>>                 if(wid == null)
>>>>>                 {
>>>>>                         value = params.get("wid");
>>>>>                         if (value == 
>>>>> null||((String)value).equals(""))
>>> {
>>>
>>>>>                                 gotError = true;
>>>>>                         }
>>>>>                         else
>>>>>                         {
>>>>>                                 wid = (String)value;
>>>>>                         }
>>>>>                 }
>>>>>
>>>>> This block of code makes it available to be used from a link and from
>>> a
>>>>> form.  The getHttpParameter call uses the parm from the URL while 
>>>>> the params.get looks for a "wid" parm from the form.
>>>>>
>>>>> A little more clear?
>>>>>
>>>>> -Lou
>>>>>
>>>>>
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> LOG-NET, Inc.
>>>>> The Logistics Network Management System
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> 230 Half Mile Road
>>>>> Third Floor
>>>>> Red Bank, NJ 07701
>>>>> PH: 732-758-6800
>>>>> FAX: 732-747-7497
>>>>> http://www.LOG-NET.com
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> CONFIDENTIAL & PRIVILEGED
>>>>> Unless otherwise indicated or if obvious from the nature of the
>>> content,
>>>>> the information contained herein is privileged and confidential 
>>>>> information/work product. The communication is intended for the 
>>>>> use of
>>> the
>>>>> individual or entity named above.  If the reader of this transmission
>>> is
>>>>> not the intended recipient, you are  hereby notified that any 
>>>>> dissemination, distribution or copying of this communication is
>>> strictly
>>>>> prohibited.  If you have received this communication in error, 
>>>>> please notify the sender immediately by telephone (732-758-6800) 
>>>>> or by
>>> electronic
>>>>> mail (postmaster@LOG-NET.com), and destroy any copies, electronic,
>>> paper
>>>>> or otherwise, which you may have of this communication.  Thank you.
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>
>>>>>
>>>>>
>>>>> Benedikt Mohrmann <mohrmann@mail.upb.de> 09/23/2008 10:59 AM
>>>>> Please respond to
>>>>> jspwiki-user@incubator.apache.org
>>>>>
>>>>>
>>>>> To
>>>>> jspwiki-user@incubator.apache.org
>>>>> cc
>>>>>
>>>>> Subject
>>>>> Re: Call Plugin via Link
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> first of all, thanks for the snip (it was the post I meant).
>>>>> But to be honest, I do not get the trick behind this.
>>>>> It would be very helpful, if you would send me a larger snip or 
>>>>> some explainations (if possible).
>>>>>
>>>>> Thanks a lot
>>>>>
>>>>>
>>>>> Louis.Masters@log-net.com schrieb:
>>>>>
>>>>>
>>>>>> I posted the solution to this back in june, but here is a snip:
>>>>>>
>>>>>>
>>>>>> OK, I may have worked out how to do this.  I created another page
>>> that
>>>
>>>>>> invokes the plugin without the form (basically when the page is
>>>>>>
>>>>> rendered).
>>>>>
>>>>>
>>>>>> I added some code to the beginning of the plugin (thanks to a FAQ
>>> tip)
>>>>>> that
>>>>>> looks for a HTTP parm like so:
>>>>>>
>>>>>> wid = c.getHttpParameter("wid");
>>>>>>
>>>>>> When I am linking to the page and I need to pass the wid, I use a
>>> link
>>>>>> like
>>>>>> so:
>>>>>>
>>>>>> [http:WIDRequestDetailsHeadLess?wid=40803]
>>>>>>
>>>>>> Or
>>>>>>
>>>>>> <a href=WIDRequestDetailsHeadLess?wid=39701>39701</a>
>>>>>>
>>>>>> And it works great.
>>>>>>
>>>>>>
>>>>>> Let me know if this is unclear.
>>>>>>
>>>>>> -Lou
>>>>>>
>>>>>>
>>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>> LOG-NET, Inc.
>>>>>> The Logistics Network Management System
>>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>> 230 Half Mile Road
>>>>>> Third Floor
>>>>>> Red Bank, NJ 07701
>>>>>> PH: 732-758-6800
>>>>>> FAX: 732-747-7497
>>>>>> http://www.LOG-NET.com
>>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>> CONFIDENTIAL & PRIVILEGED
>>>>>> Unless otherwise indicated or if obvious from the nature of the
>>> content,
>>>>>
>>>>>> the information contained herein is privileged and confidential 
>>>>>> information/work product. The communication is intended for the use
>>> of
>>>>> the
>>>>>
>>>>>> individual or entity named above.  If the reader of this 
>>>>>> transmission
>>> is
>>>>>
>>>>>> not the intended recipient, you are  hereby notified that any 
>>>>>> dissemination, distribution or copying of this communication is
>>> strictly
>>>>>
>>>>>> prohibited.  If you have received this communication in error, 
>>>>>> please
>>>
>>>
>>>>>> notify the sender immediately by telephone (732-758-6800) or by
>>>>>>
>>>>> electronic
>>>>>
>>>>>> mail (postmaster@LOG-NET.com), and destroy any copies, electronic,
>>> paper
>>>>>
>>>>>> or otherwise, which you may have of this communication.  Thank you.
>>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
>>>>>>
>>>>>>
>>>>>> Benedikt Mohrmann <mohrmann@mail.upb.de> 09/23/2008 10:25 AM
>>>>>> Please respond to
>>>>>> jspwiki-user@incubator.apache.org
>>>>>>
>>>>>>
>>>>>> To
>>>>>> jspwiki-user@incubator.apache.org
>>>>>> cc
>>>>>>
>>>>>> Subject
>>>>>> Call Plugin via Link
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> is it possible to call a self-written plugin via a link?
>>>>>> So when you click on the link, the plugin is started and returns

>>>>>> its output.
>>>>>> I thought I already found an option on the homepage, but today I
>>> wasn't
>>>>>> able to get it again.
>>>>>>
>>>>>> Best regards
>>>>>> Benedikt
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>


Mime
View raw message