Skip to content

Instantly share code, notes, and snippets.

🐝
In the Hive

John Yeary jyeary

🐝
In the Hive
Block or report user

Report or block jyeary

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jyeary
jyeary / SessionFilter.java
Last active Aug 25, 2017
This filter starts an {@link HttpSession} at the start of the request to avoid JSF late session binding. Based on BalusC suggestions https://stackoverflow.com/questions/8072311/adding-hform-causes-java-lang-illegalstateexception-cannot-create-a-session.
View SessionFilter.java
package com.bluelotussoftware.servlets.filter;
import java.io.IOException;
import java.text.MessageFormat;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@jyeary
jyeary / com.apple.serviceproxy.sh
Created Aug 9, 2017
Commands to Disable com.apple.serviceproxy to allow Docker to run on ports 80 and 443.
View com.apple.serviceproxy.sh
# Unload the Service Service
sudo launchctl unload -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
# Load the Service Service
sudo launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
# Check the status of the Server Service
sudo launchctl list com.apple.serviceproxy
View PhasePrinterListener.java
package com.bluelotussoftware.jsf.phaselisteners;
import java.util.logging.Logger;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
/**
*
* @author John Yeary <jyeary@bluelotussoftware.com>
View license_output
/*
* Copyright 2013-2017 John Yeary <jyeary@bluelotussoftware.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
View NEW-BSD.txt
Copyright (c) <YEAR>, <OWNER>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
View IOUtils.java
package com.bluelotussoftware.io;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
/**
*
View Customers_getCustomers.java
@PersistenceUnit(unitName="SamplePersistenceWebPU")
EntityManagerFactory emf;
public Customer[] getCustomers() {
EntityManager em = emf.createEntityManager();
Query q = em.createQuery("SELECT c FROM Customer c");
List list = q.getResultList();
return list.toArray(new Customer[list.size()]);
}
View ViewMapListenerImpl.java
package com.bluelotussoftware;
import com.sun.faces.application.view.ViewScopeManager;
import java.util.Collections;
import java.util.Map;
import javax.faces.component.TransientStateHelper;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
View FileUploadServlet.java
package com.bluelotussoftware.example.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
View HeaderFilterIntegrationTest.java
package com.bluelotussoftware.example.filter;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
You can’t perform that action at this time.