You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Woonsan Ko (JIRA)" <je...@portals.apache.org> on 2011/02/03 00:54:29 UTC
[jira] Commented: (JS2-1238) Pipeline mapper needed to find mapping
path by a pipeline name
[ https://issues.apache.org/jira/browse/JS2-1238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989903#comment-12989903 ]
Woonsan Ko commented on JS2-1238:
---------------------------------
In configurations we already use pipeline bean IDs instead of their names. So, I'll keep those as it is.
I've committed my patch, the interface looks like this:
- Pipeline getPipelineByMappedPath(String mappedPath);
- Pipeline getPipelineById(String id);
- String getMappedPathByPipelineId(String pipelineId);
- String [] getMappedPathsByPipelineId(String pipelineId);
So, for example, if a site has a custom filter which is responsible for forwarding to one of portal pipelines, it can now use PipelineMapper to find physical servlet mapping paths instead of hard-coded paths.
Here's an example code:
import org.apache.jetspeed.engine.JetspeedEngineConstants;
import org.apache.jetspeed.pipeline.PipelineMapper;
PipelineMapper mapper = (PipelineMapper) Jetspeed.getComponentManager().getComponent("pipeline-mapper");
String defaultPipelineId = Jetspeed.getConfiguration().getString(JetspeedEngineConstants.PIPELINE_DEFAULT);
//defaultPipelineId = "jetui-pipeline";
String pipelinePath = mapper.getMappedPathByPipelineId(defaultPipelineId);
servletContext.getRequestDispatcher(pipelinePath + "/default-page.psml").forward(req, res);
Regards,
Woonsan
> Pipeline mapper needed to find mapping path by a pipeline name
> --------------------------------------------------------------
>
> Key: JS2-1238
> URL: https://issues.apache.org/jira/browse/JS2-1238
> Project: Jetspeed 2
> Issue Type: Improvement
> Components: Components Core
> Affects Versions: 2.2.1
> Reporter: Woonsan Ko
> Assignee: Woonsan Ko
> Priority: Minor
> Fix For: 2.2.2
>
>
> Currently we have a configuration for the default pipeline in jetspeed.properties as follows:
> pipeline.default = jetspeed-pipeline
> Also, the default pipeline name is used in JetspeedEngine to find a default pipeline component when there's no servlet path mapping is found.
> Obviously, this is a good feature because we don't have to stick to physical servlet paths.
> I think this should be extended as a separate component like PipelineMapper to allow some custom servlet filters to leverage it.
> For example, when a custom servlet filter is responsible for choosing a pipeline for the request and forwarding the request, then the servlet filter should be able to find the servlet path mapped to a pipeline because the servlet filter needs to use ServletContext.getRequestDispatcher(contextRelativePath).forward().
> Therefore, I think we can add PipelineMapper component like this:
> interface PipelineMapper {
>
> /** Finds pipeline which bean id is equals to pipelineId. */
> Pipeline getPipelineById(String pipelineId); // ex) getPipelineById("jetspeed-pipeline");
>
> /** Finds pipeline which name is equals to pipelineName. */
> Pipeline getPipelineByName(String pipelineName); // ex) getPipelineByName("JetspeedPipeline")
>
> /** Find the servlet mapping path by pipeline bean id. */
> String getPathByPipelineId(String pipelineId); // ex) getPathByPipelineId("jetspeed-pipeline");
>
> /** Find the servlet mapping path by pipeline name. */
> String getPathByPipelineName(String pipelineId); // ex) getPathByPipelineName("JetspeedPipeline");
>
> }
> FYI, personally, I think it's better to use pipeline name consistently, but it is necessary to keep operations with pipeline bean IDs for backward compatibility.
> This could modify pipelines.xml slightly by wrapping the existing 'pipeline-map' bean, and add one pair of interface/default impl.
> If there's any objection, please let me know.
> Regards,
> Woonsan
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org