Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

An adapter to listen and accept Http requests.

909336Jan 11 2012 — edited Jan 14 2012
Hi guys
I am new to this great technology, what I want to do is simply create an adapter that will listen for HTTP requests, clients will connect to the server send some data like a ordinary web browser and server. It is along the ideas covered in this forum.
9969285

I have created my adapter extending from HttpServlet implementing StreamSource. I cannot figure out which url on my localhost should i connect to, as i am getting

HTTP ERROR 404
Problem accessing /ForexRates/ticks. Reason:
NOT_FOUND

Application name is: ForexRates.
My adapter code:
@SuppressWarnings("serial")
public class HttpServletAdapter extends HttpServlet implements StreamSource{

	private HttpService httpService=null;
	
	private StreamSender eventSender;

	@Override
	public void init(ServletConfig config) throws ServletException {
		super.init(config);
		try {
			config.getServletContext().log("Initialising HTTP Servlet Adapter....");
			httpService.registerServlet("/ticks", this, null, null);
		} catch (NamespaceException nex) {
			throw new ServletException(nex);
		}
	}
	
	
	public void setHttpService(HttpService httpService) {
		this.httpService = httpService;
	}
my context xml file
[xml]
<osgi:reference id="jetty" interface="org.osgi.service.http.HttpService"/>

<!-- Incoming Forex Rates Adapter -->
<wlevs:adapter id="ratesFeedAdapter" class="com.....HttpServletAdapter" advertise="true">
<wlevs:instance-property name="httpService" ref="jetty"/>
</wlevs:adapter>

[xml]

it got me thinking, isn't there a service/adapter out of the box that I can use, configure the server context path, add a converter for requests received or simply assign a java class to grab the request where name/value pairs match the bean properties. If there is such an adapter how do i configure it?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2012
Added on Jan 11 2012
4 comments
161 views