Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 48f8ec3

Browse files
committed
Update README.MD
1 parent cf913a0 commit 48f8ec3

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

examples/managed-client/README.MD

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,41 +40,6 @@
4040
4141
-->
4242

43-
Managed Beans Example
44-
=====================
45-
46-
This example demonstrates managed bean support in Jersey. JAX-RS root
47-
resource classes are annotated with @ManagedBean, which means EE-related
48-
resources may be injected into instances of those classes.
49-
50-
Content
51-
-------
52-
53-
The example application includes two root resource classes that are
54-
treated as Java EE managed beans. One root resource class is managed in
55-
the default JAX-RS life-cycle (one instance per request) and the other
56-
is managed in the singleton life-cycle (one instance per web
57-
application).
58-
59-
Two Java EE artifacts are injected into the singleton root resource. The
60-
first is a resource constant defined in the web.xml. The second is an
61-
entity manager factory to allow integration with JPA layer.
62-
63-
Running the Example
64-
-------------------
65-
66-
This sample utilizes Java EE features in GlassFish application server.
67-
68-
The easiest way to get the application running is to build it and deploy
69-
as follows:
70-
71-
mvn clean package
72-
$AS_HOME/asadmin deploy target/managed-beans-webapp.war
73-
74-
From a web browser, visit:
75-
76-
- <http://localhost:8080/managed-beans-webapp>
77-
7843
Managed Client Example
7944
======================
8045

@@ -94,7 +59,8 @@ URI path | Resource class | HTTP methods
9459
**_/internal/b_** | InternalResource | GET
9560

9661
In the example, the requests to a *public resource* deployed on
97-
`/public/` path are forwarded to an *internal resource* (deployed on `/internal/` path) using injected
62+
`/public/` path are forwarded to an *internal resource* (deployed on
63+
`/internal/` path) using injected
9864
[javax.ws.rs.client.WebTarget](https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/client/WebTarget.html)
9965
instances produced using 2 separate managed clients each of the managed
10066
clients using it's own custom configuration.
@@ -115,17 +81,17 @@ Running the Example
11581

11682
Run the example as follows:
11783

118-
> mvn clean compile exec:java
84+
> mvn clean package exec:java
11985
12086
This deploys current example on the local host. You can then access WADL
12187
description of the deployed application at
122-
<http://localhost:8080/managedclient/application.wadl>.
88+
<http://localhost:8080/managed-client-webapp/application.wadl>.
12389

12490
You can access public resource of this application using curl:
12591

126-
> curl -v -H "Accept: text/plain" http://localhost:8080/managedclient/public/a
92+
> curl -v -H "Accept: text/plain" http://localhost:8080/managed-client-webapp/public/a
12793
128-
> curl -v -H "Accept: text/plain" http://localhost:8080/managedclient/public/b
94+
> curl -v -H "Accept: text/plain" http://localhost:8080/managed-client-webapp/public/b
12995
13096
In this example you should see the returned response message body
13197
contains "a" or "b" respectively upon successful invocation.
@@ -134,16 +100,16 @@ You may also verify that access to internal resource is not possible
134100
without including a proper header in the request. First try to access
135101
the internal resource without any custom header:
136102

137-
> curl -v -H "Accept: text/plain" http://localhost:8080/managedclient/internal/a
103+
> curl -v -H "Accept: text/plain" http://localhost:8080/managed-client-webapp/internal/a
138104
139-
> curl -v -H "Accept: text/plain" http://localhost:8080/managedclient/internal/b
105+
> curl -v -H "Accept: text/plain" http://localhost:8080/managed-client-webapp/internal/b
140106
141107
In both cases a `HTTP 403 Forbidden.` response is returned. Now lets try
142108
to access the resource once again, but this time we'll include also the
143109
expected custom headers:
144110

145-
> curl -v -H "Accept: text/plain" -H "custom-header:a" http://localhost:8080/managedclient/internal/a
111+
> curl -v -H "Accept: text/plain" -H "custom-header:a" http://localhost:8080/managed-client-webapp/internal/a
146112
147-
> curl -v -H "Accept: text/plain" -H "custom-header:b" http://localhost:8080/managedclient/internal/b
113+
> curl -v -H "Accept: text/plain" -H "custom-header:b" http://localhost:8080/managed-client-webapp/internal/b
148114
149-
Finally, you should see the invocation succeeded and the returned response message body contains "a" or "b" respectively.
115+
Finally, you should see the invocation succeeded and the returned response message body contains "a" or "b" respectively.

0 commit comments

Comments
 (0)