I am sorry to see that you have problems, I never had the same problem you described here, so I am not sure how to help,
I did have some issues with teh stricter crosssite rules for HTTPClient 4.2
I overcome that by doing sone specific setting to prepare my HttpClient .
https://community.jboss.org/servlet/JiveServlet/downloadImage/18705/777-218/screen+capture+jbpm.PNG
my workflow manager, a work in progress - GWT Interface
I created my redirect strategy. a bit of research won't do you any harm so you have to play arround with the HrrpClient setup and how to string the calls fo post and get together.###########################
public
class BrowserRedirectStrategy extends
DefaultRedirectStrategy { .....}
in your class define
private DefaultHttpClient httpClient = new DefaultHttpClient(); //you have done this
The process I follow is
if Get make GetCall
if j_security in content call authenticate
if 405 Method Not Allowed
. call Get again normally with a positive result
if Post make post call
if j_security in content call authenticate
if 405 Method Not Allowed
call Get again to page without aparameters for post normally with a good result
Here is how I setup the HttpClient -
httpClient.getParams().setParameter(AllClientPNames.HANDLE_REDIRECTS, true );
httpClient.setRedirectStrategy(new BrowserRedirectStrategy());
HttpHost targetHost = new HttpHost("localhost", 8080, "http"
); //todo replace with lookup
String content = ""
httpClient.getCredentialsProvider().setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()),
new
UsernamePasswordCredentials(userId, password));
// Generate BASIC scheme object and add it to the local
// auth cache
BasicScheme basicAuth = new BasicScheme();
AuthCache authCache = new BasicAuthCache();
authCache.put(targetHost, basicAuth);
// Add AuthCache to the execution context
BasicHttpContext localcontext =
new BasicHttpContext();
);
here is a example trace of the resulted call -
See that I call my redirect strategy
21:51:59,300 INFO [server] isRedirected -----start-------
21:51:59,311 INFO [server] isRedirected status line ->HTTP/1.1 200 OK
21:51:59,312 INFO [server] isRedirected Header ->no loaction
21:51:59,312 INFO [server] isRedirected Headers
21:51:59,312 INFO [server] Server = [Apache-Coyote/1.1]
21:51:59,312 INFO [server] isRedirected Header Elements
21:51:59,312 INFO [server] Apache-Coyote/1.1 = []
21:51:59,312 INFO [server] Pragma = [No-cache]
21:51:59,312 INFO [server] isRedirected Header Elements
21:51:59,312 INFO [server] No-cache = []
21:51:59,312 INFO [server] Cache-Control = [no-cache]
21:51:59,312 INFO [server] isRedirected Header Elements
21:51:59,312 INFO [server] no-cache = []
21:51:59,312 INFO [server] Expires = [Thu, 01 Jan 1970 10:00:00 EST]
21:51:59,312 INFO [server] isRedirected Header Elements
21:51:59,312 INFO [server] Thu = []
21:51:59,312 INFO [server] 01 Jan 1970 10:00:00 EST = []
21:51:59,312 INFO [server] Set-Cookie = [JSESSIONID=2607867399457D13348FAE3E857B72FA; Path=/gwt-console-server]
21:51:59,312 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] JSESSIONID = [2607867399457D13348FAE3E857B72FA]
21:51:59,313 INFO [server] Accept-Ranges = [bytes]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] bytes = []
21:51:59,313 INFO [server] ETag = [W/"621-1323388266000"]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] W/"621-1323388266000" = []
21:51:59,313 INFO [server] Last-Modified = [Thu, 08 Dec 2011 23:51:06 GMT]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] Thu = []
21:51:59,313 INFO [server] 08 Dec 2011 23:51:06 GMT = []
21:51:59,313 INFO [server] Content-Type = [text/html]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] text/html = []
21:51:59,313 INFO [server] Content-Length = [621]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] 621 = []
21:51:59,313 INFO [server] Date = [Mon, 04 Jun 2012 11:51:58 GMT]
21:51:59,313 INFO [server] isRedirected Header Elements
21:51:59,313 INFO [server] Mon = []
21:51:59,313 INFO [server] 04 Jun 2012 11:51:58 GMT = []
21:51:59,313 INFO [server] isRedirected ------------
21:51:59,313 INFO [server] isRedirected return 4=false
21:51:59,316 INFO [server] Raw Response 1HTTP/1.1 200 OK [Server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Thu, 01 Jan 1970 10:00:00 EST, Set-Cookie: JSESSIONID=2607867399457D13348FAE3E857B72FA; Path=/gwt-console-server, Accept-Ranges: bytes, ETag: W/"621-1323388266000", Last-Modified: Thu, 08 Dec 2011 23:51:06 GMT, Content-Type: text/html, Content-Length: 621, Date: Mon, 04 Jun 2012 11:51:58 GMT]
21:51:59,316 INFO [server] start process1:------><html><head> <title>HTTP 401</title> <!-- Do not remove --></head><body><form method="POST" action="j_security_check"> <center/> <br><br> <div style="font-family:sans-serif;border:1px solid black; width:270;padding:15px;"> <h2>BPM Console Server</h2> <table with=250> <tr> <td>Username:</td> <td><input type="text" name="j_username"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="j_password"></td> </tr> <tr> <td></td> <td align=right><input type="submit"/></td> </tr> </table> </div></form></body></html>
21:51:59,316 INFO [server] start sec url:------>http://localhost:8080/gwt-console-server/rs/process/j_security_check
21:51:59,319 INFO [server] Next call execute sec
21:51:59,345 INFO [server] isRedirected -----start-------
21:51:59,345 INFO [server] isRedirected status line ->HTTP/1.1 302 Moved Temporarily
21:51:59,345 INFO [server] isRedirected Header ->Location: http://localhost:8080/gwt-console-server/rs/process/definitions
21:51:59,345 INFO [server] isRedirected Headers
21:51:59,345 INFO [server] Server = [Apache-Coyote/1.1]
21:51:59,345 INFO [server] isRedirected Header Elements
21:51:59,345 INFO [server] Apache-Coyote/1.1 = []
21:51:59,345 INFO [server] Location = [http://localhost:8080/gwt-console-server/rs/process/definitions]
21:51:59,345 INFO [server] isRedirected Header Elements
21:51:59,345 INFO [server] http://localhost:8080/gwt-console-server/rs/process/definitions = []
21:51:59,345 INFO [server] Content-Length = [0]
21:51:59,345 INFO [server] isRedirected Header Elements
21:51:59,345 INFO [server] 0 = []
21:51:59,345 INFO [server] Date = [Mon, 04 Jun 2012 11:51:58 GMT]
21:51:59,345 INFO [server] isRedirected Header Elements
21:51:59,345 INFO [server] Mon = []
21:51:59,345 INFO [server] 04 Jun 2012 11:51:58 GMT = []
21:51:59,345 INFO [server] isRedirected ------------
21:51:59,345 INFO [server] isRedirectable call ->POST
21:51:59,345 INFO [server] isRedirectable call TRUE for->POST
21:51:59,346 INFO [server] isRedirected return 1=true
21:52:01,385 INFO [STDOUT] INFO 04-06 21:52:01,369 (
NilAuthenticator.java:authenticate:35
) All users are guests.21:52:03,200 INFO [STDOUT] INFO 04-06 21:52:03,200 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
RepositoryServlet.java:allowUser:113) admin authenticated for rest api21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
PackageDeploymentServlet.java:execute:134) PackageName: defaultPackage21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
PackageDeploymentServlet.java:execute:135) PackageVersion: LATEST21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
PackageDeploymentServlet.java:execute:136) PackageIsLatest: true21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (
PackageDeploymentServlet.java:execute:137) PackageIsSource: false21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
RepositoryServlet.java:allowUser:113) admin authenticated for rest api21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
PackageDeploymentServlet.java:execute:134) PackageName: s4testing21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
PackageDeploymentServlet.java:execute:135) PackageVersion: LATEST21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
PackageDeploymentServlet.java:execute:136) PackageIsLatest: true21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (
PackageDeploymentServlet.java:execute:137) PackageIsSource: false21:52:05,917 ERROR [CommandDelegate] jbpm.console.directory property not found
21:52:05,964 INFO [Configuration] Reading mappings from resource : META-INF/JBPMorm.xml
21:52:05,979 INFO [QueryBinder] Binding Named query: ProcessInstancesWaitingForEvent => select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes where eventTypes = :type
21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.jbpm.persistence.processinstance.ProcessInstanceInfo
21:52:05,979 INFO [EntityBinder] Bind entity org.jbpm.persistence.processinstance.ProcessInstanceInfo on table ProcessInstanceInfo
21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.drools.persistence.info.SessionInfo
21:52:05,979 INFO [EntityBinder] Bind entity org.drools.persistence.info.SessionInfo on table SessionInfo
21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.drools.persistence.info.WorkItemInfo
21:52:05,979 INFO [EntityBinder] Bind entity org.drools.persistence.info.WorkItemInfo on table WorkItemInfo
21:52:05,995 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
21:52:05,995 INFO [NamingHelper] JNDI InitialContext properties:{}
21:52:05,995 INFO [DatasourceConnectionProvider] Using datasource: java:jdbc/jbpmDS
21:52:05,995 INFO [SettingsFactory] RDBMS: PostgreSQL, version: 8.3.5
21:52:05,995 INFO [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3devel JDBC4 with SSL (build 601)
21:52:05,995 INFO [Dialect] Using dialect: org.hibernate.dialect.PostgreSQLDialect
21:52:05,995 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
21:52:05,995 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
21:52:05,995 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
21:52:05,995 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
21:52:05,995 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
21:52:05,995 INFO [SettingsFactory] JDBC batch size: 15
21:52:05,995 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
21:52:05,995 INFO [SettingsFactory] Scrollable result sets: enabled
21:52:05,995 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
21:52:05,995 INFO [SettingsFactory] Connection release mode: auto
21:52:05,995 INFO [SettingsFactory] Maximum outer join fetch depth: 3
21:52:05,995 INFO [SettingsFactory] Default batch fetch size: 1
21:52:05,995 INFO [SettingsFactory] Generate SQL with comments: disabled
21:52:05,995 INFO [SettingsFactory] Order SQL updates by primary key: disabled
21:52:05,995 INFO [SettingsFactory] Order SQL inserts for batching: disabled
21:52:05,995 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
21:52:05,995 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
21:52:05,995 INFO [SettingsFactory] Query language substitutions: {}
21:52:05,995 INFO [SettingsFactory] JPA-QL strict compliance: enabled
21:52:05,995 INFO [SettingsFactory] Second-level cache: enabled
21:52:05,995 INFO [SettingsFactory] Query cache: disabled
21:52:05,995 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
21:52:05,995 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
21:52:05,995 INFO [SettingsFactory] Structured second-level cache entries: disabled
21:52:05,995 INFO [SettingsFactory] Statistics: disabled
21:52:05,995 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
21:52:05,995 INFO [SettingsFactory] Default entity-mode: pojo
21:52:05,995 INFO [SettingsFactory] Named query checking : enabled
21:52:06,010 INFO [SessionFactoryImpl] building session factory
21:52:06,010 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
21:52:06,010 INFO [SchemaUpdate] Running hbm2ddl schema update
21:52:06,010 INFO [SchemaUpdate] fetching database metadata
21:52:06,010 INFO [SchemaUpdate] updating schema
21:52:06,057 INFO [TableMetadata] table found: public.eventtypes
21:52:06,057 INFO [TableMetadata] columns: [element, instanceid]
21:52:06,057 INFO [TableMetadata] foreign keys: [fkb0e5621f7665489a]
21:52:06,057 INFO [TableMetadata] indexes: []
21:52:06,088 INFO [TableMetadata] table found: public.processinstanceinfo
21:52:06,088 INFO [TableMetadata] columns: [startdate, lastreaddate, state, processinstancebytearray, optlock, instanceid, processid, lastmodificationdate]
21:52:06,088 INFO [TableMetadata] foreign keys: []
21:52:06,088 INFO [TableMetadata] indexes: [processinstanceinfo_pkey]
21:52:06,135 INFO [TableMetadata] table found: public.sessioninfo
21:52:06,135 INFO [TableMetadata] columns: [rulesbytearray, id, startdate, optlock, lastmodificationdate]
21:52:06,135 INFO [TableMetadata] foreign keys: []
21:52:06,135 INFO [TableMetadata] indexes: [sessioninfo_pkey]
21:52:06,166 INFO [TableMetadata] table found: public.workiteminfo
21:52:06,166 INFO [TableMetadata] columns: [workitembytearray, name, workitemid, state, optlock, creationdate, processinstanceid]
21:52:06,166 INFO [TableMetadata] foreign keys: []
21:52:06,166 INFO [TableMetadata] indexes: [workiteminfo_pkey]
21:52:06,166 INFO [SchemaUpdate] schema update complete
21:52:06,166 INFO [NamingHelper] JNDI InitialContext properties:{}
21:52:06,229 INFO [CommandDelegate] Loading session data ...
21:52:07,992 INFO [PluginMgr] Successfully loaded plugin 'org.jboss.bpm.console.server.plugin.FormDispatcherPlugin': class org.jbpm.integration.console.forms.FormDispatcherComposite
21:52:08,007 INFO [STDOUT] INFO 04-06 21:52:08,007 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,039 INFO [STDOUT] INFO 04-06 21:52:08,039 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,102 INFO [STDOUT] INFO 04-06 21:52:08,102 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,117 INFO [STDOUT] INFO 04-06 21:52:08,117 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,180 INFO [STDOUT] INFO 04-06 21:52:08,180 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,242 INFO [STDOUT] INFO 04-06 21:52:08,242 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,258 INFO [STDOUT] INFO 04-06 21:52:08,258 (
NilAuthenticator.java:authenticate:35
) All users are guests.21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
RepositoryServlet.java:allowUser:113) admin authenticated for rest api21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
PackageDeploymentServlet.java:execute:134) PackageName: s4testing21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
PackageDeploymentServlet.java:execute:135) PackageVersion: LATEST21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
PackageDeploymentServlet.java:execute:136) PackageIsLatest: true21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (
PackageDeploymentServlet.java:execute:137) PackageIsSource: true21:52:08,367 INFO [PluginMgr] Successfully loaded plugin 'org.jboss.bpm.console.server.plugin.GraphViewerPlugin': class org.jbpm.integration.console.graph.GraphViewerPluginImpl
21:52:08,367 INFO [STDOUT] INFO 04-06 21:52:08,367 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,429 INFO [STDOUT] INFO 04-06 21:52:08,429 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,476 INFO [STDOUT] INFO 04-06 21:52:08,476 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,570 INFO [STDOUT] INFO 04-06 21:52:08,570 (
NilAuthenticator.java:authenticate:35
) All users are guests.21:52:08,648 INFO [STDOUT] INFO 04-06 21:52:08,632 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,679 INFO [STDOUT] INFO 04-06 21:52:08,679 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,710 INFO [STDOUT] INFO 04-06 21:52:08,710 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,757 INFO [STDOUT] INFO 04-06 21:52:08,757 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,804 INFO [STDOUT] INFO 04-06 21:52:08,804 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,851 INFO [STDOUT] INFO 04-06 21:52:08,851 (
NilAuthenticator.java:authenticate:35) All users are guests.21:52:08,975 INFO [server] isRedirected -----start-------
21:52:08,975 INFO [server] isRedirected status line ->HTTP/1.1 200 OK
21:52:08,975 INFO [server] isRedirected -----start-------
21:52:08,975 INFO [server] isRedirected status line ->HTTP/1.1 200 OK
21:52:08,975 INFO [server] isRedirected Header ->no loaction
21:52:08,975 INFO [server] isRedirected Headers
21:52:08,975 INFO [server] Server = [Apache-Coyote/1.1]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] Apache-Coyote/1.1 = []
21:52:08,975 INFO [server] Pragma = [No-cache]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] No-cache = []
21:52:08,975 INFO [server] Cache-Control = [no-cache]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] no-cache = []
21:52:08,975 INFO [server] Expires = [Thu, 01 Jan 1970 10:00:00 EST]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] Thu = []
21:52:08,975 INFO [server] 01 Jan 1970 10:00:00 EST = []
21:52:08,975 INFO [server] X-Powered-By = [Servlet 2.5; JBoss-5.0/JBossWeb-2.1]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] Servlet 2.5 = []
21:52:08,975 INFO [server] Content-Type = [application/json]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] application/json = []
21:52:08,975 INFO [server] Transfer-Encoding = [chunked]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] chunked = []
21:52:08,975 INFO [server] Date = [Mon, 04 Jun 2012 11:52:08 GMT]
21:52:08,975 INFO [server] isRedirected Header Elements
21:52:08,975 INFO [server] Mon = []
21:52:08,975 INFO [server] 04 Jun 2012 11:52:08 GMT = []
21:52:08,975 INFO [server] isRedirected ------------
21:52:08,975 INFO [server] isRedirected return 4=false
21:52:08,975 INFO [server] Raw Response secHTTP/1.1 200 OK [Server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Thu, 01 Jan 1970 10:00:00 EST, X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1, Content-Type: application/json, Transfer-Encoding: chunked, Date: Mon, 04 Jun 2012 11:52:08 GMT]
21:52:08,975 INFO [server] start after sec:------>{"definitions":[{"id":"au.com.s4.cert","name":"User Registration","version":1,"packageName":"s4testing","deploymentId":"N/A","suspended":false,"formUrl":"http://localhost:8080/gwt-console-server/rs/form/process/au.com.s4.cert/render","diagramUrl":"http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/s4testing/LATEST/au.com.s4.cert-image.png"},{"id":"com.sample.evaluation","name":"Evaluation","version":0,"packageName":"defaultPackage","deploymentId":"N/A","suspended":false,"formUrl":"http://localhost:8080/gwt-console-server/rs/form/process/com.sample.evaluation/render","diagramUrl":http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/com.sample.evaluation-image.png}]}
ull, falsecontent = requestPostService( targetHost, localcontext, serviceType, _callUrl,
localcontext.setAttribute(ClientContext.AUTH_CACHE , authCache);