Primož Kokol | 16 Apr 15:52 2014
Picon

Transparent reverse proxying using org.restlet.routing.Redirector

I am trying to create a transparent reverse proxy using org.restlet.routing.Redirector.

For the sake of simplicity let's say all I want to do is to redirect all requests pointing at

http://localhost:80

to be dispatched to another unrelated server:

http://localhost:8080

I've wrote a simple reverse proxy using Redirector (MODE_SERVER_OUTBOUND mode) and it actually works as
expected in the sense that it dispatches requests properly and also handles redirects.

But now let's say that resources at http://localhost:8080 are protected with Digest authentication mechanism.

Now the problem is that headers in requests and responses when handled by Redirector are removed which
makes Digest authentication mechanism unusable. 

From docs WRT MODE_SERVER_OUTBOUND:
----
Note that in this mode, the headers of HTTP requests, stored in the request's attributes, are removed
before dispatching. Also, when a HTTP response comes back the headers are also removed.
----

Is there any way to leave headers intact so that end server (http://localhost:8080) and clients could
communicate as there is no proxy in between?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3076621

(Continue reading)

Fabian Mandelbaum | 12 Apr 18:15 2014
Picon

Persisting credentials to be used with HTTP Digest authentication

Hello,

I'm trying to switch from HTTP Basic (through an HTTPS channel) to HTTP Digest (keeping the HTTPS channel) authentication.

I'm currently testing without HTTPS, and I was wondering how should my 'backend' store the user credentials.

Currently I'm using an MD5 hash of the password, so I cannot retrieve the 'clear text' password apparently needed by a LocalVerifier.

Is storing the clear text password the ONLY way I can use HTTP Digest authentication for my Restlet application, or is there another way where I can use HTTP Digest while keeping the password stored securely?

Thanks in advance for your answers.

--
Fabián Mandelbaum
IS Engineer
saurabh narayan singh | 11 Apr 08:36 2014
Picon

JSON response from validator

Is there any way that we can get a JSON Response from validator rather than the response object that we get
from response.setStatus() ??

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3076319

cdu | 5 Apr 06:42 2014
Picon

HTTPS Server with Jetty Connector, SSLv3

Trying to set up a Restlet HTTPS Server with a Jetty Connector.  here's what
I have coded up:

Component home = new Component();

Server homeServer = new Server(
            home.getContext().createChildContext(),
            Protocol.HTTPS, port, home);
DefaultSslContextFactory sslContextFactory = new DefaultSslContextFactory();
sslContextFactory.setProtocol("SSL");
sslContextFactory.setKeyStorePath(certPath);
sslContextFactory.setKeyStorePassword(keystore_pwd);
sslContextFactory.setKeyStoreKeyPassword(key_pwd);
sslContextFactory.setKeyStoreType("JKS");
homeServer.getContext().getAttributes().put("sslContextFactory",
sslContextFactory);

When starting up the server, I get the error below which I can't figure. 
Any help please?  Thx very much in advance!

Apr 04, 2014 9:39:57 PM org.restlet.ext.jetty.HttpsServerHelper
createConnector
WARNING: Unable to create the Jetty SSL context factory
java.lang.NullPointerException
	at java.security.Provider$ServiceKey.<init>(Provider.java:517)
	at java.security.Provider$ServiceKey.<init>(Provider.java:510)
	at java.security.Provider.getService(Provider.java:684)
	at sun.security.jca.ProviderList.getService(ProviderList.java:331)
	at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
	at javax.net.ssl.KeyManagerFactory.getInstance(KeyManagerFactory.java:139)
	at
org.restlet.ext.ssl.DefaultSslContextFactory.createSslContext(DefaultSslContextFactory.java:325)
	at
org.restlet.ext.jetty.internal.RestletSslContextFactory.<init>(RestletSslContextFactory.java:66)
	at
org.restlet.ext.jetty.HttpsServerHelper.createConnector(HttpsServerHelper.java:106)
	at
org.restlet.ext.jetty.JettyServerHelper.start(JettyServerHelper.java:393)
	at org.restlet.Server.start(Server.java:590)
	at org.restlet.Component.startServers(Component.java:611)
	at org.restlet.Component.start(Component.java:538)
[snip]

java.lang.NullPointerException
	at
org.restlet.ext.jetty.JettyServerHelper.configure(JettyServerHelper.java:203)
	at
org.restlet.ext.jetty.JettyServerHelper.start(JettyServerHelper.java:394)
	at org.restlet.Server.start(Server.java:590)
	at org.restlet.Component.startServers(Component.java:611)
	at org.restlet.Component.start(Component.java:538)
[snip]

--
View this message in context: http://restlet-discuss.1400322.n2.nabble.com/HTTPS-Server-with-Jetty-Connector-SSLv3-tp7579108.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3075894

Jerome Louvel | 28 Mar 00:32 2014

Restlet Framework 2.2.0 and 2.3 M1 released!

We are pretty happy to release this new major version, 1,5 years after 2.1.0. 

Almost 10 years after its launch, our open source project is thriving, with almost 90k downloads just for February!!

Check out the blog post for all details:

Tim | 27 Mar 18:33 2014
Picon

Dynamic Templates/Routing

I'm a new RESTlet user and I was wondering if it's possible to route dynamically based on templates
retrieved from a database in order to allow new templates to be added without changing any code? My plan is
to have a table of URL templates together with their mappings, per request type, to stored procedure
calls. The resource would then construct the stored procedure call based on which template was matched
and map the parameters in the template to the procedure parameters.

For example:

URL			Request		Stored Procedure
/customers		GET		CustomersGet()
			POST		CustomerCreate(name...)
/customers/{cus}	GET		CustomersGetById(cus)
/invoices		GET		InvoicesGet()
/invoices/{inv}		GET		InvoicesGetById(inv)

I wanted to have a single resource class that would be called for all templates that could, based on the
template that matched and the request, look-up the stored procedure and construct the call to it
dynamically by taking the parameters extracted by the framework and any supplied in the request body and
matching them to the stored procedure parameters. Unfortunately I couldn't find a way to get the template
that was matched.

The background behind this is that I am trying to create a system whereby new web applications can be
developed without changing any Java code, simply by implementing the relevant stored procedures in the
database and changing the configuration (it's not a problem if a server restart is required). All
resources, such as HTML pages, JPEGs, Freemarker templates etc. are stored in the backend database as
BLOBs are are served from there so that they can be easily modified and new ones uploaded.

Thanks in advance,

Tim.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3075356

Alex Harvey | 19 Mar 19:44 2014

Using ClientConnector on GAE

Prior to 2.2-RC1 we were able to use ClientResource correctly on App Engine with the .gae extension
dependencies. However, we are no longer able to do so and receive a client connector error regarding the
HTTP and HTTPS protocol jar being missing. Is this intended behavior? From the build notes these classes
were to be included in the core jar.

Even with the simplest hello world example and using the .gae extension insead of .jse this issue is reproducible.

Mar 19, 2014 1:38:24 PM org.restlet.engine.Engine createHelper
WARNING: No available client connector supports the required protocols: 'HTTP' . Please add the JAR of a
matching connector to your classpath.
Mar 19, 2014 1:38:24 PM org.restlet.resource.ClientResource retry
INFO: A recoverable error was detected (1002), attempting again in 2000 ms.
Mar 19, 2014 1:38:26 PM org.restlet.resource.ClientResource retry
INFO: A recoverable error was detected (1002), attempting again in 2000 ms.
Exception in thread "main" Internal Connector Error (1002) - No available client connector supports the
required protocol: 'HTTP'. Please add the JAR of a matching connector to your classpath.
	at org.restlet.resource.ClientResource.doError(ClientResource.java:599)
	at org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1165)
	at org.restlet.resource.ClientResource.handle(ClientResource.java:1060)
	at org.restlet.resource.ClientResource.handle(ClientResource.java:1035)
	at org.restlet.resource.ClientResource.handle(ClientResource.java:937)
	at org.restlet.resource.ClientResource.get(ClientResource.java:645)

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3074844

saurabh narayan singh | 19 Mar 06:14 2014
Picon

How to : use System.out or logger in Restlet

Hi, 
i have restlet and i want to check the intermediate values in various methods, for instance refer to the code below

  <at> Override
    public synchronized Restlet createInboundRoot(){
        Authenticator auth = new myAuthenticator();
        Validator val = new myValidator(getContext());
        Filter fil1 = new myFilter();
        Router r = new Router();
        r.attach("/hellowrld​",HelloWorldResource​.class);
        fil1.setNext(auth);

        /***********See here***************/
        System.out.println("hello world");    
Logger.getLogger(TestRestlet.class.getName()).log(Level.SEVERE, null, " Hello");

        auth.setNext(val);
        val.setNext(r);
        return fil1;
    }

Now when i start the service, it prints and logs once, but after that, even if i reinvoke the restlet it won't
print. 

Same is the case with Filter and validator, i was trying to check whether or not validatePresence is being
called by inserting a S.O.P there, but no output. 

Q 1. Whats the reason behind this behavior ?
Q 2. How do we overcome this, can we use any other Logger or am i looking at the wrong place ?

Any help will be appreciated,

Regards,
Saurabh Narayan Singh

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3074802

saurabh narayan singh | 12 Mar 08:18 2014
Picon

How to : Different validation check for different mappings but same filter

I have multiple mappings in the restlet which are supposed to pass through the same filter and
authenticator, but for the different mappings i have to use validationPresence(attribute) for
different attributes, refer the code below for better understanding of the question : 

     <at> Override
    public synchronized Restlet createInboundRoot(){
        Authenticator auth = new myAuthenticator();
        Validator val = new myValidator(getContext());
        Filter fil1 = new myFilter();
        Router r = new Router();
        r.attach("/hellowrld",HelloWorldResource.class);
        r.attach("/hello",HelloWorldResource1.class);
        fil1.setNext(auth);
        auth.setNext(val);
        val.setNext(r);
        val.validatePresence("Name");
        return fil1;
    }

but here both mappings will pass through validatePresence("Name"), what i want to achieve is pass
"/hellowrld" thru one validator and "/hello" thru other one . What can i do for that ? 
Any help will be appreciated

Thanks

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3074406

saurabh narayan singh | 11 Mar 08:29 2014
Picon

RESTLET - chaining a validator and filter, why does it surpasses the filter?

Hi everyone,

I have a restlet in which i want to chain a validator and filter one after the other in the code. The code goes
something like this

 <at> Override
public synchronized Restlet createInboundRoot()
{
    Router router = new Router();
    Validator val = new  ParameterValidator(getContext());

    Filter fil = new MYFilter(getContext());
    router.attach("/HelloWorld", HW.class);
    fil.setNext(val);
    val.setNext(router);
    val.validate("Name",true,"^[a-z0-9A-Z]+$");
    return val;
}
but this doesn't checks in the filter, just works on the validator and then comes out.

But if i write this same code as given below, it works fine,

 <at> Override
public synchronized Restlet createInboundRoot()
{
    Router router = new Router();
    Validator val = new ParameterValidator(getContext());

    Filter fil = new MYFilter(getContext());
    router.attach("/HelloWorld", fil);
    fil.setNext(val);
    val.setNext(HW.class);
    val.validate("Name",true,"^[a-z0-9A-Z]+$");
    return router;
}
The above code works fine but now in case i have to create a chain i'll have to create new objects of Validator
and Filter with every new mapping. Any solution will be appreciated

Thanks

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3074329

Jerome Louvel | 9 Mar 10:49 2014

Road map for next Restlet Framework version

Hi all,

As we are getting very close to releasing our new stable 2.2.0 version, I have as usual started to plan for the next release. It's always a great moment to reflect on the project recent accomplishments and future direction.

The overall goal is to develop a version 2.3 providing enhancements on top of current 2.2 branch in order to keep Restlet Framework on the edge of the most important innovations in the Java and Web API worlds.

Below is a road map proposal. Please share your thoughts!

Restlet Framework 2.3 (draft)

Higher priority

  • Web API documentation
    • integration with online APISpark platform
    • integration with embedded Swagger
  • OAuth 2.0 support
    • complete implementation and tests
    • proper documentation
  • JAX-RS 2.0 support
    • server-side and client-side
    • embedding JBoss RESTEasy core
  • Restlet API refactoring
    • direct converters configuration
    • direct connectors configuration
    • direct access to raw HTTP headers
    • replace string constants by enums
  • Revamp documentation
    • new tutorial
    • better user guide

Medium priority

  • Java 7 requirement
    • modern Javadoc style
  • Jetty 9.1 upgrade
    • client connector
    • SPDY and HTTP 2.0 protocols
  • Netty 5.0 integration
    • target best performance in TechEmpower benchmark
    • revamp old 2.0 extension
  • Restlet API enhancements
    • CORS (Cross-Origin Resource Sharing) headers support
    • transparent HTTP PATCH support (JSON and XML patch/diff)
    • new ValidationService for representation beans
    • new CacheService for client calls optimization
    • support exceptions conversion
    • add ServerProxy interface equivalent to ClientProxy

Lower priority

  • Continuous integration
    • Travis integration with GitHub to test commits
    • Jenkins service to produce daily snapshots
  • Distribute client-side profiles of JARs
    • reduce footprint, especially for Android edition
  • Mailing lists migration to Google Groups
    • complete migration out of Tigris.org



Gmane