Hi, As it seems Jena do not provide a way to add custom informations as request parameters, and as we need it for some complex case in our security layer I created a class named "ParametrizableUpdateProcessRemoteForm" that extends "UpdateProcessRemoteBase".
This basic extension allow the user to specify key value pair that will be sended as html query parameters. As we need it for our security layer, and as Jena just released a security layer too, maybe others will need this capability too. So are you interested by the contribution of this class ? Arthur VAÏSSE-LESTEVEN ________________________________ De : Arthur Vaïsse-Lesteven <[email protected]> À : "[email protected]" <[email protected]> Envoyé le : Lundi 23 septembre 2013 9h25 Objet : Re: About the use of UpdateProcessRemoteForm and HttpContext. Hi all ( and specifically Rob, again ! ), Hi probably misunderstood what you tried to explain me during one of our mail exchange last June : >If you are using a version of ARQ prior to 2.10.0 there is nocommon >baseclass but both UpdateProcessRemote and UpdateProcessRemoteForm >would still have a setHttpContext() method which allows you to pass >in a >HttpContextwhich can be used to pass in authentication settings >using the HttpClient APIs. Even with 2.10.1 you can still choose to >use this method particularly if you need to pass complex credentials. > >Rob Seeing this, I understood that I could use HttpContext to pass in aditionnals settings. It seems not according to your answer : >If you need to communicate arbitrary custom information to the server you >will need to roll your own code for communicating with your server. Was not that I was expecting but okay. Arthur VAÏSSE-LESTEVEN. ________________________________ De : Rob Vesse <[email protected]> À : "[email protected]" <[email protected]>; Arthur Vaïsse-Lesteven <[email protected]> Envoyé le : Vendredi 20 septembre 2013 18h58 Objet : Re: About the use of UpdateProcessRemoteForm and HttpContext. HttpContext cannot be used in this way, see the Apache HttpClient documentation - http://hc.apache.org/httpcomponents-core-4.2.x/httpcore/apidocs/org/apache/ http/protocol/HttpContext.html - and I quote: --- HttpContext represents execution state of an HTTP process. It is a structure that can be used to map an attribute name to an attribute value. Internally HTTP context implementations are usually backed by a HashMap <http://download.oracle.com/javase/1.5.0/docs/api/java/util/HashMap.html?is -external=true>. The primary purpose of the HTTP context is to facilitate information sharing among various logically related components. HTTP context can be used to store a processing state for one message or several consecutive messages. Multiple logically related messages can participate in a logical session if the same context is reused between consecutive messages. --- I.e. it is a client side structure only used to share state between different parts of the client side application, adding things to the HttpContext does not mean that they will be communicated to the server. If you need to communicate arbitrary custom information to the server you will need to roll your own code for communicating with your server. If it is a simple key value pair you may be able to get away just with adding it to the URL for the server I.e. pass it as a query string parameter. Rob On 9/20/13 12:30 AM, "Arthur Vaïsse-Lesteven" <[email protected]> wrote: > > >Hi dear all, (and specially you, Rob V. ;p ) > >I'm trying to use the capacity of the "UpdateProcessRemoteForm" class to >add contextual informations to the request. >I don't succed in pass aditional information to the request. Here you can >find a simple use case : > > >/** > * A simple test case about httpcontext use. > > */ > >public static void main(String argv){ > > String service = "http://localhost:8080/my_custom_servlet"; > > String update= "INSERT DATA { <http://example.com#Bob> ><http://example.com#knows> <http://example.com#Alice>. }"; > UpdateProcessRemoteForm exec = (UpdateProcessRemoteForm) >UpdateExecutionFactory.createRemoteForm(UpdateFactory.create(update), >service); > exec.setAuthentication("username","asecurepassword".toCharArray()); > HttpContext httpContext = exec.getHttpContext(); > if( httpContext == null){ httpContext = new BasicHttpContext(); } > > httpContext.setAttribute("userGroup","mailing_list_jena"); > > exec.setHttpContext(httpContext); > exec.execute(); > > >} > >At the moment where the update query arrived to my_custom_servlet, there >are no attribute binded to the key "usergroup" in parameters, and no more >in headers ( I use the standard "javax.servlet.http.HttpServletRequest" >in my servlet to get information of http queries ). > >Do I missed something ? Do this code wrong ? > >VAISSE-LESTEVEN Arthur.
