org.apache.cocoon.portal.impl
Class DefaultLinkService

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

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

Version:
$Id: DefaultLinkService.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler, Volker Schmitt

Nested Class Summary
 
Nested classes/interfaces inherited from interface 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  Boolean eventsMarshalled
           
protected  ServiceManager manager
          The service manager
 
Fields inherited from interface org.apache.cocoon.portal.LinkService
DEFAULT_CONVERTABLE_EVENT_PARAMETER_NAME, 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.
 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
protected  String initBuffer(LinkInfo info, Event event, Boolean secure)
           
protected  String initBuffer(LinkInfo info, List events, Boolean secure)
           
 boolean isSecure()
          Determine whether the current url is using a secure protocol
 void parameterize(Parameters params)
           
protected  String processEvent(Event event, StringBuffer value)
           
 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


eventsMarshalled

protected Boolean eventsMarshalled

defaultPort

protected int defaultPort
Default port used for http.


defaultSecurePort

protected int defaultSecurePort
Default port used for https.

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)

initBuffer

protected String initBuffer(LinkInfo info,
                            Event event,
                            Boolean secure)

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)

initBuffer

protected String initBuffer(LinkInfo info,
                            List events,
                            Boolean secure)

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)

processEvent

protected String processEvent(Event event,
                              StringBuffer value)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.