Skip to content

Instantly share code, notes, and snippets.

View jeanouii's full-sized avatar

Jean-Louis Monteiro jeanouii

  • Tomitribe
  • France
View GitHub Profile
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@Override
protected Object performInvocation(final Exchange exchange, final Object serviceObject,
final Method m, final Object[] paramArray) throws Exception {
try {
return m.invoke(serviceObject, insertExchange(m, paramArray, exchange));
} catch (final InvocationTargetException ite) {
Throwable cause = ite.getTargetException();
// unwrap to get ExceptionMapper working
if (cause instanceof InvalidateReferenceException) {
Infos: EVENT ComponentAdded{type=class org.apache.openejb.assembler.classic.EjbResolver, component=org.apache.openejb.assembler.classic.EjbResolver}
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.908 sec <<< FAILURE! - in com.tomitribe.tribestream.registry.model.ResourceUrlTest
test(com.tomitribe.tribestream.registry.model.ResourceUrlTest) Time elapsed: 1.696 sec <<< ERROR!
org.apache.openejb.OpenEJBException: Creating application failed: /Users/jlmonteiro/devs/tomitribe/tribestream/webapp/tribestream-registry-core/ResourceUrlTest: com.tomitribe.tribestream.registry.model.ResourceUrlTest$$LocalBeanProxy cannot be cast to javax.naming.Context
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:907)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:623)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:619)
at org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:7
// we went thru all the LoginModules.
if (firstRequiredError != null) {
// a REQUIRED module failed -- return the error
throwException(firstRequiredError, null);
} else if (success == false && firstError != null) {
// no module succeeded -- return the first error
throwException(firstError, null);
} else if (success == false) {
// no module succeeded -- all modules were IGNORED
throwException(new LoginException
List<Attachment> atts = new LinkedList<Attachment>();
atts.add(new Attachment("filename", MediaType.TEXT_PLAIN, name));
ContentDisposition cd = new ContentDisposition("attachment;" + name;
Attachment att = new Attachment("content", content, cd);
atts.add(att);
actualResultString = getClient().path("/upload").type(MediaType.MULTIPART_FORM_DATA).post(atts);
My rest signature is
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void upload(@Multipart("filename") final String filename,
@Multipart(value = "content", type = "application/octet-stream") File archive) { ... }
And my client looks like
/*
* Tomitribe Confidential
*
* Copyright Tomitribe Corporation. 2014
*
* The source code for this program is not published or otherwise divested
* of its trade secrets, irrespective of what has been deposited with the
* U.S. Copyright Office.
*/
@GET
@Path("/list")
@Description(value = "Retrieve all applications currently deployed. It includes running and non running applications." +
"<p><em>Only works for web applications (ie. war packaging) though we could extend to JAR or EAR packaging when" +
" deployed to apps/ instead of webapps/</em></p>")
public List<ContextInfo> list() {
final List<ContextInfo> list = new ArrayList<ContextInfo>();
final Collection<ApplicationRegistry.AppHolder> deployedApps = applicationRegistry.deployedApps();
for (ApplicationRegistry.AppHolder app : deployedApps) {
/*
* Tomitribe Confidential
*
* Copyright Tomitribe Corporation. 2014
*
* The source code for this program is not published or otherwise divested
* of its trade secrets, irrespective of what has been deposited with the
* U.S. Copyright Office.
*/
package com.tomitribe.tribestream.console.server;