Skip to content
Snippets Groups Projects
Commit 146f96ce authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'login-with-dot-error' into 'master'

User login with dot produced errors

See merge request !56
parents 5a312582 f2d5b065
No related branches found
No related tags found
1 merge request!56User login with dot produced errors
-- some sequences had too low values
DO $$
DECLARE
rec RECORD;
size INT;
BEGIN
FOR rec IN SELECT * FROM information_schema.sequences LOOP
/*RAISE NOTICE 'SELECT MAX(iddb)+1 FROM %', REPLACE(rec.sequence_name, '_iddb_seq', '');*/
EXECUTE format('SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''%s''', REPLACE(rec.sequence_name, '_iddb_seq', '')) INTO size;
IF size = 1 THEN
EXECUTE format('SELECT setval(''%s'', (SELECT MAX(iddb)+1 FROM %I))', rec.sequence_name, REPLACE(rec.sequence_name, '_iddb_seq', ''));
END IF;
EXECUTE format('SELECT COUNT(1) FROM information_schema.tables WHERE table_name = ''%s''', REPLACE(rec.sequence_name, '_iddb_seq', '_table')) INTO size;
IF size = 1 THEN
EXECUTE format('SELECT setval(''%s'', (SELECT MAX(iddb)+1 FROM %I))', rec.sequence_name, REPLACE(rec.sequence_name, '_iddb_seq', '_table'));
END IF;
END LOOP;
END $$;
\ No newline at end of file
package lcsb.mapviewer.api;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* This class is a configuration for spring that disables content type
* recognition based on the "extension" (last part after dot in url). It allows
* API to return json for urls like: http://localhost:8080/minerva/api/users/t.t
*
* More info can be found here:
* <ul>
* <li>https://spring.io/blog/2013/05/11/content-negotiation-using-spring-mvc
* </li>
* <li>https://stackoverflow.com/questions/30793717/spring-throwing-
* httpmediatypenotacceptableexception-could-not-find-acceptable-r</li>
* </ul>
*
* @author Piotr Gawron
*
*/
@Configuration
@EnableWebMvc
public class ContentNegotiationConfig extends WebMvcConfigurerAdapter {
@Override
public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {
// Turn off suffix-based content negotiation
configurer.favorPathExtension(false);
}
}
\ No newline at end of file
......@@ -29,7 +29,7 @@ public class ProjectController extends BaseController {
@Autowired
private ProjectRestImpl projectController;
@RequestMapping(value = "/projects/{projectId}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = "/projects/{projectId:.+}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ProjectMetaData getMetaData(//
@PathVariable(value = "projectId") String projectId, //
@CookieValue(value = Configuration.AUTH_TOKEN) String token //
......
......@@ -70,7 +70,7 @@ public class UserController extends BaseController {
}
}
@RequestMapping(value = "/users/{login}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = "/users/{login:.+}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public Map<String, Object> getUser(//
@CookieValue(value = Configuration.AUTH_TOKEN) String token, //
@PathVariable(value = "login") String login, //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment