Skip to content

Instantly share code, notes, and snippets.

View cfalzone's full-sized avatar

Christopher Falzone cfalzone

  • Aquent
  • Erie County, PA
View GitHub Profile
@cfalzone
cfalzone / CreateUsers.jsp
Created September 3, 2015 13:39
A User Creation JSP for dotCMS. Create users from CSV File
<%@page import="java.util.Map"%>
<%@page import="com.dotmarketing.util.UUIDGenerator"%>
<%@page import="com.dotmarketing.business.UserProxyAPI"%>
<%@page import="com.dotmarketing.cms.factories.PublicCompanyFactory"%>
<%@page import="com.dotmarketing.cms.factories.PublicAddressFactory"%>
<%@page import="com.liferay.portal.model.Address"%>
<%@page import="com.dotmarketing.factories.InodeFactory"%>
<%@page import="com.dotmarketing.beans.UserProxy"%>
<%@page import="com.dotmarketing.cms.factories.PublicEncryptionFactory"%>
<%@page import="java.util.Date"%>
@cfalzone
cfalzone / gist:2d73b9158e9633762505
Created August 26, 2015 13:23
Error deleting push publishing endpoint.
26-Aug-2015 09:07:33.648 WARNING [url:POST//aquent.com/api/config/deleteEndpoint | lang:1 | ip:184.56.170.61 | Admin:false | start:08-25-2015 10:25:39 EDT ref:https://dotcms-naw-app1a.aquent.com/c/portal/layout?p_l_id=a8e430e3-8010-40cf-ade1-5978e61241a8&p_p_id=9&p_p_action=0&dm_rlout=1&r=1440514691877&r=1440594121563] com.dotcms.repackage.com.sun.jersey.spi.container.servlet.WebComponent.filterFormParameters A servlet POST request, to the URI https://dotcms-naw-app1a.aquent.com/api/config/deleteEndpoint, contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
2015-08-26 09:07:33,649 ERROR com.dotcms.rest.CMSConfigResource - Error deleting End Point: 45ca93a5-3570-4db0-b218-afde5a48767d
java.lang.NullPointerException
at com.dotcms.rest.CMSConfigResource.deleteEndpoin
2015-08-25 10:34:25,891 ERROR com.dotmarketing.velocity.ClientVelocityServlet - java.lang.NullPointerException
java.lang.NullPointerException
at com.dotmarketing.cache.LiveCache.getPathFromCache(LiveCache.java:179)
at com.dotmarketing.velocity.VelocityServlet.doLiveMode(VelocityServlet.java:409)
at com.dotmarketing.velocity.VelocityServlet.service(VelocityServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
@cfalzone
cfalzone / CWImporterJob.java
Created March 12, 2015 20:34
Example quartz job hitting a servlet for OSGI in dotCMS
package com.aquent.jobs;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@cfalzone
cfalzone / gist:a64d960184dca87347bb
Created February 9, 2015 12:47
dotCMS Multilingual Navigation
#set($list = $navtool.getNav("/"))
#foreach($n in $list)
<li class="divider"></li>
#set($children = $n.children)
#if($children && $children.size() > 0)
<li class="has-dropdown #if($n.active) active #end">
<a href="${n.href}">$text.get( ${n.title} )</a>
<ul class="dropdown">
#foreach($ch in $children)
<li #if($ch.active) class="active" #end><a href='${ch.href}'>$text.get( ${ch.title} )</a></li>
@cfalzone
cfalzone / RuleCheck.java
Last active August 29, 2015 14:11
dotCMS Contentlet-Based Spam Prevention
// HoneyPot Protection - if this field is filled in then this is probably a bot
if(UtilMethods.isSet(honeypot)) {
response.sendRedirect(errorPage);
Logger.error(this, "Honey Pot detected, ignoring the request. Params: "+params);
return;
}
// Some Simple Spam Filtering
if(firstName == null) firstName = "";
if(lastName == null) lastName = "";
@cfalzone
cfalzone / TaleoImporterServlet.java
Created December 8, 2014 21:34
dotCMS Taleo Integration
package com.aquent.aquentcareers;
import java.io.IOException;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
BOS-CFalzone-2:com.aquent.dotcms.osgi cfalzone$ gradle artifactoryPublish
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
Cannot publish pom for project ':' since it does not contain the Maven plugin install task and task ':artifactoryPublish' does not specify a custom pom path.
:artifactoryPublish
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/com/aquent/dotcms/com.aquent.dotcms.osgi/1.6-SNAPSHOT/com.aquent.dotcms.osgi-1.6-SNAPSHOT.jar
:artifactoryPublish FAILED
FAILURE: Build failed with an exception.
* What went wrong:
#!/bin/bash
# Figure out who our dev server is
export DB_HOST=`hostname | perl -pe 's/app/db/g'`
echo "DB Host is - ${DB_HOST}"
export DB_PORT=5444
# DotCMS Paths
export DOTCMS_BASE=/data/wwwroot/dotcms
export DOTCMS_HOME=$DOTCMS_BASE/current
@cfalzone
cfalzone / gist:a370b3961ae75818b05d
Created October 28, 2014 14:27
Create User Error after pushing a user.
[27/10/14 09:30:49:810 EDT] WARN util.JDBCExceptionReporter: SQL Error: 0, SQLState: 23505
[27/10/14 09:30:49:810 EDT] ERROR util.JDBCExceptionReporter: ERROR: duplicate key value violates unique constraint "user__pkey"
Detail: Key (userid)=(dotcms.org.2852) already exists.
[27/10/14 09:30:49:810 EDT] ERROR impl.SessionImpl: Could not synchronize database state with session
[27/10/14 09:30:49:810 EDT] ERROR business.UserFactoryLiferayImpl: net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.liferay.portal.ejb.UserHBM#dotcms.org.2852]
com.liferay.portal.SystemException: net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.liferay.portal.ejb.UserHBM#dotcms.org.2852]
at com.liferay.portal.ejb.UserPersistence.update(UserPersistence.java:217)
at com.liferay.portal.ejb.UserUtil.update(UserUtil.java:108)
at com.liferay.portal.ejb.UserLocalManagerImpl.addUser(UserLocalManagerImpl.java:170)
at com.liferay.portal.ejb.UserLocalManagerUtil.addUser(UserLocalMan