[opencms-dev] need help getting my launcherClass invoked

Steve Mato smato at icc.net
Wed Aug 25 15:53:48 CEST 2004


Not extend A_CmsLauncher?  I wrote a class that's named such:

public class CmsRedirectLauncher extends A_CmsLauncher {
...
}

I'm glad to hear someone's written a book.  I'll be sure to pick it up.  ...no B&N or other close to work unfortunatly. ;> 

-steve


At 09:35 AM 8/25/2004 +0200, Vincent Hanniet wrote:
>Hi,
>You probably need to create a custom launcher and associate your custom 
>resource type to the new launcherType in the registry.
>Matt Butcher describes how to do in his book. Basically you have to 
>implement I_CmsLauncher.
>HTH
>Vincent
>
>Steve Mato wrote:
>
>>Hello all.  My first post to this list.  
>>
>>I read all the correspondence on adding a new Resource Type and got that to work.  Thank you all.  Turns out I don't need a custom Resource page though (I don't think...  I might if I extend the Launcher class to do more so will need additional fields).
>>
>>However what I determined I need, and what I'm not getting to work is invoking my own Launcher class for my new Resource.
>>
>>Quick background:  Looking at the Laucher class code I saw the reason a link was "impersonating" a destination resource and not redirecting to it was the logic looks at whether the URI starts with "/", and if it does it renders the resource, else it redirects to it.  (problem is you lose the custom properties as well as proper URL path of the destination, if needed, if the resource isn't redirected to).  
>>
>>What I =need= is it always redirect to it.  A "fix" I realized after looking @ the source is after browsing to the link destination, replace your root site's name with "../" (assumption is the links will/are always one directory deep under the root ... add "../" instances as needed).  The workplace dialog posts an error as it "can't find it", but it lets you continue.  End result is the page is indeed redirected to and custom properties added to the resource to alter functionality works.  Problem though is it's not as user friendly as I need for my content creators; and you =know= they're going to forget to replace the "/root_name/" with "../"!
>>
>>....So...
>>
>>I created the pages I need in 
>>/system/workplace/action
>>/system/workplace/restype
>>/system/workplace/templates
>>
>>and edited explorer_files_new under templates to add my resource.
>>the resource name in restype is "redirect".
>>
>>Basically, all resources are a copy of the Link resources; named as redirect or with redirect replacing "link" in the name.  The appropriate changes to the variables were made to the restype file.
>>
>>In the config/registry.xml file I added :
>><restype>
>>  <name>redirect</name>
>>  <launcherType>4</launcherType>
>>  <launcherClass>com.opencms.launcher.CmsRedirectLauncher</launcherClass>
>>  <resourceClass>com.opencms.file.CmsResourceTypeLink</resourceClass>
>></restype>
>>
>>...after the other restype definitions (so everything doesn't become a Link in the workplace; yep I saw that too)
>>
>>Restart the Server.  Create a new "Redirect" resource.  Test it out ...and... it still acts as "link", where a URL starting with "/" copies the destination page's contents keeping the link's URL, instead of redirecting to it.
>>
>>So, my "assumption" that having a resource named "redirect" under /system/workplace/restype, and the "redirect" entry in registry.xml was that "connection" between the two that related to the system which Launcher class to use, was wrong.   Turns out by testing it isn't, and thus my launcherClass is not being invoked.
>>
>>...So, can someone help me with what I'm missing, and how I get my "redirect" resource to use my redirection Launcher class?
>>
>>[worse comes to worse, I'm going to modify the CmsLinkLauncher class and get rid of the offending "if" that causes this behavior of copying the contents of the destination instead of redirecting to it]
>>
>>Thanx for your time,
>>Steve Mato
>>
>>
>>
>>_______________________________________________
>>This mail is send to you from the opencms-dev mailing list
>>To change your list options, or to unsubscribe from the list, please visit
>>http://mail.opencms.org/mailman/listinfo/opencms-dev
>>
>>
>>  
>>
>
>
>
>_______________________________________________
>This mail is send to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://mail.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list