Liferay 7.0-ce-m3

com.liferay.portal.tools.sourceformatter
Class JSPSourceProcessor

java.lang.Object
  extended by com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
      extended by com.liferay.portal.tools.sourceformatter.JSPSourceProcessor
All Implemented Interfaces:
SourceProcessor

public class JSPSourceProcessor
extends BaseSourceProcessor


Field Summary
 
Fields inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
attributeNamePattern, BASEDIR, emptyCollectionPattern, fileUtil, languageKeyPattern, portalSource, saxReaderUtil, sessionKeyPattern, sourceFormatterHelper, taglibSessionKeyPattern
 
Constructor Summary
JSPSourceProcessor()
           
 
Method Summary
protected  void addImportCounts(String content)
           
protected  void addJSPIncludeFileNames(String fileName)
           
protected  void addJSPReferenceFileNames(String fileName)
           
protected  void addJSPUnusedImports(String fileName, List<String> importLines, List<String> unneededImports)
           
protected  String buildFullPathIncludeFileName(String fileName, String includeFileName)
           
protected  boolean checkTaglibVulnerability(String jspContent, String vulnerability)
           
protected  void checkXSS(String fileName, String jspContent)
           
protected  String doFormat(File file, String fileName, String absolutePath, String content)
           
protected  String fixRedirectBackURL(String content)
           
protected  void format()
           
protected  String formatJSP(String fileName, String absolutePath, String content)
           
protected  String formatTagAttributeType(String line, String tag, String attributeAndValue)
           
protected  String formatTaglibQuotes(String fileName, String content, String quoteType)
           
protected  List<String> getJSPDuplicateImports(String fileName, String content, List<String> importLines)
           
protected  Set<String> getPrimitiveTagAttributeDataTypes()
           
protected  com.thoughtworks.qdox.model.JavaClass getTagJavaClass(String tag)
           
protected  String getTaglibRegex(String quoteType)
           
protected  String getUtilTaglibDirName()
           
protected  String getVariableName(String line)
           
protected  boolean hasUnusedJSPTerm(String fileName, String regex, String type)
           
protected  boolean hasUnusedTaglib(String fileName, String line)
           
protected  boolean hasUnusedVariable(String fileName, String line)
           
protected  boolean isJSPDuplicateImport(String fileName, String importLine, boolean checkFile)
           
protected  boolean isJSPTermRequired(String fileName, String regex, String type, Set<String> checkedForUnusedJSPTerm)
           
protected  boolean isValidTagAttributeValue(String value, String dataType)
           
protected  void moveFrequentlyUsedImportsToCommonInit(int minCount)
           
protected  String stripJSPImports(String fileName, String content)
           
 
Methods inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
checkEmptyCollection, checkIfClauseParentheses, checkInefficientStringMethods, checkLanguageKeys, checkStringBundler, fixCompatClassImports, fixCopyright, fixIncorrectParameterTypeForLanguageUtil, fixSessionKey, format, format, format, format, formatJavaTerms, getAbsolutePath, getAnnotationsExclusions, getCompatClassNamesMap, getContent, getCustomCopyright, getErrorMessages, getFile, getFileNames, getFileNames, getFirstSourceMismatchException, getImmutableFieldTypes, getLanguageKeys, getLanguageProperties, getMainReleaseVersion, getProperty, getPropertyList, hasMissingParentheses, hasRedundantParentheses, hasRedundantParentheses, isAttributName, isExcluded, isExcluded, isExcluded, isRunsOutsidePortal, processErrorMessage, processFormattedFile, replacePrimitiveWrapperInstantiation, sortAttributes, stripLine, stripQuotes, stripRedundantParentheses, trimContent, trimLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSPSourceProcessor

public JSPSourceProcessor()
Method Detail

addImportCounts

protected void addImportCounts(String content)

addJSPIncludeFileNames

protected void addJSPIncludeFileNames(String fileName)

addJSPReferenceFileNames

protected void addJSPReferenceFileNames(String fileName)

addJSPUnusedImports

protected void addJSPUnusedImports(String fileName,
                                   List<String> importLines,
                                   List<String> unneededImports)

buildFullPathIncludeFileName

protected String buildFullPathIncludeFileName(String fileName,
                                              String includeFileName)

checkTaglibVulnerability

protected boolean checkTaglibVulnerability(String jspContent,
                                           String vulnerability)

checkXSS

protected void checkXSS(String fileName,
                        String jspContent)

doFormat

protected String doFormat(File file,
                          String fileName,
                          String absolutePath,
                          String content)
                   throws Exception
Specified by:
doFormat in class BaseSourceProcessor
Throws:
Exception

fixRedirectBackURL

protected String fixRedirectBackURL(String content)

format

protected void format()
               throws Exception
Specified by:
format in class BaseSourceProcessor
Throws:
Exception

formatJSP

protected String formatJSP(String fileName,
                           String absolutePath,
                           String content)
                    throws Exception
Throws:
Exception

formatTagAttributeType

protected String formatTagAttributeType(String line,
                                        String tag,
                                        String attributeAndValue)
                                 throws Exception
Overrides:
formatTagAttributeType in class BaseSourceProcessor
Throws:
Exception

formatTaglibQuotes

protected String formatTaglibQuotes(String fileName,
                                    String content,
                                    String quoteType)

getJSPDuplicateImports

protected List<String> getJSPDuplicateImports(String fileName,
                                              String content,
                                              List<String> importLines)

getPrimitiveTagAttributeDataTypes

protected Set<String> getPrimitiveTagAttributeDataTypes()

getTagJavaClass

protected com.thoughtworks.qdox.model.JavaClass getTagJavaClass(String tag)
                                                         throws Exception
Throws:
Exception

getTaglibRegex

protected String getTaglibRegex(String quoteType)

getUtilTaglibDirName

protected String getUtilTaglibDirName()

getVariableName

protected String getVariableName(String line)

hasUnusedJSPTerm

protected boolean hasUnusedJSPTerm(String fileName,
                                   String regex,
                                   String type)

hasUnusedTaglib

protected boolean hasUnusedTaglib(String fileName,
                                  String line)

hasUnusedVariable

protected boolean hasUnusedVariable(String fileName,
                                    String line)

isJSPDuplicateImport

protected boolean isJSPDuplicateImport(String fileName,
                                       String importLine,
                                       boolean checkFile)

isJSPTermRequired

protected boolean isJSPTermRequired(String fileName,
                                    String regex,
                                    String type,
                                    Set<String> checkedForUnusedJSPTerm)

isValidTagAttributeValue

protected boolean isValidTagAttributeValue(String value,
                                           String dataType)

moveFrequentlyUsedImportsToCommonInit

protected void moveFrequentlyUsedImportsToCommonInit(int minCount)
                                              throws IOException
Throws:
IOException

stripJSPImports

protected String stripJSPImports(String fileName,
                                 String content)
                          throws IOException
Throws:
IOException

Liferay 7.0-ce-m3