guvnor restful api problem
by gcautiero
Hello to everyone,
i'm trying to upload a .drl file using guvnor's restFul service. But im not
able to get a POST call working.
what i'm trying to do is:
make a call first to get a content of .drl file already stored in Guvnon:
here the working code using cxf client (as the example in the guvnor doc):
WebClient c = WebClient.create("http://127.0.0.1:8081/");
String authorizationHeader = "Basic " +
org.apache.cxf.common.util.Base64Utility.encode("guest:".getBytes());
c.header("Authorization", authorizationHeader);
String content =
c.path("http://localhost:8081/guvnor-5.3.0.Final-tomcat-6.0/org.drools.guvnor.Guv...").accept("text/plain").get(String.class);
then i try to upload the content in another asset
Here the code that DOSEN'T work:
Response response =
client.path("http://localhost:8081/guvnor-5.3.0.Final-tomcat-6.0/org.drools.guvnor.Guv...").accept("application/xml").post(content);
for this call i get the following error:
Nov 29, 2011 11:23:12 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet RestAPIServlet threw exception
java.lang.ArrayIndexOutOfBoundsException: 1
at org.drools.repository.remoteapi.RestAPI.post(RestAPI.java:235)
at
org.drools.guvnor.server.files.RestAPIServlet$1.execute(RestAPIServlet.java:56)
at
org.drools.guvnor.server.files.RepositoryServlet.doAuthorizedAction(RepositoryServlet.java:75)
at
org.drools.guvnor.server.files.RestAPIServlet.doPost(RestAPIServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
at
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
at java.lang.Thread.run(Thread.java:662)
someone have a suggestion? or a working example?
tnx
Gianfranco
--
View this message in context: http://drools.46999.n3.nabble.com/guvnor-restful-api-problem-tp3544799p35...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month
Retrieving rule name in "then" clause
by Ronald Albury
Is there a simple way for me to be able to access the rule name in the
'then' clause?
When rules fail I want to pass the rule name into my internal error handler.
Thanks in advance
14 years, 1 month
Fusion : must declare @role(event) for all class hierarchy ?
by Vincent LEGENDRE
Hi all
We are using Fusion to make some simplification and grouping on some events.
We have several classes of events, all derivated from a top-level class .
With fusion version 5.3 (and 5.2 too), we must declare the @role(event) for the top-level class, but also for all its classes hierarchy , ie the role is not inherited by subclasses.
Is it done and purpose ?
Is it a bug ?
Thanks.
14 years, 1 month
Unclear error when rule name missing
by Ronald Albury
I guess I need to learn how to submit bugs. Any help is appreciated.
If you forget the name of the rule, instead of a clear error (like "Rule
name missing") you get a NullPointerException with no indication why.
Thanks
14 years, 1 month
RuleFlow WorkItem check for abort
by cherokee
Hello,
I am newbie to using drools and using version 5.1.1 for my ruleflow test
case.
Testcase:
In the workItemHandler for a workitem, whenever exception occurs I catch the
exception and
set manager.abortWorkItem(workItem.getId());
I have 2 questions:
1) Is there a way in the onExit of workItem i can check the state to
determine if it has been aborted or completed succesfully?
2) When does the "abortWorkItem" method on workItemHandler get called?
Appreciate your time in replying to my queries.
Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleFlow-WorkItem-che...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 1 month
Re: [rules-users] Guvnor Hates Me
by Ronald Albury
First - I'd like to thank everyone for their help. I am finding Guvnor
less intuitive than I had hoped and I will need your continued patience and
assistance to understand it.
Problem 1:
I added Sample.drl (which contains two rules) from inside Eclipse, and
Guvnor split it into two rules (HelloWorld and GoodBye). I later changed
Sample.drl and when I went to update it thru Eclipse the 'Update' selection
was not highlighted - only the Add was available. So I added it again.
Now in Guvnor I have the two rules from when I first added the file, and
now the Sample.drl file itself. The Sample.drl file has the changes in it
and the two rules do not.
Problem 2:
I modified the Sample.drl file inside Eclipse again and went to update it
in Guvnor. It wouldn't let me update it - I could only Add. So I went
ahead and did an add. I can not find the changes anywhere in Guvnor.
Problem 3:
When I go to validate a rule in Guvnor it complains that it has an error
importing com.scs.test.Message. That is one of the classes in the PoJo jar
file that I have in Guvnor. I wanted the rules to be in com.scs.test.rules
and the Java code to be in com.scs.test. Can someone explain to me where I
have to put the Model, and if the Java classes need to have the same
package as the rules.
I am also having general problems about when to Save things. I originally
thought that when I uploaded something into Guvnor that was enough ... but
it appears that (at least under some conditions) I have to Save as well.
Do I have to Save things I've uploaded from Eclipse too? Guvnor never
seems to have what I think it should have.
14 years, 1 month
Guvnor hates me
by Ronald Albury
Newbie issue:
I created a package, com.scs.test
I added a model to that package (a java Jar file with POJOs in it). The
jar contains com.scs.test.Message and com.scs.test.Person.
I edited the package's "Configuration: Imported Types" to include the two
objects from the model (com.scs.test.Message and com.scs.test.Person).
I go to the package assets and open a business rule. When I click on the
plus sign across from When I get the message "Note: No model has been
defined. Tip: you will want to import or define a model for this user
interface to work !".
I thought I had imported a model. When I look at the package assets, the
model is listed right there. The objects are listed as "Imported Types".
What am I doing wrong?
Thanks
14 years, 1 month
Re: [rules-users] string replace collision problem
by FrankVhh
Hi,
Sorry, but I fogot about you :-(.
It does not work because both wolfgang and I did get your question wrong.
If I were you, I would try to work from the opposite direction and check
whether a String matches S but not SF. Than replace that S by VOL.
A second rule could than safely check for SF and replace that by S.
In short, reverse your salience, check that S is not SF and make sure that
you replace the right S in the RHS of your rules. You do not want to update
the WM.
Regards,
Frank
fiitkar wrote
>
> Sorry, it does not work.
> For input SF I allways get VOLVOLFVOL.
>
> Once again: if the input is S the output should be VOL. But if the input
> string contains SF the output should be S and not VOL.
>
> For example:
> SF --> S
> SSF --> VOLS
> SFSF -> SS
> etc.
>
--
View this message in context: http://drools.46999.n3.nabble.com/string-replace-collision-problem-tp3518...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month