Skip to content

Instantly share code, notes, and snippets.

View danbev's full-sized avatar
🌴
On vacation

Daniel Bevenius danbev

🌴
On vacation
View GitHub Profile
@danbev
danbev / gist:61432960b7a25c73bc54
Last active August 29, 2015 14:01
ProxyServlet setting cookies

The issue I'm seeing is that I'm not able to get the proxy to set a cookie, any cookie, but JSESSIONID in particular. The test I've run is with a target application that does basic authentication.

The client sends the credentials correctly and the users is logged in correctly, and I can see the following header from the backend:

JSESSIONID=v6OmD_TlluOcpSFr0GcpkqnR.dhcp-208-183; path=/backend-system-path

Since client only knows about the proxy, this will not be set by the browser. Instead we want something like ProxyPassReverseCookiePath, ProxyPassReverseDomain like mod_proxy.

$ ./bin/ups-migrator --logLevel=DEBUG update
DEBUG 7/15/15 3:15 PM: liquibase: Connected to unifiedpush@jdbc:postgresql://localhost:5432/unifiedpush
DEBUG 7/15/15 3:15 PM: liquibase: Setting auto commit to false from true
DEBUG 7/15/15 3:15 PM: liquibase: Computed checksum for 1436966129931 as 2cb45cf4f1f5fc50f43682d6b5d6e3aa
DEBUG 7/15/15 3:15 PM: liquibase: Executing QUERY database command: select count(*) from public.ups_db_changeloglock
DEBUG 7/15/15 3:15 PM: liquibase: Executing QUERY database command: SELECT LOCKED FROM public.ups_db_changeloglock WHERE ID=1
DEBUG 7/15/15 3:15 PM: liquibase: Lock Database
DEBUG 7/15/15 3:15 PM: liquibase: Executing UPDATE database command: UPDATE public.ups_db_changeloglock SET LOCKED = TRUE, LOCKEDBY = 'Daniels-MacBook-Pro.local (fe80:0:0:0:9ca3:94ff:fe2f:7410%awdl0)', LOCKGRANTED = '2015-07-15 15:15:29.993' WHERE ID = 1 AND LOCKED = FALSE
INFO 7/15/15 3:15 PM: liquibase: Successfully acquired change log lock
DEBUG 7/15/15 3:15 PM: liquibase: Resolving XML entity name=
@danbev
danbev / gist:1097034
Created July 21, 2011 11:50
CamelTestSupport example
public class SwitchyardComponentTest extends CamelTestSupport {
private String _serviceName = "testServiceName";
@Before
public void setup() throws Exception {
ServiceReferences.clear();
}
@Test
public void sendToSwitchyardInOut() throws Exception {
@danbev
danbev / CamelJMSBindingTest
Created July 13, 2012 06:42
SwitchYard Completion Event Notifier
@SwitchYardTestCaseConfig(
config = SwitchYardTestCaseConfig.SWITCHYARD_XML,
mixins = {CDIMixIn.class, HornetQMixIn.class},
scanners = BeanSwitchYardScanner.class)
@RunWith(SwitchYardRunner.class)
public class CamelJMSBindingTest {
private static final String QUEUE_NAME = "GreetingServiceQueue";
private SwitchYardTestKit _testKit;
@danbev
danbev / gist:3128042
Created July 17, 2012 08:31
SwitchYardTestKit enhancements
/**
* Waits for an Exchange to complete and returns the content of the message that
* was recieved.
*
* @param type The type of the contents of the Message
* @return T an instance of type that is contents of the message.
*/
public <T> T waitForCompletion(Class<T> type) {
final CompletionNotifier<T> notifier = new CompletionNotifier<T>(type);
getServiceDomain().addEventObserver(notifier, ExchangeCompletionEvent.class);
@danbev
danbev / gist:3170072
Created July 24, 2012 14:05
Netty 4 WebSocket suggestion

Suggestion for Netty 4 WebSockets

This document is intended to explain a suggestion for an enhancement of the WebSocket support in Netty 4 and was only created to get feedback from the Netty team to see if this is a valid suggestion before putting any time and effort into it.

Netty has a very nice support for WebSockets and the examples provided work like a charm. This is one of the examples that come with Netty WebSocketServerHandler.java. In this example the WebSocketServerHandler takes care of everything in regard to the WebSocket request, and also acts as a simple web server to produce the html page used for running the example using a web browser.

The reason for this suggestion is that I wanted to implement a simple handler that receives a TextWebSocketFrame and not have to deal with other things like the Http Handshake.So I've created the following [branch](https

@danbev
danbev / gist:3305522
Created August 9, 2012 16:09
Route definitions explained

Below is how routes are defined in aerogear-controller:

Routes routes = new AbstractRoutingModule() {
    @Override
    public void configuration() {
        route()
                .from("/home")
                .on(GET)
                .to(SampleController.class).index();
 }
@danbev
danbev / xcodebuild.md
Created August 26, 2012 13:44
Building aerogear-ios with xcodebuild

Using xcodebuild to build AeroGear-iOS

The goal of this gist is to document the steps to build AeroGear-iOS using the command line tool xcodebuild. The reason for this could be that an CI server would require these steps, but it might also be handy for developers to be able to trigger a full build and run tests from the command line without having to start XCode.

Start with a newly cloned aerogear-ios, and change into the aerogear-ios directory (or what if you specified a different name when cloning use that name)

Some of the information in this gist was taken from different resources and this blog was a great help.

List the schemes in the workspace

When trying to list the schemes from the aerogear-ios from the command line I get the following (this is using a newly cloned gitrepo):

@danbev
danbev / gist:3706418
Created September 12, 2012 12:57
Multiple Routes in a single deployment

What happens if you declare multiple implementations of AbstractRoutingModule?

You get the following deployment error:

13:41:36,425 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."aerogear-controller-demo.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."aerogear-controller-demo.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [RoutingModule] with qualifiers [@Default] at injection point [[parameter 1] of [constructor] @Inject public org.jboss.aerogear.controller.router.DefaultRouter(RoutingModule, BeanManager, ViewResolver, ControllerFactory, SecurityProvider)]. Possible dependencies [[Managed Bean [class org.jboss.aerogear.controller.demo.Routes2] with qualifiers [@Any @Default], Managed Bean [class org.jboss.aerogear.controller.demo.Routes] with qualifiers [@Any @Default]]]
	at org.jboss.as.weld.services.WeldService.start(WeldServic
@danbev
danbev / gist:3706552
Created September 12, 2012 13:21
What is Iogi used for in AeroGear Controller?

Iogi is used to unmarshall the HTTP Request and create a instance of a class, and populate that instance using values from the request parameters.

For example, when using the aerogear-controller-demo and entering the color and model of the car, the following parameters will be passed in the HTTP POST as form data:

car.color:red
car.brand:BMW

AeroGear Controller knows the type of the parameter for the target method, which it has gathered from the route configuration. By utilizing Iogi, it is very easy to create an instance of Car and populate its members color and brand: