Skip to content

Instantly share code, notes, and snippets.

Mariano Gonzalez marianogonzalez

Block or report user

Report or block marianogonzalez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MultipartHttpToMapTransformer.java
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.fileupload.MultipartStream;
import org.apache.log4j.Logger;
import org.mule.api.MuleMessage;
import org.mule.api.transport.PropertyScope;
import org.mule.transformer.AbstractMessageTransformer;
View MultipartHttpToMapTransformeraux.java
protected Map<String, String> parseHeaders(String headerPart)
{
Map<String, String> headers = new HashMap<String, String>();
char buffer[] = new char[1024];
boolean done = false;
int j = 0;
int i;
String header, headerName, headerValue;
try
{
@marianogonzalez
marianogonzalez / gist:1677400
Created Jan 25, 2012
ErrorNotificationFlow
View gist:1677400
<flow name="NotificationOfError">
<vm:inbound-endpoint path="notifyError" />
<object-to-string-transformer />
<smtp:outbound-endpoint host="smtp.gmail.com"
port="587" user="${email.user}" password="${email.pass}" from="${email.user}"
to="${email.support}" subject="Houston: We have a problem!"
connector-ref="emailConnector" />
</flow>
@marianogonzalez
marianogonzalez / gist:1677502
Created Jan 25, 2012
Consuming the error flow
View gist:1677502
muleContext.getClient().send("vm://notifyError", exception)
View gist:1690712
// reference the files with the customized flows and resources
ConfigResource[2] resources = new ConfigResource[2];
resources[0] = new ConfigResource(new URL(pathToCustomFile1));
resources[1] = new ConfigResource(new URL(pathToCustomFile2));
// create a spring configuration builder
SpringXmlConfigurationBuilder springXmlConfigurationBuilder = new SpringXmlConfigurationBuilder(resources);
//reference the parent
springXmlConfigurationBuilder.setParentContext(parentMuleContext);
@marianogonzalez
marianogonzalez / gist:1690775
Created Jan 27, 2012
access child context
View gist:1690775
MuleContext child = contextsMap.get(contextName);
child.getClient().send("vm://notifyError", exception)
View gist:1690883
<!-- give jaxb a package to scan for annotations -->
<mulexml:jaxb-context name="myJaxB" packageNames="com.mulesoft.example" />
<sub-flow name="xmlMarshalling">
<!-- custom transformer that would populate your bean -->
<custom-transformer class="com.mulesoft.example.PayloadToBeanTransformer" />
<!-- Generate the XML -->
<mulexml:jaxb-object-to-xml-transformer name="myMarshaller" jaxbContext-ref="myJaxB"/>
</sub-flow>
View gist:1719003
<spring:bean id="pgpKeyManager" class="org.mule.module.pgp.PGPKeyRingImpl" init-method="initialise">
<spring:property name="publicKeyRingFileName" value="./public.gpg" />
<spring:property name="secretKeyRingFileName" value="./secring.gpg" />
<spring:property name="secretAliasId" value="1218002276979500705" />
<spring:property name="secretPassphrase" value="myPassPhrase" />
</spring:bean>
You can’t perform that action at this time.