Skip to content

Instantly share code, notes, and snippets.

View ggdio's full-sized avatar
:octocat:
Learning something new

Guilherme Dio ggdio

:octocat:
Learning something new
View GitHub Profile
@ggdio
ggdio / REST URL CONVENTION
Last active December 24, 2015 04:09
REST URL CONVENTION
Pattern:
LIST:
http://[domain]/[context]/[main-resource]/
IDENTIFY:
http://[domain]/[context]/[main-resource]/[identifier]
RESOURCE:
http://[domain]/[context]/[main-resource]/[identifier]/[sub-resource]
@ggdio
ggdio / NAMESPACE CONVENTION
Last active December 24, 2015 04:09
Namespace Conventions
Pattern:
http://[mydomain]/[module]/[context]/[type]/[version]
Examples Below.
AUTHENTICATION-MODULE-DOMAIN
_User Domain Model:
@ggdio
ggdio / settings.xml
Created September 27, 2013 23:01
M2 Plugin settings.xml Place it inside: Linux: ~/.m2/ Windows: C:\Users\[PROFILE]\.m2\
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@ggdio
ggdio / web.xml
Last active December 24, 2015 02:49
Jersey servlet mapping
<web-app>
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>br.com.ggdio.estoque.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
@ggdio
ggdio / web.xml
Last active December 23, 2015 09:19
Jax-WS mapping for web.xml OBS: JAXWS-RT.jar is necessary on classpath
<web-app>
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
@ggdio
ggdio / MyServiceClient.java
Last active December 23, 2015 09:09
A client class to MyServiceWs.java
package br.com.ggdio.gists.ws.service.client;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceClient;
import br.com.ggdio.ws.service.structure.MyService;
@ggdio
ggdio / MyService.java
Created September 18, 2013 17:06
Service Interface
package br.com.gists.ws.service.structure;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* Webservice structure definition
* @author Guilherme Dio
*/
@WebService
@ggdio
ggdio / MyServiceWs.java
Last active December 23, 2015 09:09
Webservice implementation based on 'br.com.ggdio.gists.ws.service.structure.MyService'
package br.com.ggdio.gists.ws.service;
import javax.jws.WebService;
import br.com.ggdio.gists.ws.service.structure.MyService;
/**
* Webservice implementation based on the Service - {@link MyService}
* @author Guilherme Dio
*/
@ggdio
ggdio / sun-jaxws.xml
Created September 18, 2013 17:01
Jax-WS xml for mapping the webservice endpoint.
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<!-- WEBSERVICE MAPPING -->
<endpoint
implementation="br.com.ggdio.gists.ws.service.MyServiceWs"
name="MyService"
url-pattern="/services/myservice"
/>
</endpoints>
@ggdio
ggdio / Validador.java
Last active December 23, 2015 07:19
Dynamic Swing Form Validator
package br.com.ggdio.gists;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;