background preloader

Web

Facebook Twitter

Techscouting through the java newstechscouting through the java news. Ohne die Sinnhaftigkeit von zustandsbehafteten Web Services vorab diskutieren zu wollen sind hier 3 Möglichkeiten genannt solche mit Hilfe von JAX-WS bzw. dessen Referenzimplementierung umzusetzen.

techscouting through the java newstechscouting through the java news

Variante 1: Direkter Zugriff auf die HTTP-Session über den WebServiceContext Bei einem Web Service, der auf HTTP und SOAP aufsetzt und in einem Servlet-Container läuft, war es natürlich schon immer möglich die HTPP-Session des Servlet-Containers als Zustandsspeicher zu verwenden. Zugriff auf besagte Session bekommt man über den WebServiceContext, welcher über die Annotation @Resource injected werden kann. Ein Beispiel zeigt das folgende Listing: Die Verwaltung der HTTP-Session auf der Serverseite übernimmt dann wie gewohnt der Servlet-Container.

Mehr zu dieser Variante findet man in einem Blogartikel von Rama Pulavarthi. Variante 2: Per Annotation eine Instanz pro HTTP-Session Mehr dazu steht in einem Blogartikel von Kohsuke Kawaguchi. RESTful Web services: The basics. The basics REST defines a set of architectural principles by which you can design Web services that focus on a system's resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages.

RESTful Web services: The basics

If measured by the number of Web services that use it, REST has emerged in the last few years alone as a predominant Web service design model. In fact, REST has had such a large impact on the Web that it has mostly displaced SOAP- and WSDL-based interface design because it's a considerably simpler style to use. REST didn't attract this much attention when it was first introduced in 2000 by Roy Fielding at the University of California, Irvine, in his academic dissertation, "Architectural Styles and the Design of Network-based Software Architectures," which analyzes a set of software architecture principles that use the Web as a platform for distributed computing (see Resources for a link to this dissertation).

Back to top Listing 1. Stateful vs. Stateless Web Services. Es ist schon ein paar Tage her, als ich Zeuge einer kleinen Debatte unter Entwicklern wurde.

Stateful vs. Stateless Web Services

Es ging um die Entwicklung eines Web Services, welches eine große Menge an Daten beliefern sollte. Während des Brainstormings über Spezifikationen und Parameter wurde auch darüber diskutiert, ob der Web Service stateful - also mit einer Session - oder stateless konzipiert werden soll. Programming Stateful JAX-WS Web Services Using HTTP Session. This chapter describes how you can develop JAX-WS Web Services that interact with an Oracle database.

Programming Stateful JAX-WS Web Services Using HTTP Session

Overview of Stateful Web Services Normally, a JAX-WS Web Service is stateless: that is, none of the local variables and object values that you set in the Web Service object are saved from one invocation to the next. Even sequential requests from a single client are treated each as independent, stateless method invocations. There are Web Service use cases where a client may want to save data on the service during one invocation and then use that data during a subsequent invocation. For example, a shopping cart object may be added to by repeated calls to the addToCart web method and then fetched by the getCart web method. Enabling stateful support in a JAX-WS Web Service requires a minimal amount of coding on both the client and server.

Accessing HTTP Session on the Server On the server, every Web Service invocation is tied to an HttpSession object. The steps required on the server:

WebGIS

OpenLayers 3 Examples. Advanced View Positioning example (center.html) This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location.

OpenLayers 3 Examples

The map above has top, right, bottom, and left padding applied inside the viewport. The view's fitGeometry method is used to fit a geometry in the view with the same padding. The view's centerOn method is used to position a coordinate (Lausanne) at a specific pixel location (the center of the black box). tags: center, rotation, openstreetmap Drag-and-Drop image vector example (drag-and-drop-image-vector.html) Example of using the drag-and-drop interaction with a ol.source.ImageVector. Tags: drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image. Leaflet - a JavaScript library for mobile-friendly maps.

J2EE