Skip to content

Instantly share code, notes, and snippets.

@edwardbeckett
Created September 11, 2012 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardbeckett/3699863 to your computer and use it in GitHub Desktop.
Save edwardbeckett/3699863 to your computer and use it in GitHub Desktop.
ColdFire Debugging with ColdSpring AOP
<beans>
<bean
id="service"
class="cfdebug.ColdFireAdvice" />
<bean
id="remoteService"
class="coldspring.aop.framework.RemoteFactoryBean"
lazy-init="false">
<property name="target">
<ref bean="service" />
</property>
<property name="serviceName">
<value>remoteService</value>
</property>
<property name="relativePath">
<value>/tests</value>
</property>
<property name="remoteMethodNames">
<value>*</value>
</property>
<property name="beanFactoryName">
<value>beanFactory</value>
</property>
<property name="interceptorNames">
<list>
<value>coldfireAdvisor</value>
</list>
</property>
</bean>
<bean
id="coldfireAdvice"
class="coldfire.ColdFireAdvice" />
<bean
id="coldfireAdvisor"
class="requirements.coldspring.aop.support.NamedMethodPointcutAdvisor">
<property name="advice">
<ref bean="coldfireAdvice" />
</property>
<property name="mappedNames">
<value>*</value>
</property>
</bean>
</beans>
package example;
import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.net.httpserver.HttpServer;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.io.IOException;
// The Java class will be hosted at the URI path "/debug"
@Path("/debug")
public class Debug{
// The Java method will process HTTP GET requests
@GET
// The Java method will produce content identified by the MIME Media type "text/plain"
@Produces("text/plain")
public String getClichedMessage() {
// Return some cliched textual content
return "DEBUG";
}
public static void main(String[] args) throws IOException {
HttpServer server = HttpServerFactory.create("http://localhost:9998/");
server.start();
System.out.println("Server running");
System.out.println("Visit: http://localhost:9998/debug");
System.out.println("Hit return to stop...");
System.in.read();
System.out.println("Stopping server");
server.stop(0);
System.out.println("Server stopped");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment