CPD Results
The following document contains the results of PMD's CPD 3.9.
Duplications
| File | Line |
|---|---|
| org/apache/myfaces/webapp/filter/portlet/PortletExternalContextWrapper.java | 264 |
| org/apache/myfaces/webapp/filter/servlet/ServletExternalContextWrapper.java | 277 |
_sessionMap = new SessionMap((HttpServletRequest) _servletRequest);
}
return _sessionMap;
}
else
{
return _delegate.getSessionMap();
}
}
public Principal getUserPrincipal() {
return _delegate.getUserPrincipal();
}
public boolean isUserInRole(String role) {
return _delegate.isUserInRole(role);
}
public void log(String message) {
_delegate.log(message);
}
public void log(String message, Throwable exception) {
_delegate.log(message, exception);
}
public void redirect(String url) throws IOException {
_delegate.redirect(url);
}
//Methods since 1.2
public String getResponseContentType()
{
try
{
Method method = _delegate.getClass().getMethod(
"getResponseContentType",
null);
return (String) method.invoke(_delegate, null);
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
public void setRequest(java.lang.Object request)
{
try
{
Method method = _delegate.getClass().getMethod(
"setRequest",
new Class[]{java.lang.Object.class});
method.invoke(_delegate, new Object[]{request});
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
public void setRequestCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException{
try
{
Method method = _delegate.getClass().getMethod(
"setRequestCharacterEncoding",
new Class[]{java.lang.String.class});
method.invoke(_delegate, new Object[]{encoding});
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
public void setResponse(java.lang.Object response)
{
try
{
Method method = _delegate.getClass().getMethod(
"setResponse",
new Class[]{java.lang.Object.class});
method.invoke(_delegate, new Object[]{response});
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
public void setResponseCharacterEncoding(java.lang.String encoding)
{
try
{
Method method = _delegate.getClass().getMethod(
"setResponseCharacterEncoding",
new Class[]{java.lang.String.class});
method.invoke(_delegate, new Object[]{encoding});
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
public String getResponseCharacterEncoding()
{
try
{
Method method = _delegate.getClass().getMethod(
"getResponseCharacterEncoding",
null);
return (String) method.invoke(_delegate, null);
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("JSF 1.2 method not implemented: "+e.getMessage());
}
catch (Exception e)
{
throw new RuntimeException("Error calling JSF 1.2 method: "+e.getMessage());
}
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java | 193 |
| org/apache/myfaces/tomahawk/application/jsp/JspTilesViewHandlerImpl.java | 247 |
}
}
private static ServletMapping getServletMapping(ExternalContext externalContext)
{
String servletPath = externalContext.getRequestServletPath();
String requestPathInfo = externalContext.getRequestPathInfo();
WebXml webxml = WebXml.getWebXml(externalContext);
List mappings = webxml.getFacesServletMappings();
boolean isExtensionMapping = requestPathInfo == null;
for (int i = 0, size = mappings.size(); i < size; i++)
{
ServletMapping servletMapping = (ServletMapping) mappings.get(i);
if (servletMapping.isExtensionMapping() == isExtensionMapping)
{
String urlpattern = servletMapping.getUrlPattern();
if (isExtensionMapping)
{
String extension = urlpattern.substring(1, urlpattern.length());
if (servletPath.endsWith(extension))
{
return servletMapping;
}
}
else
{
urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
// servletPath starts with "/" except in the case where the
// request is matched with the "/*" pattern, in which case
// it is the empty string (see Servlet Sepc 2.3 SRV4.4)
if (servletPath.equals(urlpattern))
{
return servletMapping;
}
}
}
}
log.error("could not find pathMapping for servletPath = " + servletPath +
" requestPathInfo = " + requestPathInfo);
throw new IllegalArgumentException("could not find pathMapping for servletPath = " + servletPath +
" requestPathInfo = " + requestPathInfo);
}
public Locale calculateLocale(FacesContext context)
{
return _viewHandler.calculateLocale(context);
}
public String calculateRenderKitId(FacesContext context)
{
return _viewHandler.calculateRenderKitId(context);
}
public UIViewRoot createView(FacesContext context, String viewId)
{
return _viewHandler.createView(context, viewId);
}
public String getActionURL(FacesContext context, String viewId)
{
return _viewHandler.getActionURL(context, viewId);
}
public String getResourceURL(FacesContext context, String path)
{
return _viewHandler.getResourceURL(context, path);
}
public UIViewRoot restoreView(FacesContext context, String viewId)
{
return _viewHandler.restoreView(context, viewId);
}
public void writeState(FacesContext context) throws IOException
{
_viewHandler.writeState(context);
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 596 |
| org/apache/myfaces/renderkit/html/util/NonBufferingAddResource.java | 334 |
throw new IllegalStateException(e);
}
}
public String getResourceUri(FacesContext context, Class myfacesCustomComponent,
String resource, boolean withContextPath)
{
return getResourceUri(context,
new MyFacesResourceHandler(myfacesCustomComponent, resource), withContextPath);
}
public String getResourceUri(FacesContext context, Class myfacesCustomComponent, String resource)
{
return getResourceUri(context, new MyFacesResourceHandler(myfacesCustomComponent, resource));
}
/**
* Get the Path used to retrieve an resource.
*/
public String getResourceUri(FacesContext context, ResourceHandler resourceHandler)
{
String uri = resourceHandler.getResourceUri(context);
if (uri == null)
{
return getResourceUri(context, resourceHandler.getResourceLoaderClass(), true);
}
return getResourceUri(context, resourceHandler.getResourceLoaderClass(), true) + uri;
}
/**
* Get the Path used to retrieve an resource.
*/
public String getResourceUri(FacesContext context, ResourceHandler resourceHandler,
boolean withContextPath)
{
String uri = resourceHandler.getResourceUri(context);
if (uri == null)
{
return getResourceUri(context, resourceHandler.getResourceLoaderClass(),
withContextPath);
}
return getResourceUri(context, resourceHandler.getResourceLoaderClass(), withContextPath)
+ uri;
}
/**
* Get the Path used to retrieve an resource.
*/
public String getResourceUri(FacesContext context, String uri)
{
return getResourceUri(context, uri, true);
}
/**
* Get the Path used to retrieve an resource.
*/
public String getResourceUri(FacesContext context, String uri, boolean withContextPath)
{
if (withContextPath)
{
return context.getApplication().getViewHandler().getResourceURL(context, uri);
}
return uri;
}
/**
* Get the Path used to retrieve an resource.
* @param context current faces-context
* @param resourceLoader resourceLoader
* @param withContextPath use the context-path of the web-app when accessing the resources
*
* @return the URI of the resource
*/
protected String getResourceUri(FacesContext context, Class resourceLoader,
boolean withContextPath)
{
StringBuffer sb = new StringBuffer(200);
sb.append(MyfacesConfig.getCurrentInstance(context.getExternalContext()).getResourceVirtualPath());
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 668 |
| org/apache/myfaces/renderkit/html/util/NonBufferingAddResource.java | 412 |
sb.append(MyfacesConfig.getCurrentInstance(context.getExternalContext()).getResourceVirtualPath());
sb.append(PATH_SEPARATOR);
sb.append(resourceLoader.getName());
sb.append(PATH_SEPARATOR);
sb.append(getCacheKey(context));
sb.append(PATH_SEPARATOR);
return getResourceUri(context, sb.toString(), withContextPath);
}
/**
* Return a value used in the {cacheKey} part of a generated URL for a
* resource reference.
* <p/>
* Caching in browsers normally works by having files served to them
* include last-modified and expiry-time http headers. Until the expiry
* time is reached, a browser will silently use its cached version. After
* the expiry time, it will send a "get if modified since {time}" message,
* where {time} is the last-modified header from the version it has cached.
* <p/>
* Unfortunately this scheme only works well for resources represented as
* plain files on disk, where the webserver can easily and efficiently see
* the last-modified time of the resource file. When that query has to be
* processed by a servlet that doesn't scale well, even when it is possible
* to determine the resource's last-modified date from servlet code.
* <p/>
* Fortunately, for the AddResource class a static resource is only ever
* accessed because a URL was embedded by this class in a dynamic page.
* This makes it possible to implement caching by instead marking every
* resource served with a very long expiry time, but forcing the URL that
* points to the resource to change whenever the old cached version becomes
* invalid; the browser effectively thinks it is fetching a different
* resource that it hasn't seen before. This is implemented by embedding
* a "cache key" in the generated URL.
* <p/>
* Rather than using the actual modification date of a resource as the
* cache key, we simply use the webapp deployment time. This means that all
* data cached by browsers will become invalid after a webapp deploy (all
* the urls to the resources change). It also means that changes that occur
* to a resource <i>without</i> a webapp redeploy will not be seen by browsers.
*
* @param context the current faces-context
*
* @return the key for caching
*/
protected long getCacheKey(FacesContext context)
{
// cache key is hold in application scope so it is recreated on redeploying the webapp.
Map applicationMap = context.getExternalContext().getApplicationMap();
Long cacheKey = (Long) applicationMap.get(RESOURCES_CACHE_KEY);
if (cacheKey == null)
{
cacheKey = new Long(System.currentTimeMillis() / 100000);
applicationMap.put(RESOURCES_CACHE_KEY, cacheKey);
}
return cacheKey.longValue();
}
public boolean isResourceUri(ServletContext servletContext, HttpServletRequest request)
{
String path;
if (_contextPath != null)
{
path = _contextPath + getResourceVirtualPath(servletContext);
}
else
{
path = getResourceVirtualPath(servletContext);
}
//fix for TOMAHAWK-660; to be sure this fix is backwards compatible, the
//encoded context-path is only used as a first option to check for the prefix
//if we're sure this works for all cases, we can directly return the first value
//and not double-check.
try
{
if(request.getRequestURI().startsWith(URLEncoder.encode(path,"UTF-8")))
return true;
}
catch (UnsupportedEncodingException e)
{
log.error("Unsupported encoding UTF-8 used",e);
}
return request.getRequestURI().startsWith(path);
}
private String getResourceVirtualPath(ServletContext servletContext)
| |
| File | Line |
|---|---|
| org/apache/myfaces/taglib/html/ext/HtmlSelectManyListboxTag.java | 43 |
| org/apache/myfaces/taglib/html/ext/HtmlSelectOneMenuTag.java | 43 |
return HtmlSelectOneRadio.DEFAULT_RENDERER_TYPE;
}
private String _escape;
private String _enabledOnUserRole;
private String _visibleOnUserRole;
private String _displayValueOnly;
private String _displayValueOnlyStyle;
private String _displayValueOnlyStyleClass;
public void release() {
super.release();
_escape=null;
_enabledOnUserRole=null;
_visibleOnUserRole=null;
_displayValueOnly=null;
_displayValueOnlyStyle=null;
_displayValueOnlyStyleClass=null;
}
protected void setProperties(UIComponent component)
{
super.setProperties(component);
setBooleanProperty(component, JSFAttr.ESCAPE_ATTR, _escape);
setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
setBooleanProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_ATTR, _displayValueOnly);
setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_ATTR, _displayValueOnlyStyle);
setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_CLASS_ATTR, _displayValueOnlyStyleClass);
}
public void setEscape(String escape)
{
_escape = escape;
}
public void setEnabledOnUserRole(String enabledOnUserRole)
{
_enabledOnUserRole = enabledOnUserRole;
}
public void setVisibleOnUserRole(String visibleOnUserRole)
{
_visibleOnUserRole = visibleOnUserRole;
}
public void setDisplayValueOnly(String displayValueOnly)
{
_displayValueOnly = displayValueOnly;
}
public void setDisplayValueOnlyStyle(String displayValueOnlyStyle)
{
_displayValueOnlyStyle = displayValueOnlyStyle;
}
public void setDisplayValueOnlyStyleClass(String displayValueOnlyStyleClass)
{
_displayValueOnlyStyleClass = displayValueOnlyStyleClass;
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/aliasbean/AliasBean.java | 182 |
| org/apache/myfaces/custom/aliasbean/AliasBeansScope.java | 116 |
makeAliases(context);
Map facetMap = null;
for (Iterator it = getFacets().entrySet().iterator(); it.hasNext();)
{
Map.Entry entry = (Map.Entry) it.next();
if (facetMap == null)
facetMap = new HashMap();
UIComponent component = (UIComponent) entry.getValue();
if (!component.isTransient())
{
facetMap.put(entry.getKey(), component.processSaveState(context));
}
}
List childrenList = null;
if (getChildCount() > 0)
{
for (Iterator it = getChildren().iterator(); it.hasNext();)
{
UIComponent child = (UIComponent) it.next();
if (!child.isTransient())
{
if (childrenList == null)
childrenList = new ArrayList(getChildCount());
childrenList.add(child.processSaveState(context));
}
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 360 |
| org/apache/myfaces/renderkit/html/util/DefaultAddResource.java | 99 |
}
// Methods to add resources
/**
* Adds the given Javascript resource to the document header at the specified
* document positioy by supplying a resourcehandler instance.
* <p/>
* Use this method to have full control about building the reference url
* to identify the resource and to customize how the resource is
* written to the response. In most cases, however, one of the convenience
* methods on this class can be used without requiring a custom ResourceHandler
* to be provided.
* <p/>
* If the script has already been referenced, it's added only once.
* <p/>
* Note that this method <i>queues</i> the javascript for insertion, and that
* the script is inserted into the buffered response by the ExtensionsFilter
* after the page is complete.
*/
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position,
ResourceHandler resourceHandler)
{
addJavaScriptAtPosition(context, position, resourceHandler, false);
}
/**
* Insert a [script src="url"] entry into the document header at the
* specified document position. If the script has already been
* referenced, it's added only once.
* <p/>
* The resource is expected to be in the classpath, at the same location as the
* specified component + "/resource".
* <p/>
* Example: when customComponent is class example.Widget, and
* resourceName is script.js, the resource will be retrieved from
* "example/Widget/resource/script.js" in the classpath.
*/
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position,
Class myfacesCustomComponent, String resourceName)
{
addJavaScriptAtPosition(context, position, new MyFacesResourceHandler(
myfacesCustomComponent, resourceName));
}
public void addJavaScriptAtPositionPlain(FacesContext context, ResourcePosition position, Class myfacesCustomComponent, String resourceName)
{
addJavaScriptAtPosition(context, position,
new MyFacesResourceHandler(myfacesCustomComponent, resourceName),
false, false);
}
/**
* Insert a [script src="url"] entry into the document header at the
* specified document position. If the script has already been
* referenced, it's added only once.
*
* @param defer specifies whether the html attribute "defer" is set on the
* generated script tag. If this is true then the browser will continue
* processing the html page without waiting for the specified script to
* load and be run.
*/
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position,
Class myfacesCustomComponent, String resourceName, boolean defer)
{
addJavaScriptAtPosition(context, position, new MyFacesResourceHandler(
myfacesCustomComponent, resourceName), defer);
}
/**
* Insert a [script src="url"] entry into the document header at the
* specified document position. If the script has already been
* referenced, it's added only once.
*
* @param uri is the location of the desired resource, relative to the base
* directory of the webapp (ie its contextPath).
*/
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position, String uri)
{
addJavaScriptAtPosition(context, position, uri, false);
}
/**
* Adds the given Javascript resource at the specified document position.
* If the script has already been referenced, it's added only once.
*/
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position, String uri,
boolean defer)
{
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/MultipartFilter.java | 59 |
| org/apache/myfaces/webapp/filter/ExtensionsFilter.java | 158 |
_servletContext = filterConfig.getServletContext();
}
private int resolveSize(String param, int defaultValue) {
int numberParam = defaultValue;
if (param != null) {
param = param.toLowerCase();
int factor = 1;
String number = param;
if (param.endsWith("g")) {
factor = 1024 * 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("m")) {
factor = 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("k")) {
factor = 1024;
number = param.substring(0, param.length() - 1);
}
numberParam = Integer.parseInt(number) * factor;
}
return numberParam;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if(request.getAttribute(DOFILTER_CALLED)!=null)
| |
| File | Line |
|---|---|
| org/apache/myfaces/webapp/filter/portlet/PortletExternalContextWrapper.java | 66 |
| org/apache/myfaces/webapp/filter/servlet/ServletExternalContextWrapper.java | 68 |
this._servletResponse = response;
this._multipartContent = multipartContent;
}
public void dispatch(String path) throws IOException {
_delegate.dispatch(path);
}
public String encodeActionURL(String url) {
return _delegate.encodeActionURL(url);
}
public String encodeNamespace(String name) {
return _delegate.encodeNamespace(name);
}
public String encodeResourceURL(String url) {
return _delegate.encodeResourceURL(url);
}
public Map getApplicationMap() {
return _delegate.getApplicationMap();
}
public String getAuthType() {
return _delegate.getAuthType();
}
public Object getContext() {
return _delegate.getContext();
}
public String getInitParameter(String name) {
return _delegate.getInitParameter(name);
}
public Map getInitParameterMap() {
return _delegate.getInitParameterMap();
}
public String getRemoteUser() {
return _delegate.getRemoteUser();
}
public Object getRequest() {
return _servletRequest==null?_delegate.getRequest():_servletRequest;
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/layout/HtmlLayoutRenderer.java | 95 |
| org/apache/myfaces/custom/layout/HtmlLayoutRenderer.java | 145 |
protected void renderNavRight(FacesContext facesContext, HtmlPanelLayout panelLayout)
throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
UIComponent header = panelLayout.getHeader();
UIComponent navigation = panelLayout.getNavigation();
UIComponent body = panelLayout.getBody();
UIComponent footer = panelLayout.getFooter();
writer.startElement(HTML.TABLE_ELEM, panelLayout);
HtmlRendererUtils.renderHTMLAttributes(writer, panelLayout, HTML.TABLE_PASSTHROUGH_ATTRIBUTES);
if (header != null)
{
writer.startElement(HTML.TR_ELEM, panelLayout);
renderTableCell(facesContext, writer, header,
(navigation != null && body != null) ? 2 : 1,
panelLayout.getHeaderClass(),
panelLayout.getHeaderStyle());
writer.endElement(HTML.TR_ELEM);
}
if (navigation != null || body != null)
{
writer.startElement(HTML.TR_ELEM, panelLayout);
if (body != null)
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/navigation/HtmlNavigationRenderer.java | 168 |
| org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java | 162 |
renderChildrenTableLayout(facesContext, writer, panelNav, child.getChildren(), level + 1);
}
}
else {
//separator
HtmlRendererUtils.writePrettyLineSeparator(facesContext);
String style = panelNav.getSeparatorStyle();
String styleClass = panelNav.getSeparatorClass();
writer.startElement(HTML.TR_ELEM, panelNav);
writer.startElement(HTML.TD_ELEM, panelNav);
writeStyleAttributes(writer, style, styleClass);
if (style != null || styleClass != null) {
writer.startElement(HTML.SPAN_ELEM, panelNav);
writeStyleAttributes(writer, style, styleClass);
}
indent(writer, level);
RendererUtils.renderChild(facesContext, child);
if (style != null || styleClass != null) {
writer.endElement(HTML.SPAN_ELEM);
}
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEM);
}
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/webapp/filter/ExtensionsFilter.java | 158 |
| org/apache/myfaces/webapp/filter/ExtensionsFilterConfig.java | 269 |
initParams.clear();
//_webXml.addFilter(filterName, filterClass);
}
private int resolveSize(String param, int defaultValue) {
int numberParam = defaultValue;
if (param != null) {
param = param.toLowerCase();
int factor = 1;
String number = param;
if (param.endsWith("g")) {
factor = 1024 * 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("m")) {
factor = 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("k")) {
factor = 1024;
number = param.substring(0, param.length() - 1);
}
numberParam = Integer.parseInt(number) * factor;
}
return numberParam;
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 1045 |
| org/apache/myfaces/renderkit/html/util/DefaultAddResource.java | 665 |
writeJavaScriptReference(response, writer, this.getResourceUri(),_encode,_defer);
}
}
private abstract class InlinePositionedInfo implements WritablePositionedInfo
{
private final String _inlineValue;
protected InlinePositionedInfo(String inlineValue)
{
_inlineValue = inlineValue;
}
public String getInlineValue()
{
return _inlineValue;
}
public int hashCode()
{
return new HashCodeBuilder().append(_inlineValue).toHashCode();
}
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (obj == this)
{
return true;
}
if (obj instanceof InlinePositionedInfo)
{
InlinePositionedInfo other = (InlinePositionedInfo) obj;
return new EqualsBuilder().append(_inlineValue, other._inlineValue).isEquals();
}
return false;
}
}
private class InlineScriptPositionedInfo extends InlinePositionedInfo
{
protected InlineScriptPositionedInfo(String inlineScript)
{
super(inlineScript);
}
public void writePositionedInfo(HttpServletResponse response, ResponseWriter writer)
throws IOException
{
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/MultipartFilter.java | 59 |
| org/apache/myfaces/webapp/filter/ExtensionsFilterConfig.java | 269 |
initParams.clear();
//_webXml.addFilter(filterName, filterClass);
}
private int resolveSize(String param, int defaultValue) {
int numberParam = defaultValue;
if (param != null) {
param = param.toLowerCase();
int factor = 1;
String number = param;
if (param.endsWith("g")) {
factor = 1024 * 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("m")) {
factor = 1024 * 1024;
number = param.substring(0, param.length() - 1);
} else if (param.endsWith("k")) {
factor = 1024;
number = param.substring(0, param.length() - 1);
}
numberParam = Integer.parseInt(number) * factor;
}
return numberParam;
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/HtmlDataTableHack.java | 463 |
| org/apache/myfaces/custom/crosstable/UIColumns.java | 273 |
_dataModelMap.put(clientID, dataModel);
}
/**
* Creates a new DataModel around the current value.
*/
protected DataModel createDataModel() {
Object value = getValue();
if (value == null) {
return EMPTY_DATA_MODEL;
} else if (value instanceof DataModel) {
return (DataModel) value;
} else if (value instanceof List) {
return new ListDataModel((List) value);
} else if (value instanceof Collection) {
return new ListDataModel(new ArrayList((Collection) value));
} else if (OBJECT_ARRAY_CLASS.isAssignableFrom(value.getClass())) {
return new ArrayDataModel((Object[]) value);
} else if (value instanceof ResultSet) {
return new ResultSetDataModel((ResultSet) value);
} else if (value instanceof Result) {
return new ResultDataModel((Result) value);
} else {
return new ScalarDataModel(value);
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java | 56 |
| org/apache/myfaces/custom/datascroller/AbstractHtmlDataScroller.java | 107 |
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
/**
* The layout this scroller should render with. Default is 'table',
* 'list' is implemented as well. Additionally you can use
* 'singleList' - then the data-scroller will render a list, but
* not the paginator - same with the value 'singleTable'.
*
* @JSFProperty
* defaultValue = "table"
*/
public abstract String getLayout();
/**
* standard html colspan attribute for table cell
*
* @JSFProperty
* defaultValue = "Integer.MIN_VALUE"
*/
public abstract int getColspan();
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 317 |
| org/apache/myfaces/renderkit/html/util/NonBufferingAddResource.java | 183 |
writeJavaScriptReference(context, getResourceUri(context, resourceHandler), true, false);
}
public void addResourceHere(FacesContext context, ResourceHandler resourceHandler)
throws IOException
{
validateResourceHandler(resourceHandler);
String path = getResourceUri(context, resourceHandler);
ResponseWriter writer = context.getResponseWriter();
writer.write(context.getExternalContext().encodeResourceURL(path));
}
/**
* Verify that the resource handler is acceptable. Null is not
* valid, and the getResourceLoaderClass method must return a
* Class object whose instances implements the ResourceLoader
* interface.
*
* @param resourceHandler handler to check
*/
protected void validateResourceHandler(ResourceHandler resourceHandler)
{
if (resourceHandler == null)
{
throw new IllegalArgumentException("ResourceHandler is null");
}
validateResourceLoader(resourceHandler.getResourceLoaderClass());
}
/**
* Given a Class object, verify that the instances of that class
* implement the ResourceLoader interface.
*
* @param resourceloader loader to check
*/
protected void validateResourceLoader(Class resourceloader)
{
if (!ResourceLoader.class.isAssignableFrom(resourceloader))
{
throw new FacesException("Class " + resourceloader.getName() + " must implement "
+ ResourceLoader.class.getName());
}
}
public void addJavaScriptAtPosition(FacesContext context, ResourcePosition position, ResourceHandler resourceHandler) {
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java | 53 |
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectOneMenu.java | 53 |
public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Menu";
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java | 52 |
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectOneListbox.java | 53 |
public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Listbox";
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java | 981 |
| org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java | 1003 |
String[] localeMonths = symbols.getShortMonths();
months[0] = localeMonths[Calendar.JANUARY];
months[1] = localeMonths[Calendar.FEBRUARY];
months[2] = localeMonths[Calendar.MARCH];
months[3] = localeMonths[Calendar.APRIL];
months[4] = localeMonths[Calendar.MAY];
months[5] = localeMonths[Calendar.JUNE];
months[6] = localeMonths[Calendar.JULY];
months[7] = localeMonths[Calendar.AUGUST];
months[8] = localeMonths[Calendar.SEPTEMBER];
months[9] = localeMonths[Calendar.OCTOBER];
months[10] = localeMonths[Calendar.NOVEMBER];
months[11] = localeMonths[Calendar.DECEMBER];
return months;
}
public void decode(FacesContext facesContext, UIComponent component)
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectBooleanCheckbox.java | 54 |
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java | 57 |
public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Checkbox";
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlInputTextarea.java | 52 |
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java | 59 |
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
/**
* A integer representing the number of checkbox rows if the
* layout is lineDirection and checkbox columns if the layout
* is pageDirection.
*
* @JSFProperty
*/
public abstract String getLayoutWidth();
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlInputText.java | 53 |
| org/apache/myfaces/component/html/ext/AbstractHtmlInputTextarea.java | 52 |
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
/**
* None standard HTML attribute.
*
* Possible values are: soft, hard, virtual, physical and off.
*
* @JSFProperty
*/
public abstract String getWrap();
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlInputSecret.java | 53 |
| org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java | 54 |
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/AbstractHtmlInputSecret.java | 53 |
| org/apache/myfaces/custom/datascroller/AbstractHtmlDataScroller.java | 107 |
public String getClientId(FacesContext context)
{
String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
if (clientId == null)
{
clientId = super.getClientId(context);
}
return clientId;
}
public boolean isRendered()
{
if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
return super.isRendered();
}
public boolean isSetDisplayValueOnly(){
return getDisplayValueOnly() != null ? true : false;
}
public boolean isDisplayValueOnly(){
return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
}
public void setDisplayValueOnly(boolean displayValueOnly){
this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
}
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/navigation/HtmlNavigationRenderer.java | 144 |
| org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java | 140 |
String styleClass = getNavigationItemClass(panelNav, (HtmlCommandNavigationItem) child);
writer.startElement(HTML.TR_ELEM, panelNav);
writer.startElement(HTML.TD_ELEM, panelNav);
writeStyleAttributes(writer, style, styleClass);
if (style != null || styleClass != null) {
writer.startElement(HTML.SPAN_ELEM, panelNav);
writeStyleAttributes(writer, style, styleClass);
}
indent(writer, level);
child.encodeBegin(facesContext);
child.encodeEnd(facesContext);
if (style != null || styleClass != null) {
writer.endElement(HTML.SPAN_ELEM);
}
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEM);
if (child.getChildCount() > 0) {
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/HtmlDataTableHack.java | 327 |
| org/apache/myfaces/custom/crosstable/UIColumns.java | 184 |
protected void restoreDescendantComponentStates(Iterator childIterator, Object state) {
Iterator descendantStateIterator = null;
while (childIterator.hasNext()) {
if (descendantStateIterator == null && state != null) {
descendantStateIterator = ((Collection) state).iterator();
}
UIComponent component = (UIComponent) childIterator.next();
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
if (!component.isTransient()) {
Object childState = null;
Object descendantState = null;
if (descendantStateIterator != null && descendantStateIterator.hasNext()) {
Object[] object = (Object[]) descendantStateIterator.next();
childState = object[0];
descendantState = object[1];
}
if (component instanceof EditableValueHolder) {
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/BaseSortableModel.java | 275 |
| org/apache/myfaces/component/html/ext/HtmlDataTableHack.java | 524 |
}
private static final DataModel EMPTY_DATA_MODEL = new _SerializableDataModel()
{
public boolean isRowAvailable()
{
return false;
}
public int getRowCount()
{
return 0;
}
public Object getRowData()
{
throw new IllegalArgumentException();
}
public int getRowIndex()
{
return -1;
}
public void setRowIndex(int i)
{
if (i < -1)
throw new IndexOutOfBoundsException("Index < 0 : " + i);
}
public Object getWrappedData()
{
return null;
}
public void setWrappedData(Object obj)
{
if (obj == null)
return; //Clearing is allowed
throw new UnsupportedOperationException(this.getClass().getName()
+ " UnsupportedOperationException");
}
};
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 764 |
| org/apache/myfaces/renderkit/html/util/NonBufferingAddResource.java | 528 |
String classNameStartsAfter = getResourceVirtualPath(context) + '/';
int posStartClassName = uri.indexOf(classNameStartsAfter) + classNameStartsAfter.length();
int posEndClassName = uri.indexOf(PATH_SEPARATOR, posStartClassName);
String className = uri.substring(posStartClassName, posEndClassName);
int posEndCacheKey = uri.indexOf(PATH_SEPARATOR, posEndClassName + 1);
String resourceUri = null;
if (posEndCacheKey + 1 < uri.length())
{
resourceUri = uri.substring(posEndCacheKey + 1);
}
try
{
Class resourceLoader = getClass(className);
validateResourceLoader(resourceLoader);
((ResourceLoader) resourceLoader.newInstance()).serveResource(context, request,
response, resourceUri);
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java | 59 |
| org/apache/myfaces/custom/schedule/ScheduleCompactWeekRenderer.java | 56 |
public void encodeBegin(
FacesContext context,
UIComponent component
)
throws IOException
{
if (!component.isRendered()) {
return;
}
super.encodeBegin(context, component);
HtmlSchedule schedule = (HtmlSchedule) component;
ResponseWriter writer = context.getResponseWriter();
//container div for the schedule grid
writer.startElement(HTML.DIV_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, "schedule-compact-" + schedule.getTheme(), null);
writer.writeAttribute(
HTML.STYLE_ATTR, "border-style: none; overflow: hidden;", null
);
writer.startElement(HTML.TABLE_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "week"), null);
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/util/StreamingAddResource.java | 915 |
| org/apache/myfaces/renderkit/html/util/DefaultAddResource.java | 563 |
public abstract void writePositionedInfo(HttpServletResponse response, ResponseWriter writer)
throws IOException;
}
private abstract class AbstractResourceUri
{
protected final String _resourceUri;
protected AbstractResourceUri(String resourceUri)
{
_resourceUri = resourceUri;
}
public int hashCode()
{
return _resourceUri.hashCode();
}
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (obj == this)
{
return true;
}
if (obj instanceof AbstractResourceUri)
{
AbstractResourceUri other = (AbstractResourceUri) obj;
return _resourceUri.equals(other._resourceUri);
}
return false;
}
protected String getResourceUri()
{
return _resourceUri;
}
}
private class StylePositionedInfo extends AbstractResourceUri implements WritablePositionedInfo
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java | 1111 |
| org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java | 1172 |
if(uiComponent instanceof HtmlInputCalendar && ((HtmlInputCalendar) uiComponent).isRenderAsPopup())
{
HtmlInputCalendar calendar = (HtmlInputCalendar) uiComponent;
String popupDateFormat = calendar.getPopupDateFormat();
String formatStr = createJSPopupFormat(facesContext, popupDateFormat);
Locale locale = facesContext.getViewRoot().getLocale();
Calendar timeKeeper = Calendar.getInstance(locale);
int firstDayOfWeek = timeKeeper.getFirstDayOfWeek() - 1;
org.apache.myfaces.dateformat.DateFormatSymbols symbols = new org.apache.myfaces.dateformat.DateFormatSymbols(locale);
SimpleDateFormatter dateFormat = new SimpleDateFormatter(formatStr, symbols, firstDayOfWeek);
| |
| File | Line |
|---|---|
| org/apache/myfaces/component/html/ext/BaseSortableModel.java | 277 |
| org/apache/myfaces/custom/crosstable/UIColumns.java | 300 |
private static final DataModel EMPTY_DATA_MODEL = new DataModel() {
public boolean isRowAvailable() {
return false;
}
public int getRowCount() {
return 0;
}
public Object getRowData() {
throw new IllegalArgumentException();
}
public int getRowIndex() {
return -1;
}
public void setRowIndex(int i) {
if (i < -1)
throw new IndexOutOfBoundsException("Index < 0 : " + i);
}
public Object getWrappedData() {
return null;
}
public void setWrappedData(Object obj) {
if (obj == null)
return; //Clearing is allowed
throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
}
};
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/layout/HtmlLayoutRenderer.java | 112 |
| org/apache/myfaces/custom/layout/HtmlLayoutRenderer.java | 212 |
panelLayout.getFooterStyle());
writer.endElement(HTML.TR_ELEM);
}
if (navigation != null || body != null)
{
writer.startElement(HTML.TR_ELEM, panelLayout);
if (navigation != null)
{
renderTableCell(facesContext, writer, navigation, 0,
panelLayout.getNavigationClass(),
panelLayout.getNavigationStyle());
}
if (body != null)
{
renderTableCell(facesContext, writer, body, 0,
panelLayout.getBodyClass(),
panelLayout.getBodyStyle());
}
writer.endElement(HTML.TR_ELEM);
}
if (header != null)
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java | 704 |
| org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java | 795 |
writer.writeAttribute(HTML.ONCHANGE_ATTR, "drawertool.current_drawer.setTableClass(this.options[this.selectedIndex].value)", null);
writeOption(writer, "plain", "Plain", editor);
writeOption(writer, "listing", "Listing", editor);
writeOption(writer, "grid", "Grid", editor);
writeOption(writer, "data", "Data", editor);
writer.endElement(HTML.SELECT_ELEM);
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEM);
writer.startElement(HTML.TR_ELEM,editor);
writer.startElement(HTML.TH_ELEM,editor);
writer.writeAttribute(HTML.CLASS_ATTR, "kupu-toolbox-label", null);
writer.write("Current column alignment");
| |
| File | Line |
|---|---|
| org/apache/myfaces/custom/fileupload/HtmlFileUploadRenderer.java | 123 |
| org/apache/myfaces/custom/fileupload/HtmlFileUploadRenderer.java | 162 |
if (fileItem != null)
{
try{
UploadedFile upFile;
String implementation = ((HtmlInputFileUpload) uiComponent).getStorage();
if( implementation == null || ("memory").equals( implementation ) )
upFile = new UploadedFileDefaultMemoryImpl( fileItem );
else
upFile = new UploadedFileDefaultFileImpl( fileItem );
((HtmlInputFileUpload)uiComponent).setSubmittedValue(upFile);
((HtmlInputFileUpload)uiComponent).setValid(true);
}catch(IOException ioe){
throw new FacesException("Exception while processing file upload for file-input : " + uiComponent.getClientId(facesContext),ioe);
}
}
| |