Skip to content

Instantly share code, notes, and snippets.

View liweinan's full-sized avatar
🐢

阿男 liweinan

🐢
View GitHub Profile
@liweinan
liweinan / gist:1868652
Created February 20, 2012 10:06
Detect private methods
for (Method method : clazz.getDeclaredMethods()) {
if (method != null) {
try {
clazz.getMethod(method.getName(), method.getParameterTypes());
} catch (NoSuchMethodException e) {
logger.warn("non-public method: " + method.getDeclaringClass().getName() + "." + method.getName() + "()");
}
}
}
git diff
diff --git a/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java b/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
index 2106862..6ab27a8 100644
--- a/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
+++ b/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
@@ -5,16 +5,14 @@ import org.jboss.resteasy.plugins.server.resourcefactory.JndiResourceFactory;
import org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory;
import org.jboss.resteasy.plugins.server.resourcefactory.SingletonResource;
import org.jboss.resteasy.specimpl.UriBuilderImpl;
-import org.jboss.resteasy.spi.HttpRequest;
diff --git a/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java b/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
index 2106862..bf32ea0 100644
--- a/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
+++ b/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodRegistry.java
@@ -1,20 +1,19 @@
package org.jboss.resteasy.core;
import org.jboss.resteasy.core.registry.RootSegment;
+import org.jboss.resteasy.logging.Logger;
import org.jboss.resteasy.plugins.server.resourcefactory.JndiResourceFactory;
@liweinan
liweinan / gist:2356814
Created April 11, 2012 04:14
获取Class的方法
/* 方法 1: 使用 .class */
Class c = String[].class;
/* 方法 2: 使用实例的getClass()方法 */
c = new String[1].getClass();
/* 方法 3: 使用 Class.forName */
c = Class.forName("[Ljava.lang.String;");
@liweinan
liweinan / gist:2622424
Created May 6, 2012 13:58
RESTEasy Code Reading
# Two different startup procedure
The one is to use ConfigurationBootstrap.
The other one is to use javax.ws.rs.Application as servlet name.
TODO: add more informations/code details on it.
# Startup Procedure
@liweinan
liweinan / gist:2700200
Created May 15, 2012 08:59
MaxInteger
public class MaxInteger {
public static void main(String[] args) {
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
}
}
@liweinan
liweinan / clink1.c
Created July 1, 2012 17:16
Linked List in C
/*
* Mon Jul 02 2012 - Weinan Li <[email protected]> - 0.1
* - Initial version
*/
/*
* include printf()
* and definitions of NULL
*/
#include <stdio.h>
@liweinan
liweinan / linked_list.c
Created July 1, 2012 17:21
Linked List In C
/*
* Mon Jul 02 2012 - Weinan Li <[email protected]> - 0.1
* - Initial version
*/
/*
* include printf()
* and definitions of NULL
*/
#include <stdio.h>
@liweinan
liweinan / gist:3082817
Created July 10, 2012 11:41
xsd for Strong's query
package generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="query" type="queryType" />
<xsd:complexType name="queryType">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="query-param" type="query-paramType" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="query-paramType">