@Component @Named(value="skin") @Singleton public class SkinAction extends XWikiAction
Action for serving skin files. It allows skins to be defined using XDocuments as skins, by letting files be placed as text fields in an XWiki.XWikiSkins object, or as attachments to the document, or as a file in the filesystem. If the file is not found in the current skin, then it is searched in its base skin, and eventually in the default base skins,
This action indicates that the results should be publicly cacheable for 30 days.
ACTION_PROGRESS, componentDescriptor, container, execution, handleRedirectObject, observation, waitForXWikiInitialization
Constructor and Description |
---|
SkinAction() |
Modifier and Type | Method and Description |
---|---|
String |
getResourceFilePath(String filename)
Get the path for the given file in resources.
|
String |
getSkinFilePath(String filename,
String skin)
Get the path for the given skin file in the given skin.
|
boolean |
isCssMimeType(String mimetype)
Checks if a mimetype indicates a CSS file.
|
boolean |
isJavascriptMimeType(String mimetype)
Checks if a mimetype indicates a javascript file.
|
String |
render(String path,
XWikiContext context) |
String |
render(XWikiContext context) |
boolean |
renderFileFromAttachment(String filename,
XWikiDocument doc,
XWikiContext context)
Tries to serve the content of an attachment as a skin file.
|
boolean |
renderFileFromObjectField(String filename,
XWikiDocument doc,
XWikiContext context)
Tries to serve the content of an XWikiSkins object field as a skin file.
|
protected void |
setupHeaders(XWikiResponse response,
String mimetype,
Date lastChanged,
int length)
Deprecated.
since 11.10RC1, use
setupHeaders(XWikiResponse, String, Date, long) instead |
protected void |
setupHeaders(XWikiResponse response,
String mimetype,
Date lastChanged,
long length)
Sets several headers to properly identify the response.
|
action, answerJSON, cleanupComponents, csrfTokenCheck, csrfTokenCheck, execute, execute, getContextualAuthorizationManager, getCurrentMixedDocumentReferenceResolver, getCurrentScriptContext, getEntityNameValidationConfiguration, getEntityNameValidationManager, getFormClass, getLocalization, getLocalSerializer, getName, getProgress, getRealPath, getTranslatedDocument, handleRedirectObject, handleRevision, initializeContainerComponent, initializeXWikiContext, initializeXWikiContext, isEntityReferenceNameValid, localizePlainOrKey, readFromTemplate, resolveTemplate, sendGlobalRedirect, sendRedirect, setContentLength, writeAjaxErrorResponse
public String render(XWikiContext context) throws XWikiException
render
in class XWikiAction
XWikiException
public String render(String path, XWikiContext context) throws XWikiException, IOException
XWikiException
IOException
public String getSkinFilePath(String filename, String skin) throws IOException
filename
- Name of the file.skin
- Name of the skin to search in.IOException
- if filename is invalidpublic String getResourceFilePath(String filename) throws IOException
filename
- Name of the file.IOException
- if filename is invalidpublic boolean renderFileFromObjectField(String filename, XWikiDocument doc, XWikiContext context) throws IOException
filename
- The name of the skin file that should be rendered.doc
- The skin document
.context
- The current request context
.IOException
- If the response cannot be sent.public boolean renderFileFromAttachment(String filename, XWikiDocument doc, XWikiContext context) throws IOException, XWikiException
filename
- The name of the skin file that should be rendered.doc
- The skin document
.context
- The current request context
.IOException
- If the response cannot be sent.XWikiException
- If the attachment cannot be loaded.public boolean isJavascriptMimeType(String mimetype)
mimetype
- The mime type to check.public boolean isCssMimeType(String mimetype)
mimetype
- The mime type to check.@Deprecated protected void setupHeaders(XWikiResponse response, String mimetype, Date lastChanged, int length)
setupHeaders(XWikiResponse, String, Date, long)
insteadresponse
- The servlet response object, where the headers should be set.mimetype
- The mimetype of the file. Used in the "Content-Type" header.lastChanged
- The date of the last change of the file. Used in the "Last-Modified" header.length
- The length of the content (in bytes). Used in the "Content-Length" header.protected void setupHeaders(XWikiResponse response, String mimetype, Date lastChanged, long length)
response
- The servlet response object, where the headers should be set.mimetype
- The mimetype of the file. Used in the "Content-Type" header.lastChanged
- The date of the last change of the file. Used in the "Last-Modified" header.length
- The length of the content (in bytes). Used in the "Content-Length" header.Copyright © 2004–2021 XWiki. All rights reserved.