public class NewsletterLocalURIResolver extends LocalURIResolver
LocalURIResolver.URIInfo
Modifier and Type | Field and Description |
---|---|
private Repository |
_repository |
static String |
NEWSLETTER_LOCAL_DATA_TYPE
resolver data type for newsletter local
|
_prefixHandler
_ametysObjectResolver, _context
Constructor and Description |
---|
NewsletterLocalURIResolver() |
Modifier and Type | Method and Description |
---|---|
protected Content |
_getContent(String id,
Request request,
Session session)
Retrieve the content, using the request attribute to avoid an additional resolve
|
private String |
_getUriPrefix(Request request,
Content content,
boolean download,
boolean absolute,
boolean internal) |
protected String |
_resolve(String uri,
boolean download,
boolean absolute,
boolean internal,
String pipeline,
String suffix)
Resolves a link URI for rendering purposes.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser. |
protected String |
_resolveImageAsBase64(String uri,
int height,
int width,
int maxHeight,
int maxWidth,
int cropHeight,
int cropWidth)
Resolve image as base 64
|
String |
getType()
Returns the type of links handled by this
URIResolver . |
String |
resolve(String uri,
boolean download,
boolean absolute,
boolean internal)
Resolves a link URI for rendering purposes.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser. |
String |
resolveBoundedImage(String uri,
int maxHeight,
int maxWidth,
boolean download,
boolean absolute,
boolean internal)
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser. |
String |
resolveBoundedImageAsBase64(String uri,
int maxHeight,
int maxWidth)
Resolve an image and return it as a base64-encoded string.
|
String |
resolveCroppedImage(String uri,
int cropHeight,
int cropWidth,
boolean download,
boolean absolute,
boolean internal)
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser. |
String |
resolveCroppedImageAsBase64(String uri,
int cropHeight,
int cropWidth)
Resolve an image and return it as a base64-encoded string.
|
String |
resolveImage(String uri,
int height,
int width,
boolean download,
boolean absolute,
boolean internal)
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser. |
String |
resolveImageAsBase64(String uri,
int height,
int width)
Resolve an image and return it as a base64-encoded string.
|
void |
service(ServiceManager manager) |
_getFile, _getMeta, checkLink, contextualize, getInfos, getLabel, getUriPrefix, resolveImageAsBase64
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public static final String NEWSLETTER_LOCAL_DATA_TYPE
private Repository _repository
public NewsletterLocalURIResolver()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class LocalURIResolver
ServiceException
public String getType()
URIResolver
URIResolver
.getType
in interface URIResolver
getType
in class LocalURIResolver
URIResolver
.public String resolve(String uri, boolean download, boolean absolute, boolean internal)
URIResolver
resolve
in interface URIResolver
resolve
in class LocalURIResolver
uri
- the link URI.download
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.public String resolveImage(String uri, int height, int width, boolean download, boolean absolute, boolean internal)
URIResolver
resolveImage
in interface URIResolver
resolveImage
in class LocalURIResolver
uri
- the link URI.height
- the height of the image.width
- the width of the imagedownload
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.public String resolveImageAsBase64(String uri, int height, int width)
URIResolver
resolveImageAsBase64
in interface URIResolver
resolveImageAsBase64
in class LocalURIResolver
uri
- the link URI.height
- the height of the image.width
- the width of the imagepublic String resolveBoundedImage(String uri, int maxHeight, int maxWidth, boolean download, boolean absolute, boolean internal)
URIResolver
resolveBoundedImage
in interface URIResolver
resolveBoundedImage
in class LocalURIResolver
uri
- the link URI.maxHeight
- the max heightmaxWidth
- the max widthdownload
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.public String resolveBoundedImageAsBase64(String uri, int maxHeight, int maxWidth)
URIResolver
resolveBoundedImageAsBase64
in interface URIResolver
resolveBoundedImageAsBase64
in class LocalURIResolver
uri
- the link URI.maxHeight
- the max heightmaxWidth
- the max widthpublic String resolveCroppedImage(String uri, int cropHeight, int cropWidth, boolean download, boolean absolute, boolean internal)
URIResolver
resolveCroppedImage
in interface URIResolver
resolveCroppedImage
in class LocalURIResolver
uri
- the link URI.cropHeight
- the crop heightcropWidth
- the crop widthdownload
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.public String resolveCroppedImageAsBase64(String uri, int cropHeight, int cropWidth)
URIResolver
resolveCroppedImageAsBase64
in interface URIResolver
resolveCroppedImageAsBase64
in class LocalURIResolver
uri
- the link URI.cropHeight
- the crop heightcropWidth
- the crop widthprotected String _resolve(String uri, boolean download, boolean absolute, boolean internal, String pipeline, String suffix)
_resolve
in class LocalURIResolver
uri
- the link URI.download
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.pipeline
- The pipeline to use to server the contentsuffix
- The suffix to add to the resolved pathprotected Content _getContent(String id, Request request, Session session) throws RepositoryException
id
- The content idrequest
- The requestsession
- The session into which the content should be retrievedRepositoryException
- If an error occurredprotected String _resolveImageAsBase64(String uri, int height, int width, int maxHeight, int maxWidth, int cropHeight, int cropWidth)
uri
- the link URI.height
- the specified height. Ignored if 0.width
- the specified width. Ignored if 0.maxHeight
- the maximum image height. Ignored if height or width is specified.maxWidth
- the maximum image width. Ignored if height or width is specified.cropHeight
- the cropping height. Ignored if 0.cropWidth
- the cropping width. Ignored if 0.private String _getUriPrefix(Request request, Content content, boolean download, boolean absolute, boolean internal)