org.apache.cocoon.portal.impl
Class DefaultLinkService

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.portal.impl.DefaultLinkService
All Implemented Interfaces:
Contextualizable, Disposable, LinkService, LogEnabled, Parameterizable, Serviceable, ThreadSafe
Direct Known Subclasses:
PageLabelLinkService

public class DefaultLinkService
extends AbstractLogEnabled
implements LinkService, ThreadSafe, Serviceable, Disposable, Contextualizable, Parameterizable

Version:
$Id: DefaultLinkService.java 328469 2005-10-25 20:18:47Z cziegeler $

Nested Class Summary
static class DefaultLinkService.ConstantParameterMatcher
           
static interface DefaultLinkService.ParameterMatcher
           
static class DefaultLinkService.PrefixParameterMatcher
           
 
Nested classes inherited from class org.apache.cocoon.portal.LinkService
LinkService.ParameterDescription
 
Field Summary
protected  Context context
          The cocoon context-
protected  EventConverter converter
          The converter used to convert an event into a request parameter.
protected  int defaultPort
          Default port used for http.
protected  int defaultSecurePort
          Default port used for https.
protected  List internalParameters
          List of internal parameters.
protected  List internalParametersMatchers
          List of matchers for internal parameters.
protected  ServiceManager manager
          The service manager.
 
Fields inherited from interface org.apache.cocoon.portal.LinkService
DEFAULT_REQUEST_EVENT_PARAMETER_NAME, ROLE
 
Constructor Summary
DefaultLinkService()
           
 
Method Summary
protected  boolean addEvent(StringBuffer buffer, Event event, boolean hasParams)
          Add one event to the buffer
 void addEventToLink(Event event)
          Add this event to the list of events contained in the uri
 void addParameterToLink(String name, String value)
          Add this parameter to every link.
 void addUniqueParameterToLink(String name, String value)
          Add this parameter to every link.
 void contextualize(Context context)
           
 void dispose()
           
 String encodeURL(String url)
           
protected  LinkInfo getInfo()
          Return the current info for the request.
 List getInternalParameterNames()
          A list of parameters that should be filtered when coplets are called.
 String getLinkURI(Event event)
          Get the uri for this coplet containing the additional event
 String getLinkURI(Event event, Boolean secure)
          Get the uri for this coplet containing the additional event and using a secure protocol if requested.
 String getLinkURI(List events)
          Get the uri for this coplet containing the additional events.
 String getLinkURI(List events, Boolean secure)
          Get a uri for this coplet containing the additional events.
 String getRefreshLinkURI()
          Get a link that simply refreshs the portal
 String getRefreshLinkURI(Boolean secure)
          Get a link that simply refreshs the portal
 boolean isInternalParameterName(String name)
          Test if the parameter is an internal one.
 boolean isSecure()
          Determine whether the current url is using a secure protocol
 void parameterize(Parameters params)
           
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converter

protected EventConverter converter
The converter used to convert an event into a request parameter.


manager

protected ServiceManager manager
The service manager.


context

protected Context context
The cocoon context-


defaultPort

protected int defaultPort
Default port used for http.


defaultSecurePort

protected int defaultSecurePort
Default port used for https.


internalParameters

protected List internalParameters
List of internal parameters.


internalParametersMatchers

protected List internalParametersMatchers
List of matchers for internal parameters.

Constructor Detail

DefaultLinkService

public DefaultLinkService()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException
See Also:
Parameterizable.parameterize(org.apache.avalon.framework.parameters.Parameters)

getInfo

protected LinkInfo getInfo()
Return the current info for the request.

Returns:
A LinkInfo object.

isSecure

public boolean isSecure()
Description copied from interface: LinkService
Determine whether the current url is using a secure protocol

Specified by:
isSecure in interface LinkService
Returns:
true if the current url is using a secure protocol
See Also:
LinkService.isSecure()

encodeURL

public String encodeURL(String url)
Specified by:
encodeURL in interface LinkService
Parameters:
url - The url to encode.
Returns:
The enocoded URL.
See Also:
LinkService.encodeURL(String url)

getLinkURI

public String getLinkURI(Event event)
Description copied from interface: LinkService
Get the uri for this coplet containing the additional event

Specified by:
getLinkURI in interface LinkService
Parameters:
event - The event to add (null is also allowed for convenience)
Returns:
A URI
See Also:
LinkService.getLinkURI(org.apache.cocoon.portal.event.Event)

getLinkURI

public String getLinkURI(Event event,
                         Boolean secure)
Description copied from interface: LinkService
Get the uri for this coplet containing the additional event and using a secure protocol if requested.

Specified by:
getLinkURI in interface LinkService
Parameters:
event - The event to add (null is also allowed for convenience)
secure - true if a secure protocol is required, false otherwise.
Returns:
A URI
See Also:
LinkService.getLinkURI(org.apache.cocoon.portal.event.Event, Boolean)

addEvent

protected boolean addEvent(StringBuffer buffer,
                           Event event,
                           boolean hasParams)
Add one event to the buffer

Returns:
Returns true, if the link contains a parameter

getLinkURI

public String getLinkURI(List events)
Description copied from interface: LinkService
Get the uri for this coplet containing the additional events.

Specified by:
getLinkURI in interface LinkService
Parameters:
events - The events to add: These can either be Events or LinkService.ParameterDescriptions.
Returns:
A URI
See Also:
LinkService.getLinkURI(java.util.List)

getLinkURI

public String getLinkURI(List events,
                         Boolean secure)
Description copied from interface: LinkService
Get a uri for this coplet containing the additional events. Use a secure protocol if requested.

Specified by:
getLinkURI in interface LinkService
Parameters:
events - The events to add: These can either be Events or LinkService.ParameterDescriptions.
secure - true if a secure protocol is required, false otherwise.
Returns:
A URI
See Also:
LinkService.getLinkURI(java.util.List)

addEventToLink

public void addEventToLink(Event event)
Description copied from interface: LinkService
Add this event to the list of events contained in the uri

Specified by:
addEventToLink in interface LinkService
Parameters:
event - Event to add
See Also:
LinkService.addEventToLink(org.apache.cocoon.portal.event.Event)

addParameterToLink

public void addParameterToLink(String name,
                               String value)
Description copied from interface: LinkService
Add this parameter to every link. If the link already contains a parameter with this name, then the link will have both parameters with the same name, but different values.

Specified by:
addParameterToLink in interface LinkService
Parameters:
name - The request parameter name
value - The value for the parameter
See Also:
LinkService.addParameterToLink(java.lang.String, java.lang.String)

addUniqueParameterToLink

public void addUniqueParameterToLink(String name,
                                     String value)
Description copied from interface: LinkService
Add this parameter to every link. If the link already contains a parameter with this name, then this old parameter will be removed and replaced by the new one.

Specified by:
addUniqueParameterToLink in interface LinkService
Parameters:
name - The request parameter name
value - The value for the parameter
See Also:
LinkService.addUniqueParameterToLink(java.lang.String, java.lang.String)

getRefreshLinkURI

public String getRefreshLinkURI()
Description copied from interface: LinkService
Get a link that simply refreshs the portal

Specified by:
getRefreshLinkURI in interface LinkService
Returns:
A URI
See Also:
LinkService.getRefreshLinkURI()

getRefreshLinkURI

public String getRefreshLinkURI(Boolean secure)
Description copied from interface: LinkService
Get a link that simply refreshs the portal

Specified by:
getRefreshLinkURI in interface LinkService
Parameters:
secure - true if a secure protocol is required, false otherwise.
Returns:
A URI
See Also:
LinkService.getRefreshLinkURI(java.lang.Boolean)

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException
See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)

getInternalParameterNames

public List getInternalParameterNames()
Description copied from interface: LinkService
A list of parameters that should be filtered when coplets are called. The list might consist of either a parameter name (string) or a prefix (string). A prefix ends with a '*'.

Specified by:
getInternalParameterNames in interface LinkService
Returns:
A list of strings. This method always returns a list.
See Also:
LinkService.getInternalParameterNames()

isInternalParameterName

public boolean isInternalParameterName(String name)
Description copied from interface: LinkService
Test if the parameter is an internal one.

Specified by:
isInternalParameterName in interface LinkService
See Also:
LinkService.isInternalParameterName(java.lang.String)


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.