This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/converter") | |
| public class ConverterResource { | |
| /** | |
| * The name of the path parameter for the API key. | |
| */ | |
| public static final String APP_ID = "app_id"; | |
| /** | |
| * A part of an error message. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CurrencyData { | |
| /** | |
| * A string with a disclaimer. | |
| */ | |
| private String disclaimer; | |
| /** | |
| * A string with a license. | |
| */ | |
| private String license; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DWGettingStartedConfiguration extends Configuration { | |
| ... | |
| /** | |
| * The URL to access exchange rate API. | |
| */ | |
| @NotEmpty | |
| private String apiURL; | |
| /** | |
| * The key to access exchange rate API. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #API settings | |
| #API URL | |
| apiURL: https://openexchangerates.org/api/latest.json | |
| #API key | |
| apiKey: <Your API key> | |
| #Jersey client settings | |
| jerseyClient: | |
| #The maximum idle time for a connection, once established. | |
| timeout: 512ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>io.dropwizard</groupId> | |
| <artifactId>dropwizard-client</artifactId> | |
| <version>${dropwizard.version}</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * The MIT License | |
| * | |
| * Copyright 2015 Dmitry Noranovich. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DWGettingStartedApplication | |
| extends Application<DWGettingStartedConfiguration> { | |
| ... | |
| @Override | |
| public void run(final DWGettingStartedConfiguration configuration, | |
| final Environment environment) { | |
| final EmployeeDAO employeeDAO | |
| = new EmployeeDAO(hibernateBundle.getSessionFactory()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DWGettingStartedApplication | |
| extends Application<DWGettingStartedConfiguration> { | |
| /** | |
| * Hibernate bundle. | |
| */ | |
| private final HibernateBundle<DWGettingStartedConfiguration> hibernateBundle | |
| = new HibernateBundle<DWGettingStartedConfiguration>( | |
| Employee.class | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/employees") | |
| @Produces(MediaType.APPLICATION_JSON) | |
| public class EmployeesResource { | |
| /** | |
| * The DAO object to manipulate employees. | |
| */ | |
| private EmployeeDAO employeeDAO; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EmployeeDAO extends AbstractDAO<Employee> { | |
| /** | |
| * Constructor. | |
| * | |
| * @param sessionFactory Hibernate session factory. | |
| */ | |
| public EmployeeDAO(SessionFactory sessionFactory) { | |
| super(sessionFactory); | |
| } |