001/* 002 * Copyright 2023 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.cms.transformation.xslt; 017 018import org.apache.avalon.framework.service.ServiceException; 019import org.apache.avalon.framework.service.ServiceManager; 020 021import org.ametys.cms.URIPrefixHandler; 022 023/** 024 * CMS implementation of {@link org.ametys.plugins.core.ui.user.ProfileImageResolverHelper} 025 */ 026public class ProfileImageResolverHelper extends org.ametys.plugins.core.ui.user.ProfileImageResolverHelper 027{ 028 private URIPrefixHandler _prefixHandler; 029 030 @Override 031 public void service(ServiceManager manager) throws ServiceException 032 { 033 super.service(manager); 034 _prefixHandler = (URIPrefixHandler) manager.lookup(URIPrefixHandler.ROLE); 035 } 036 037 @Override 038 protected String getUri(String path, boolean absolute, boolean internal) 039 { 040 if (internal) 041 { 042 return "cocoon:/" + path; 043 } 044 else if (absolute) 045 { 046 return _prefixHandler.getAbsoluteUriPrefix() + path; 047 } 048 else 049 { 050 return _prefixHandler.getUriPrefix() + path; 051 } 052 } 053}