tag:blogger.com,1999:blog-43302589641035662322024-03-18T06:10:24.089-03:00Ivan Junckes FilhoA Software Development blog that talks about several subjects involving technology such as Java, Java EE, Service Oriented Architecture (SOA), REST and Software Engineering.
Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-4330258964103566232.post-87303477538758351462014-12-11T18:27:00.000-02:002014-12-11T18:27:28.913-02:00What is next for JAX-RS 2.1Hi everyone, it's been awhile I know, but JAX-RS 2.1 is now getting shape and below are the tasks planned for this next version.<br />
<br />
* Adding support for SSE.<br />
* Improving integration with CDI.<br />
* Exploring support for non-blocking I/O in providers (filters, interceptors, etc.).<br />
* Evaluating ways in which declarative security can be supported either directly in this JSR or by leveraging other EE-platform JSRs.<br />
* Making JAXB conditional on runtimes where it is available.<br />
* Providing integration with JSON-B.<br />
* Building upon the hypermedia API added in version 2.0.<br />
* Investigating the reactive programming paradigm as a way to improve the JAX-RS asynchronous client API.<br />
* Evaluating any requirements necessary to support the use of JAX-RS resource classes as controllers in the MVC 1.0 JSR.<br />
<br />
There is already a discussion around hypermedia and the challenges of supporting structural links in JAX-RS. Looking forward for a good way to deal with hypermedia and create better / intelligent APIs.<br />
<br />
That is about it, let's see how it goes from now!<br />
<br />
See ya!Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com451tag:blogger.com,1999:blog-4330258964103566232.post-63399712308625097752014-03-13T10:07:00.000-03:002014-06-17T09:58:06.206-03:00How the Java Community Process (JCP) works and how to contribute? #adoptajsr<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8qlFvW-MGAGIyKbFwLn9_ORQ1Zo2qpSz0Y8Wttflv75sbko7UadB_nm4rK90WH-jje6lTaLc3I0Vx57vJKTI6Ut9Mxp-SOoPl7eAIM_Y776zndJ_Hajt1BOElVLXJpwja6uOK_HgLDhEk/s1600/jcp-flow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<span class="" id="result_box" lang="en"><span class="hps">The</span> <span class="hps alt-edited">purpose of this article</span> <span class="hps">is to show</span> <span class="hps">more clearly</span> <span class="hps">through a</span> <span class="hps">workflow</span><span class="alt-edited">, how</span> <span class="hps">the JCP</span> <span class="hps">works</span> <span class="hps">and what actions</span> <span class="hps">can be taken</span> <span class="hps">by the community to</span> <span class="hps">assist in this process</span><span class="">.</span> <span class="hps">The following figure</span> <span class="hps">shows how</span> <span class="hps">the process works</span><span class="">,</span> <span class="hps">and instructions</span> <span class="hps">on how</span> <span class="hps">you can help</span>. T<span class="hps">hese are some</span> <span class="hps">ways to contribute</span><span class="">, although</span> <span class="hps">there must be</span> <span class="hps">others that</span> <span class="hps">were not mentioned</span><span class="">.</span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHD6AV6XVj8G6F_ttSZR5vFYBDgpsT1Ojultn5gb3UxYMWXNWwu6uW3q0XEA4jk_3KLF4qxr_-wAMqzTSuh-Xatn-R3PsBEaSOKGAqn9voRBh7pu8BqWQMMHVUpCoRX56_HwqquWf5xNaF/s1600/jcp-flow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHD6AV6XVj8G6F_ttSZR5vFYBDgpsT1Ojultn5gb3UxYMWXNWwu6uW3q0XEA4jk_3KLF4qxr_-wAMqzTSuh-Xatn-R3PsBEaSOKGAqn9voRBh7pu8BqWQMMHVUpCoRX56_HwqquWf5xNaF/s1600/jcp-flow.png" height="385" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span class="" id="result_box" lang="en"><span class=""><br /></span></span>
<br />
<div id="gt-src-tools">
<div id="gt-src-tools-l">
<div id="gt-input-tool" style="display: inline-block;">
<div id="itamenu">
<span class="ita-kd-inputtools-div"></span></div>
</div>
</div>
</div>
<div class="almost_half_cell" id="gt-res-content">
<div dir="ltr" style="zoom: 1;">
<span class="" id="result_box" lang="en"><span class="hps">As you can see</span> <span class="hps">the process</span> <span class="hps">has several</span> <span class="hps">steps</span><span class="">,</span> <span class="hps">and some</span> <span class="hps">encourage participation</span> <span class="hps">and</span> <span class="hps alt-edited">collaboration of the community</span><span class="">.</span> <span class="hps">Following</span> <span class="hps">you can</span> <span class="hps">understand what</span> <span class="hps">is</span> <span class="hps">done in each</span> <span class="hps alt-edited">of these steps and</span> <span class="hps alt-edited">how much time they take</span> <span class="hps alt-edited">to be</span> <span class="hps">completed</span><span class="">.</span></span></div>
</div>
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<b>JSR Submission</b></div>
<div class="MsoNormal" style="text-align: left;">
<span style="font-size: x-small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="color: black; line-height: 115%;"></span></span></span></div>
The process starts with the submission of a new JSR through a JCP Member. <br />
<br />
<b>JSR Review (2 to 4 weeks)</b><br />
The next step, after submission, is the JSR Review. During this period the public can review and comment on a proposed new JSR
before the JSR Approval Ballot.<br />
<br />
<b>Approval Ballot and Expert Group Formation (14 days)</b><br />
The JSR Review é followed by JSR Arpproval Ballot, when the Executive Committee votes to approve or reject the proposal.
<br />
<br />
<b>Early Draft Review (30 to 90 days)</b><br />
Once a JSR is approved, a group of experts is formed to develop a first
draft of the specification that both the community and the Executive
Committee review. Members who have signed a JSPA and wish to nominate an
Expert to serve on one or more of the Expert groups can do so by
submitting a nomination request. When an Expert Group completes the first draft of their specification,
they will make it available to the public for Early Draft Review. The
Expert Group uses the feedback from the review to revise and refine the
draft.<br />
<br />
<b>Public Review (30 to 90 days)</b><br />
Next, the JSR draft goes for public review and anyone with internet connection can read and comment. <br />
<br />
<b>Public Review Ballot (14 days)</b><br />
At the end of the review, the Executive
Committee will decide if the draft shall go to the next step.<br />
<br />
<b>Proposed Final Draft (</b><b><span class="short_text" id="result_box" lang="en"><span class="hps">Undetermined</span></span>)</b><br />
The Expert Group uses the public feedback to further revise the document into a Proposed Final Draft.<br />
<br />
<b>Final Approval Ballot (14 days)</b><br />
The leader of the Expert Group then sees that the reference
implementation and its associated Technology Compatibility Kit are
completed before sending the specification to the Executive Committee
for final approval.<br />
<br />
<b>Final Release (</b><b><b><span class="short_text" id="result_box" lang="en"><span class="hps">Undetermined</span></span></b>)</b><br />
Once approved, the final specification, reference implementation and Technology Compatibility Kit are published.
<br />
<br />
<b>Maintenance Review (30 days)</b><br />
A period of at least 30 days prior to finalization of a Maintenance
Release when Members and the public consider and comment on the change the
Maintenance Lead proposes to include in the release, as identified in the associated Issue
List.<br />
<br />
<b>Maintenance Review Ballot (7 days)</b><br />
The Executive Committee votes to approve all proposed changes to a
specification to be carried out immediately or reject the changes and
thus either require the Maintenance Lead to submit a revised list of
changes, or defer the changes until the specification can be revised by
an expert group in a new JSR. Challenges to one or more tests in a
specification's Technology Compatibility Kit are ultimately decided by
the Executive Committee if they cannot be otherwise resolved.<br />
<br />
<span class="" id="result_box" lang="en"><span class=""></span></span><span class="" id="result_box" lang="en"><span class="hps">Once you</span> <span class="hps">understand</span> <span class="hps">how each</span> <span class="hps">step works</span><span class="">, the</span> <span class="hps">question that</span> <span class="hps">must</span> <span class="hps">be popping up</span> <span class="hps">is</span><span class="">:</span> <b><span class="hps">How to give</span> <span class="hps">feedback</span><span class="">?</span></b> <br /><span class="hps">To give feedback to the JCP you can use the members@adoptajsr.java.net mailing list or if it is specifically about a spec, you can use the mailing lists of the specification itself that you will find on jcp.org.</span></span><br />
<br />
<span class="" id="result_box" lang="en"><span class="hps"><span style="font-family: inherit;"><span style="font-size: small;"><b>Glossary</b></span></span><br />
<br />
<u>Executive Committee (EC)</u><br />
</span></span><span class="" id="result_box" lang="en"><span class="hps">The Members who guide the evolution of the Java
technologies. The EC represents a cross-section of both major stakeholders and other
Members of the Java community. EC members are appointed in an annual election
process. </span></span><br />
<span class="" id="result_box" lang="en"><span class="hps"><br />
<u>Expert Group (EG)</u></span></span><br />
<span class="" id="result_box" lang="en"><span class="hps">The group of Experts who develop or make significant revisions to a
Specification. </span></span><br />
<span class="" id="result_box" lang="en"><span class="hps"><br />
<u>Java Specification Participation Agreement (JSPA)</u><br />
</span></span>A one-year renewable agreement
between Oracle America and a company, organization or individual that allows the latter
entities to participate in the Java Community Process.
<span class="" id="result_box" lang="en"><span class="hps"></span></span><br />
<span class="" id="result_box" lang="en"><span class="hps"><br /></span></span>
<span class="" id="result_box" lang="en"><span class="hps">I hope this</span> <span class="hps">post</span> <span class="hps">had</span> <span class="hps">contributed to</span> <span class="hps">a better understanding</span> <span class="hps">of the</span> <span class="hps">JCP</span>, <span class="hps">share</span> <span class="hps">if you like</span> <span class="hps">and let</span> <span class="hps">other</span> <span class="hps">people have access to</span> <span class="hps">this information</span>. <span class="hps">My</span> <span class="hps">twitter</span> <span class="hps">is</span> <span class="hps">@</span><span class="hps">ivanjunckes</span> <span class="hps">if you want to</span> <span class="hps">talk about it</span><span class="">!</span></span><br />
<br />
<span class="" id="result_box" lang="en"><span class="">See you soon! </span></span><br />
<br />
<br />
Source: <a href="https://jcp.org/en/home/index" target="_blank">https://jcp.org/en/home/index</a>Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com197tag:blogger.com,1999:blog-4330258964103566232.post-79581655183379062792013-10-10T10:20:00.002-03:002013-10-10T10:36:47.652-03:00Getting started with SOAAn important matter when we are thinking of SOA adoption is to know how to get started. At this stage many questions come to our minds and if we don't have someone with experience to show us the way, could be a big challange to understand the whole concept of SOA and apply it in real life. This article aims to give you a overall guideline showing how you can quickly get started.<br />
<br />
The transition to SOA can be addressed in many different ways, it all depends on how mature is your company's IT, as well as the reasons for adopting SOA. A SOA adoption can be thought of as continuum with four broad levels, and each level you reach will bring you better business value.<br />
<ol>
<li>Implementing individual web services. In this level companies create web services from tasks in existing or new applications.</li>
<li>Service oriented integration of business functions. In this level, companies integrate two or more applications using web services or other service oriented architectures.</li>
<li>Enterprise wide IT transformation. In this level, companies can use SOA as their standard for exposing application functions; companies are able to use SOA to integrate to any application.</li>
<li>On demand business transformation. In this level, companies are able to change their software and partners quickly in order to meet the changing needs of the business. </li>
</ol>
Let's now detail each of the previous levels, showing ways of putting them in practice:<br />
<br />
<b>Level 1</b><br />
<ul>
<li>Exposing functions of an existing application as web services.</li>
<li>Creating a new application using web services from another application.</li>
<li>Creating a new application that contains web services and uses those web services. </li>
</ul>
<b>Level 2 </b><br />
<ul>
<li>Analyzing two applications in order to determine what services are needed.</li>
<li>Choose SOA infrastructure and tools, creating standards, and so forth</li>
</ul>
At this level governance is becoming important.<br />
<br />
<b>Level 3 and 4 </b><br />
<br />
When starting with enterprise wide IT transformation or on demand business transformation, governance and executive buy-in are critical. Starting at this level is usually part of a strategic transformation of business that involves analyzing the company's current state, the company's strategy, the company's IT systems, the trends in the company's industry, and technology trends.<br />
<br />
Transitions that start at these top two levels frequently involve many steps and include steps to verify assumptions and validate decisions made in previous steps. These verifications can include reviews by experts, as well as testable prototypes for measuring quality of service factors such as performance and usability.<br />
<br />
That's all folks, hope this article can help you to get started with SOA in your company!<br />
<br />
Bye!<br />
<br />
<br />
Source:<br />
VW003 - Introducing the Value and Governance Model of Service-Oriented Architecture, IBM Corporation, 2007.<br />
<br />
<br />Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com8tag:blogger.com,1999:blog-4330258964103566232.post-57337591829531220472013-09-27T11:13:00.002-03:002014-03-12T17:15:26.220-03:00JAX-RS 2.0 Client API Generic Type Response EntityHi folks!<br />
<br />
The last <a href="http://www.ivanjunckes.com/2013/08/rest-jax-rs-20-jersey-client-api.html" target="_blank">POST</a> we learned how to use the new JAX-RS 2.0 Jersey API, you can read the introduction there. Today we will talk about the detail that was missing for reading JSON responses that uses a generic type. <br />
<br />
The code below shows how to setup the WebTarget with the URI you want to request and then it is executed when you call the get() method. Note that this is not different from the first example.<br />
<pre class="brush: java;">
Client orderClient = ClientBuilder.newClient();
WebTarget target = orderClient.target("http://localhost:8082/rest-client-api-example/resources/orders");
Response response = target
.request(MediaType.APPLICATION_JSON)
.get();</pre>
So, now we will see what really makes the difference using generics. The following line shows how a generic type should be read.<br />
<br />
<pre class="brush: java;"> List<order> orders = response.readEntity(new GenericType<List<Order>>() {});
</pre>
<br />
It doesn't look good, but this anonymous class will do the trick. Remember that you need all the <a href="https://github.com/ivanjunckes/rest-client-api-example/blob/master/pom.xml" target="_blank">dependencies</a> listed at my <a href="https://github.com/ivanjunckes/rest-client-api-example/" target="_blank">github</a> to make this work properly.<br />
<br />
This is it, I hope it helped!Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com67tag:blogger.com,1999:blog-4330258964103566232.post-58569306307435679572013-08-29T15:29:00.000-03:002014-03-12T17:15:42.791-03:00REST JAX-RS 2.0 Jersey Client APIHello, everyone!<br />
<br />
This post will show an example of how can you use the new JAX-RS 2.0 Client API from Jersey.<br />
<br />
For this project we will use JBOSS AS 7.1 (Port 8082) with Maven and our plan is to consume a REST service asking for an "Order" passing an <b>id</b> as a parameter.<br />
<br />
So let's get started!<br />
<br />
This first line of code will give you a new instance of the client.<br />
<pre class="brush: java;">Client orderClient = ClientBuilder.newClient();
</pre>
<br />
The next step is to make a <b>GET</b> request to a WebTarget (A resource target identified by the resource URI) asking for the "Order".
<br />
<pre class="brush: java;"> WebTarget target = orderClient
.target("http://localhost:8082/rest-client-api-example/resources/orders/{id}");
Response response = target
.resolveTemplate("id", 1) // Resolves the {id} template
.request(MediaType.APPLICATION_JSON)
.get();
</pre>
Note that you also could use another http method like post(), put() or any other you choose. After that you just have to check if the response is OK (Status code 200) and read the entity, if you are trying to read a List<Order> it will be a bit tricky and I will be writing a post just for this case (The code for this is under <a href="https://github.com/ivanjunckes/rest-client-api-example" target="_blank">github</a>, check that out).<br />
<pre class="brush: java;">
if(response.getStatus() == Status.OK.getStatusCode()){
Order order = (Order) response.readEntity(Order.class);
System.out.println("Id: " + order.getId());
System.out.println("Name: " + order.getName());
System.out.println("Price: " + order.getPrice());
}else{
System.out.println(response.getStatus() + " " + response.getStatusInfo());
}
</pre>
So if the service is running and everything is ok, you will get the Order correctly from the server and it will be printed in the console. <br />
<br />
The full example with maven configuration and code is under <a href="https://github.com/ivanjunckes/rest-client-api-example" target="_blank">https://github.com/ivanjunckes/rest-client-api-example</a> repository, be free to fork it. There you also will find the REST service and the client implementation. <br />
<br />
See you next time! Thanks. Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com6tag:blogger.com,1999:blog-4330258964103566232.post-10091815567118777162013-07-30T09:42:00.001-03:002013-07-30T09:42:09.435-03:00SOA Life Cycle<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-iNxw88eEVuFkuApTCQA9E26JziEGIi6Qf-x-u_ghHG3K7HYDTAn5cFcjxOcSOwaWpCgcSjRaT7KUB5fnYcl2769SOS_RyN2ph8v3QkTuzZ513p_gWqsVS0xLtMq0JQreyxUlNZW1UcMT/s1600/cwesb_security_3.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a><br />
Hello everyone, this article will show how SOA Life Cycle works and what happens in each one of the stages.<br />
<br />
<b>Model</b><br />
<br />
The first step in a service-oriented architecture project has little to do with technology and everything to do with your business. The first step is to establish what these business activities or processes actually are.<br /><br />In the model phase you start by gathering business requirements and then you design and optimize their desired business process.<br /><br />By simulating, or modeling, your business processes before you write a line of code, you gain a much deeper understanding of them before looking for trying to build software that helps you carry them out.<br /><b> </b><br />
<b>Assemble</b><br />
<br />
After business processes are modeled and optimized, developers can implement them by building new services or by reusing existing services, and then assembling them to form composite applications. The assemble phase is about finding functionality that already exists and service-enabling it.<br /><br /><b>Deploy</b><br />
<br />
When they are modeled and assembled, the assets that make up your SOA are deployed into a secure and integrated environment. The deployment needs to meet the performance and availability needs of your business.<br /><br />
<b>Manage</b><br />
<br />
The deployed system must be managed and monitored, both from an IT and business perspective. Information gathered during the manage step is used to gain real-time insight into business processes, enabling better business decisions and feeding information back into the life cycle for continuous process improvement. You deal with issues such as quality of service, security, and general system administration.<br />
<br />In this step, you monitor and optimize the system, finding and correcting inefficiencies and problems.<br />
Because SOA is an iterative process, the completion of this step is the start of a new model phase.<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-iNxw88eEVuFkuApTCQA9E26JziEGIi6Qf-x-u_ghHG3K7HYDTAn5cFcjxOcSOwaWpCgcSjRaT7KUB5fnYcl2769SOS_RyN2ph8v3QkTuzZ513p_gWqsVS0xLtMq0JQreyxUlNZW1UcMT/s1600/cwesb_security_3.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-iNxw88eEVuFkuApTCQA9E26JziEGIi6Qf-x-u_ghHG3K7HYDTAn5cFcjxOcSOwaWpCgcSjRaT7KUB5fnYcl2769SOS_RyN2ph8v3QkTuzZ513p_gWqsVS0xLtMq0JQreyxUlNZW1UcMT/s1600/cwesb_security_3.gif" /></a></div>
<br />
Source:<br />
http://pic.dhe.ibm.com/infocenter/esbsoa/wesbv7r5/index.jsp?topic=%2Fcom.ibm.websphere.wbpm.scenarios.esb1.doc%2Ftopics%2Fcwesb_security.html<br />
VW003 - Introducing the Value and Governance Model of Service-Oriented Architecture, IBM Corporation, 2007.<br />
<br />Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com7tag:blogger.com,1999:blog-4330258964103566232.post-2830020158485327772013-07-22T17:13:00.000-03:002013-07-30T09:42:32.918-03:00What is Service Oriented Architecture (SOA)?This article will give you an introduction about what is Service Oriented Architecture (SOA) and the different roles that interact with this.<br />
<br />
Let's start, <b>describing a Service:</b><br />
<br />
From a business view, a service is what is needed to support the business process. Think about what your company does on a day to day basis and break those business processes up into repeatable business tasks or components.<br />
<br />
<b>What is a Service?</b><br />
<br />
A repeatable business task.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfVyhuELExP-mwB7HduKdSDryLweUmonrsKhV9X5gOa5NsiGYsd9Pj4OJaSBJd3zDZ100uDGnr9pdrShJBLsN2p3EiH1kYeGH8HCHJCDBkCQuft5LI186xjCFv539-BwFb4SvM9XWdBXcx/s1600/service.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfVyhuELExP-mwB7HduKdSDryLweUmonrsKhV9X5gOa5NsiGYsd9Pj4OJaSBJd3zDZ100uDGnr9pdrShJBLsN2p3EiH1kYeGH8HCHJCDBkCQuft5LI186xjCFv539-BwFb4SvM9XWdBXcx/s400/service.png" width="400" /></a></div>
<br />
A service is an application component deployed on a network-accessible platform hosted by the service provider. Its interface is described by a service description to be invoked by or to interact with a service requester.<br />
<br />
Services are functions or operations accessible across a network with:<br />
<ul>
<li>Well-defined interfaces.</li>
<li>Well-defined quality of service capabilities.</li>
<li>Well-known endpoints. An endpoint is a destination on the network that receives service requests.</li>
</ul>
<u>Service providers</u><br />
<ul>
<li>Offer services with published interfaces, policies and endpoints.</li>
</ul>
<u>Service consumers</u><br />
<ul>
<li>Use services and access them securely and reliably.</li>
</ul>
<u>Service mediators, handlers and intermediaries</u><br />
<ul>
<li>Provide extensible discovery, selection, metering, monitoring, logging, and more qualities of service.</li>
</ul>
<br />
<b>Describing the SOA architectural style</b><br />
<br />
You can adopt the architectural style that SOA supports by:<br />
<ul>
<li>Breaking business processes up into repeatable business tasks or components.</li>
<li>Assembling the solution by snapping components together.</li>
<li>Becoming service-oriented.</li>
</ul>
<br />
<b>What is a Service Orientation?</b><br />
<br />
Building on the definition of a service, service orientation is a way of integrating your business as linked services and, more importantly, the outcomes that they bring.<br />
<b><br />What is SOA?</b><br />
<br />
SOA is the IT architectural style that supports the service orientation thought process and makes it a reality.<br />
<br />
Services are repeatable business tasks. Business processes are a series of services snapped together like building blocks. SOA is an architectural style that makes this possible.<br />
<br />
SOA helps make building and adjusting composite applications fast and easy.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLEMk7s2GTYeZu31AjAkVXiwSVv1FL5KfGF96PXHB1k5EIIyd9gZKempQoyJ1SqDfxlmltu2Ab25xDH2OtJ3iTP9zDjuPKyWv9yocqEPkR6HwZ9i4QjDJbXl4YwNXp5JjJFrTtUhZnFFFz/s1600/soa.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="277" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLEMk7s2GTYeZu31AjAkVXiwSVv1FL5KfGF96PXHB1k5EIIyd9gZKempQoyJ1SqDfxlmltu2Ab25xDH2OtJ3iTP9zDjuPKyWv9yocqEPkR6HwZ9i4QjDJbXl4YwNXp5JjJFrTtUhZnFFFz/s400/soa.png" width="400" /></a><br />
<br />
<b>SOA in different Roles</b><br />
<br />
<u>Business Managers</u><br />
<br />
SOA provides business managers with capabilities to expose a set of services to clients and partner organizations.<br />
<br />
<u>Business Architects</u><br />
<br />
SOA is an architectural style that requires a service provider, requester, and a service description. It addresses characteristics such as loose coupling, reuse, and simple and composite implementations.<br />
<br />
<u>Implementation</u><br />
<br />
SOA is a programming model complete with standards, tools, methods, and technologies such as Web Services.<br />
<br />
<u>Operations</u><br />
<br />
SOA is a set of agreements among service requesters and service providers that specify the quality of service and identify key business IT metrics.<br />
<br />
In the next articles we will continue to talk about SOA.<br />
<br />
<br />
<br />
Source: VW003 - Introducing the Value and Governance Model of Service-Oriented Architecture, IBM Corporation, 2007.Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com232tag:blogger.com,1999:blog-4330258964103566232.post-30762972192192341852013-07-16T20:18:00.000-03:002013-07-19T10:35:23.919-03:00REST - PaginationPagination is essential when retrieving information from webservices. Sometimes, we have scenarios like mobile applications where a large amount of data can bring problems. This article aims to show how Facebook API deals with this, and also display an example of query string pagination using JAX-RS (Jersey) and JPA (Hibernate).<br />
<br />
The Facebook's platform supports three types of pagination using query string: <br />
<br />
<u>Cursor-based</u><br />
<ul>
<li><b>before</b> - This is the cursor that points to the start of the page of data that has been returned. </li>
<li><b>after </b>- This is the cursor that points to the end of the page of data that has been returned. </li>
<li><b>limit </b>- This is the number of individual objects that are returned in each page. </li>
</ul>
<br />
<u>Time-based</u><br />
<ul>
<li><b>until </b>- A Unix timestamp or <a href="http://php.net/manual/en/function.strtotime.php">strtotime </a>data value that points to the end of the range of time-based data. </li>
<li><b>since </b>- A Unix timestamp or <a href="http://php.net/manual/en/function.strtotime.php">strtotime </a>data value that points to the start of the range of time-based data. </li>
<li><b>limit </b>- This is the number of individual objects that are returned in each page.</li>
</ul>
<br />
<u>Offset-based</u><br />
<ul>
<li><b>offset </b>- This offsets the start of each page by the number specified.</li>
<li><b>limit </b>- This is the number of individual objects that are returned in each page.</li>
</ul>
<u>Example</u><br />
This example will stick to the Offset-based pagination, but you can choose the one that fits your requirements.<br />
<br />
<pre class="brush: java;">@GET
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public List<Order> getOrders(
@QueryParam("offset") Integer offset,
@QueryParam("limit") Integer limit){
Query q = _em.createQuery("from Order");
if(offset != null){
q.setFirstResult(offset);
}
if(limit != null){
q.setMaxResults(limit);
}
return (List<Order>) q.getResultList();
}</pre>
<br />
The URL to access this would be:<br />
<pre class="brush: java;">
/**
* This URL would return the limit of 20 orders starting from order number 20.
**/
http://www.ivanjunckes.com/resources/orders?offset=20&limit=20
</pre>
<br />
The previous code shows a good path for doing pagination with REST and JAVA. However, there are some other ways of doing pagination, but this is a topic for another article.<br />
<br />
See you later!<br />
<br />
Source:<br />
https://developers.facebook.com/docs/reference/api/pagination/ Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com5tag:blogger.com,1999:blog-4330258964103566232.post-65196391906995859862013-06-25T10:31:00.001-03:002013-06-25T10:31:01.977-03:00REST - Resource NamingREST can help a lot when we talk about integration, however not used correctly, it could bring future problems. This article will talk about some of the best practices for creating a REST API.<br />
<br />
<b>Use nouns instead of verbs</b><br />
<br />
Keep the URI simple and intuitive. This will leave the API with a easier understanding and better to work with. A good way to test if the API was written correctly is making sure it has only 2 base URIs. For example:<br />
<br />
This will return a collection of orders.<br />
<pre class="brush: java;"> /orders
</pre>
This can be used to <b>GET </b>(READ), <b>POST </b>(CREATE), <b>PUT </b>(UPDATE) or <b>DELETE </b>depending on the HTTP verb chosen.<br />
<pre class="brush: java;">/orders/{orderId}
</pre>
This would return a collection of items from that particular order.<br />
<pre class="brush: java;">/orders/{orderId}/items</pre>
Using URIs with a non consistent pattern (using verbs) could end up causing a bigger effort for developers to understand and use the API. <br />
<pre class="brush: java;">/getAllOrders
/getOrderItems
</pre>
<br />
<b>Plural nouns </b><br />
<br />
Being consistent, establishing patterns, when designing a API is very important. Another common guideline is using plural nouns. Observe that finding resources in REST can be compared to search for documents in a disk. <br />
<pre class="brush: java;">/documents //(this would bring a list of documents)
/orders //(this would bring a list of orders)
</pre>
The difference between these two is that in REST, when getting a particular resource, id should be passed to use the resource, differently from the file system that file name would do it.<br />
<br />
<b>Concrete names rather than abstract</b><br />
<br />
Sometimes developers look for a higher level of abstraction. Which sometimes bring less value for the API. Check out the next example:<br />
<br />
<u>Higher level of abstraction </u><br />
<pre class="brush: java;">/items
/assets
</pre>
<br />
<u>Lower level of abstraction</u><br />
<pre class="brush: java;">/blogs
/videos
/articles
</pre>
<br />
Using a higher level of abstraction, in this case, will not bring as much value for developers dealing with the api, while the lower level should allow the user to have a better understanding of the resources. This level, of course, should be defined accordingly to each cenario. <br />
<br />
Also expose a manageable number of resources. Aim for concrete naming and to keep the number of resources between 12 and 24.<br />
<br />
This is it for today, we will continue to talk about REST best practices in the next articles. Remember intuitive API uses plural rather than singular nouns and concrete rather than abstract names.<br />
<br />
<b>Source:</b><br />
Web API Design - Brian Mulloy<br />
http://apiux.com/2013/04/03/url-design-restful-web-services/<br />
<br />Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com2tag:blogger.com,1999:blog-4330258964103566232.post-13806648245931217962013-06-17T20:58:00.000-03:002013-06-17T21:09:55.564-03:00What is REST?<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<br />
REST (Representational State Transfer) has become popular these days because of the high need for integration what consequently makes it very important for every developer to know and understand. This article aims to give you a guidance in what rest is and how can you use it to improve your applications.<br />
<br />
REST describes an architectural style of networked systems such as web applications. It was first introduced in 2000 in a Ph.D dissertation by Roy Fielding, one of the principal authors of the HTTP specification. REST refers to a collection of architecture constraints and principles, which some will be shown next. <br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<br /></div>
<b>Uniform Interface</b><br />
<br />
The central feature that distinguishes the REST architectural style from other network based styles is its emphasis on a uniform interface between components. Components can be origin servers, gateways, proxies or user agents (browsers).<br />
<br />
The term uniform interface is used to describe how a (small) number of verbs with well-defined and widely accepted semantics are sufficient to meet the requirements of most distributed applications. A collection of verbs is used for communication between systems. You can check the example below which uses these verbs.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0_fN91XVvCgH-xDeerUurWne80SgV0y2ZtCunl02KPRNAT1sbLOpcO4YpzSjOxwkxyD4pRcUG8EVxTzHn8CURAKIVBFJDy4J7OoLJNMKVqDrR10vRXoZsLzEWorXBldT2jlzqh-sTFagf/s1600/Verbs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0_fN91XVvCgH-xDeerUurWne80SgV0y2ZtCunl02KPRNAT1sbLOpcO4YpzSjOxwkxyD4pRcUG8EVxTzHn8CURAKIVBFJDy4J7OoLJNMKVqDrR10vRXoZsLzEWorXBldT2jlzqh-sTFagf/s1600/Verbs.png" /></a></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: PT-BR; mso-no-proof: yes;"><br /></span><span lang="EN-US" style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-font-weight: bold; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: PT-BR;"></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
REST is defined by four interface constraints: identification of resources, manipulation of resources through representations, self-descriptive messages, and, hypermedia as the engine of application state.</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<br /></div>
<b>Identification of resources</b><br />
<br />
The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a collection of other resources or even a person. REST uses a URI (unique resource identifier) to identify the particular resource involved in a interaction between components, as you saw on the previous example where a <i>order </i>is identified by<i> /order/{orderId}.</i><b> </b><br />
<br />
<b>Representations </b><br />
<br />
REST components perform actions on a resource by using a representation to capture the current or intended state of that resource. Representations consists of data or metadata describing the data. The response should include both, representation metadata and resource metadata. This data format of a representation is known as media type. A resource can be provided in multiple media types and you can choose the one that best fits the application.<br />
<br />
You could ask the server to give you a "order" with the media type <i>application/json</i>, for example, because your client is mobile so you need less data. Or maybe you have an external client that needs to read another format like XML, then he just have to ask the server for an <i>application/xml</i> and it will give you the data you want.<br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<br /></div>
<b>Stateless</b><br />
<br />
This is an important principle of REST which requires that every interaction between components must be stateless. It means that every response must have all the information for that request to be fully understood. The right way of controlling state in REST is using HATEOAS. <b></b><br />
<br />
<b>Hypermedia as the engine of application state (HATEOAS)</b><br />
<br />
REST concentrates all the control state into the representations received in response to interactions. The goal is to improve server scalability by eliminating any need for the server to maintain an awareness of the client state beyond the current request. On the example below you can see that the order already gives you the link within payment for the next transaction step maintaining the transaction control on the client-side.<br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGA9uag_ns-wgwqlKYNMx5J-7Mgz0LiNX-U6gd4fQppKXUuR9Z_IAI6Z9aeO61d1LQByCesjpu_qbJUv1ZvNwK-j__90iV6qBXGvWa2Dd_ZhaWT5yuxmUAKZM1G-yxfRgxVJzPE99nJ2Sy/s1600/HATEOAS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGA9uag_ns-wgwqlKYNMx5J-7Mgz0LiNX-U6gd4fQppKXUuR9Z_IAI6Z9aeO61d1LQByCesjpu_qbJUv1ZvNwK-j__90iV6qBXGvWa2Dd_ZhaWT5yuxmUAKZM1G-yxfRgxVJzPE99nJ2Sy/s1600/HATEOAS.png" /></a></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 2;">
<br />
<b>Self-descriptive messages</b><br />
<br />
Another constraint of REST is that messages should be self-descriptive and with all information needed for the task to be completed.</div>
<br />
Well, that’s it. Now you have a guidance in how REST works. We’ll continue to talk about it in further articles. <br />
<br />
See you later!<br />
<br />
<b>Source:</b><br />
<br />
Roy Thomas Fielding dissertation, 2000.<br />
REST in Practice book, 2010.<br />
<div class="MsoNormal">
<br /></div>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves>false</w:TrackMoves>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>PT-BR</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Tabela normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
</style>
<![endif]-->Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com140tag:blogger.com,1999:blog-4330258964103566232.post-29848715483904256132013-06-05T22:12:00.001-03:002013-06-14T16:09:15.266-03:00Restful project with Maven Archetype and JerseyHi everyone, this is my first post and hope you like it.<br />
<br />
Today we will talk about building a Restful project using maven and jersey libraries. For this to be possible maven archetype, a tool to build projects out of templates, will be used.<br />
<br />
In this tutorial we will be using command line maven, you can download and follow the installation intructions on <a href="http://maven.apache.org/download.cgi">http://maven.apache.org/download.cgi</a>.<br />
<br />
<br />
After installation follow the steps below:<br />
<br />
<b>1</b> - Go to your workspace and type:<br />
<br />
<div class="line number15 index14 alt2">
</div>
<pre class="brush: java;">mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2
</pre>
<br />
<b>2</b> - Archetypes will be downloaded from the catalog. After downloading you'll see this message "<b>Choose a number or apply a filter</b>", type<b> 3</b>.<br />
<br />
<b>3</b> - After selecting rest archetype, you will fill the project configuration information according to the example below: <br />
groupId - <b>br.com.restful</b> <i>(Identifies your project uniquely between all your projects)</i><br />
artifactId - <b>blog-restful-webapp</b> <i>(Represents the war name without version)</i><br />
version - <b>1.0</b> <i>(Identifies the project version)</i><br />
package - <b>br.com.restful</b> <i>(Represent the package structure)</i><br />
<br />
<b>4</b> - Next, a confirmation message will show up, just type <b>Y </b>and your project will be created. <br />
<br />
<b>5</b> - After the project have been created, type: <br />
<br />
<pre class="brush: java;">cd PROJECT_NAME
mvn clean install (Clean and build)
</pre>
<br />
<b>6</b> - The result of previous step should be <b>BUILD SUCCESS</b>, which means that now you already have your rest project fully configured, compiling and ready to be executed.<br />
<br />
After doing all these steps you will have import the project into your IDE. In this example eclipse will take place, but be free to use your prefered IDE since maven is IDE agnostic.<br />
Open eclipse and click with the mouse right button on <b>Project Explorer -> Import -> Existing Maven Projects</b>, select your project and click <b>Finish.</b><br />
<br />
<br />
<div style="text-align: center;">
<img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi5t-kSrtaAo7ByVV61mqlKRkHbfe4dMqrsq6GKE0GhR488PZ0_wtzaAhovzdjqKXiLrMCZcG86eG3maLrHrPj1dZzVFNQxNGGSneSf9WVph8ixpBWI-PQjLyPgXgiZued7yCIhl3T9O_H/s320/import.png" width="316" /></div>
<br />
Now you can take a look on the class created by the template in<b> br.com.restful.MyResource</b>.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWy0eZy__vgAzQ4BqvRQloVJoYsRzFf_KqBWSEpEbUVmjuMQ6ROoQsSemuI0aLKKLOjVy8ebhQ_prrGYG-az7YNjNWpzDW3R_bDK2piHJ6Wtu0s6EVDEObd1iwsO2rRK2-vSp87Gd2Ubf0/s1600/classe.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWy0eZy__vgAzQ4BqvRQloVJoYsRzFf_KqBWSEpEbUVmjuMQ6ROoQsSemuI0aLKKLOjVy8ebhQ_prrGYG-az7YNjNWpzDW3R_bDK2piHJ6Wtu0s6EVDEObd1iwsO2rRK2-vSp87Gd2Ubf0/s400/classe.png" width="400" /></a></div>
<br />
<br />
Next, click on the mouse right button over the project and run on your server. In this example we used Tomcat 6. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX4JyUZphMtVPnXKDSpKQy7voG9QJ0cJHGX0n0Gu1edNssRsjR0ZCdk9me9z9-7YHSRL9RIfPcf-gKHzpWSy8YFIwZCOpDrRZAai377LicTr8cH_PE7DIYTJmL2FpNbUudmf21Bm7mde9B/s1600/run+server.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX4JyUZphMtVPnXKDSpKQy7voG9QJ0cJHGX0n0Gu1edNssRsjR0ZCdk9me9z9-7YHSRL9RIfPcf-gKHzpWSy8YFIwZCOpDrRZAai377LicTr8cH_PE7DIYTJmL2FpNbUudmf21Bm7mde9B/s320/run+server.png" width="320" /></a></div>
<br />
A page like this should appear.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMlyTBfpHeg4Nbfzvn8W1kwJLJ0RtE9GddswJuZK8M2CmrOgzrkdRHEyb5htKRwVN7pp5mcV5Azpv1gkVWyAzvVq1mICAI9AYlFNFsfIfJWMs7AshPmxez75cXJO2nTWbhWEt00T2v1-1Q/s1600/pagina+inicial.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="139" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMlyTBfpHeg4Nbfzvn8W1kwJLJ0RtE9GddswJuZK8M2CmrOgzrkdRHEyb5htKRwVN7pp5mcV5Azpv1gkVWyAzvVq1mICAI9AYlFNFsfIfJWMs7AshPmxez75cXJO2nTWbhWEt00T2v1-1Q/s320/pagina+inicial.png" width="320" /></a></div>
<br />
To access the GET method you just have to access the link: <br />
<a href="http://localhost:8080/blog-restful-webapp/webresources/myresource">http://localhost:8080/blog-restful-webapp/webresources/myresource</a>, remember that port should be set accordingly to the server configuration. On this case we used tomcat default port which is 8080.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAXMKtbwAf4BawSg1SghqFME3RNunWmCMHp9hmT32XJKObSrBmxJbBqXE2uJsOtlCymWDRmmILWZ2dkMUidc-bt71S8yKNeRh2vTN0YSy8aaUNe2fDxvshkGSIFCcdVPVRJK4vYeoe8zRd/s1600/pagina+hi+there.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="90" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAXMKtbwAf4BawSg1SghqFME3RNunWmCMHp9hmT32XJKObSrBmxJbBqXE2uJsOtlCymWDRmmILWZ2dkMUidc-bt71S8yKNeRh2vTN0YSy8aaUNe2fDxvshkGSIFCcdVPVRJK4vYeoe8zRd/s400/pagina+hi+there.png" width="400" /></a></div>
<br />
<br />
The template initial configuration <span class="short_text" id="result_box" lang="en"><span class="hps">establishes that all rest services stays below webresources. This could be easily changed but this is a subject for other post.</span></span><br />
<br />
<br />
Hope you enjoyed it and see you later.<br />
<br />
<b>Source: </b><br />
<a href="http://docs.oracle.com/cd/E19226-01/820-7627/giqdq/">http://docs.oracle.com/cd/E19226-01/820-7627/giqdq/</a><br />
<br />Ivan Junckes Filhohttp://www.blogger.com/profile/14485978757435393124noreply@blogger.com14