Skip to content

Instantly share code, notes, and snippets.

View edm00se's full-sized avatar

Eric McCormick edm00se

View GitHub Profile
@edm00se
edm00se / CustRestConsumer.java
Last active February 9, 2016 12:35
My proof of concept that Java on the server, along with RESTful APIs, can be an impressive and easy way of managing business applications (this uses a standard Domino Java Code element with an XPage as the front-end). Package is defined with a single class and single (static) method, to return the data from a simple REST call, fully on the serve…
package com.eric.restful;
import java.net.URL;
import java.net.URLConnection;
import java.io.BufferedReader;
import com.google.gson.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.MalformedURLException;
@edm00se
edm00se / CustAuthRestConsumer.java
Last active August 29, 2015 14:05
Extending the CustRestConsumer class, the get method is public for invocation but the build URL and credentialing methods are both private, so as to prevent exposing that information. This is covered in detail in my blog post: http://edm00se.github.io/DevBlog/xpages/server-rest-with-authentication/
package com.eric.restful;
import java.net.URL;
import java.net.URLConnection;
import java.io.BufferedReader;
import org.apache.commons.codec.binary.Base64;
import com.google.gson.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
@edm00se
edm00se / DataProvider.java
Last active August 29, 2015 14:05
XAgent Java FacesContext response JSON data class.
package com.eric.test;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import lotus.domino.*;
import com.ibm.xsp.model.domino.DominoUtils;
@edm00se
edm00se / AltDataProvider.java
Last active August 29, 2015 14:05
Alternate JSON Java provider, implementing the com.ibm.commons.util.io.json package instead of Google GSON (as seen in my original Class).
package com.eric.test;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import lotus.domino.*;
import com.ibm.xsp.model.domino.DominoUtils;
@edm00se
edm00se / SampleComparatorUse.java
Last active August 29, 2015 14:11
Sample use of custom comparator in sorting a List<javax.faces.model.SelectItem> by the label, ascending. This is implemented inside a managed bean, fully registered in faces-config, with binding via EL in a sample XPage.
package com.eric.test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import javax.faces.model.SelectItem;
public class SampleComparatorUse implements Serializable {
@edm00se
edm00se / com.hello.servlets.ExampleAbstractedServlet.java
Last active July 21, 2023 21:32
Ultra simple examples of HttpServlet, DesignerFacesServlet, and AbstractXSPServlet.
package com.hello.servlets;
import java.util.Enumeration;
import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ibm.commons.util.StringUtil;
@edm00se
edm00se / com.hello.factory.ServletFactory.java
Created February 13, 2015 03:42
Sample ServletFactory for use in Domino/XPages.
package com.hello.factory;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import com.ibm.designer.runtime.domino.adapter.ComponentModule;
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>
@edm00se
edm00se / bs-col-height-fixer.css
Created March 16, 2015 14:20
Responsive Bootstrap 3 column divs of equal height (for the row).
/*
* Provides Bootstrap 3 compatible classes for making responsive rows and columns consistently formatted for height.
* src: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height
*/
/* columns of same height styles */
.row-same-height {
display: table;
width: 100%;
}
@edm00se
edm00se / ReadMe.md
Last active April 3, 2022 00:53
Sample nginx.conf settings to perform reverse proxy functionality to.

Read Me

In order to access a server hosted within a vm (guest), for development purposes from the host OS, which is restricted to same origin / localhost only requests, I set up a siple nginx reverse proxy to forward my requests.

Steps

  1. To install in a Windows VM, download and install nginx from the current, stable release; I installed to C:\nginx\
  2. Edit the <install path>/conf/nginx.conf file with the marked changes in the file of the same name in this gist.
  3. Start the nginx executable, located in your install path. There are service wrappers for Windows, or you can just kill the process to stop the nginx instance.

Commands for Windows