{
18 | /**
19 | * Determines if, given the response object and the media types accepted by the client this
20 | * transformer can convert the response object into one of the accepted types
21 | *
22 | * @param response the response object that would need to be transformed
23 | * @param request the request which generated the response
24 | * @param mediaType The media type which matched in the {@link HttpMethod}'s produces AND in the client
25 | * set of accepted media types.
26 | * @return true if this transformer can convert the response to one of the supported media types...
27 | */
28 | boolean canTransform(Object response, HttpRequest request, MediaType mediaType,
29 | HttpMethod method, ChannelHandlerContext ctx);
30 |
31 | /**
32 | * Given the response object transform it into one of the accepted media types
33 | *
34 | * @param response the response object to be transformed
35 | * @param request the request which generated the response
36 | * @param httpResponse the HTTP response which will be returned to the client
37 | * @param method The method which was invoked to produce the response
38 | * @param ctx the channel context, provided in the case where an unrecoverable error is
39 | * encountered an error response can be returned by by passing the normal response
40 | * route @return an HTTP response. If null is returned the server will return
41 | * 406 Not Acceptable to the client...
42 | * (i.e. The requested resource is only capable of generating content not acceptable
43 | * according to the Accept headers sent in the request.)
44 | */
45 | void transform(Object response, HttpRequest request, HttpResponse httpResponse, MediaType mediaType,
46 | HttpMethod method,
47 | ChannelHandlerContext ctx);
48 |
49 | /**
50 | * @return If a transformer maintains state then this method should return a new instance every time.
51 | * If not then this should be returned.
52 | */
53 | ResponseTransformer instance();
54 | }
55 |
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/config.yml:
--------------------------------------------------------------------------------
1 | #if true a new instance of a resource is created per request otherwise, one instance serves all requests
2 | instance_per_request : true
3 | port : 3434
4 | log_requests : true
5 | #directory where sessions are persisted on disk
6 | session_dir : /tmp/hs3-sessions/
7 | session_path : /
8 | #ignored if null
9 | session_domain:
10 | #7 days in milliseconds
11 | session_max_age : 604800000
12 | session_http_only: false
13 | #ignored if null
14 | session_ports:
15 | #default error template used when no template is found for the specific error message
16 | default_error_template : error/default
17 | #add the default injector used to inject parameters into resource methods
18 | add_default_injector : true
19 | #if true static files will be served from template_config.
20 | add_static_resource_filter : true
21 | #path to the directory from which static files will be served (relative or absolute)
22 | #bare in mind if you want to serve files from the classpath a relative path is probably best
23 | #if the path is relative (doesn't start with /) then a / is automatically prepended before
24 | #checking on disk so "public" becomes "/public"
25 | public_directory : public
26 | #if true directories in public_directory will list the files in them
27 | enable_directory_listing : true
28 | #if true when its a directory, index_file will be sent automatically if set...
29 | serve_index_file : true
30 | #the name of the default file to serve from directories
31 | index_file : index.html
32 |
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #reduce the thymeleaf logging to warnings or above
2 | log4j.logger.org.thymeleaf = WARN
3 | # Root logger option
4 | log4j.rootLogger=INFO, file, stdout
5 |
6 | # Direct log messages to a log file
7 | log4j.appender.file=org.apache.log4j.RollingFileAppender
8 | log4j.appender.file.File=./var/log/hs3.log
9 | log4j.appender.file.MaxFileSize=100MB
10 | log4j.appender.file.MaxBackupIndex=5
11 | log4j.appender.file.layout=org.apache.log4j.PatternLayout
12 | log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
13 |
14 | # Direct log messages to stdout
15 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
16 | log4j.appender.stdout.Target=System.out
17 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
18 | log4j.appender.stdout.layout.ConversionPattern=%C %d{ABSOLUTE} %5p %c{1}:%L - %m%n
19 |
20 | #make request_logger output format different from normal logs
21 | log4j.logger.request_logger=DEBUG, request_logger_console,request_logger_file
22 | #prevent request logs from propagating to the root logger
23 | log4j.additivity.request_logger=false
24 |
25 | log4j.appender.request_logger_console=org.apache.log4j.ConsoleAppender
26 | log4j.appender.request_logger_console.layout=org.apache.log4j.PatternLayout
27 | log4j.appender.request_logger_console.layout.ConversionPattern=%m%n
28 |
29 | log4j.appender.request_logger_file=org.apache.log4j.RollingFileAppender
30 | log4j.appender.request_logger_file.layout=org.apache.log4j.PatternLayout
31 | log4j.appender.request_logger_file.layout.ConversionPattern=%m%n
32 |
33 | log4j.appender.request_logger_file.File=./var/log/hs3-requests.log
34 | log4j.appender.request_logger_file.MaxFileSize=100MB
35 | log4j.appender.request_logger_file.MaxBackupIndex=5
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/default.html:
--------------------------------------------------------------------------------
1 | Default file
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Static file demo
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zcourts/higgs/504504331ded8f276fc7862986747fdeff132d90/http/server/s3/src/main/resources/public/favicon.ico
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/header.html:
--------------------------------------------------------------------------------
1 | HTML header to be included in other templates.
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/index.html:
--------------------------------------------------------------------------------
1 | Some random index file
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/sub/defaultt.html:
--------------------------------------------------------------------------------
1 | Index in sub directory
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/public/sub/random.html:
--------------------------------------------------------------------------------
1 | Just random
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/shiro.ini:
--------------------------------------------------------------------------------
1 | [main]
2 | # set default session timeout to 1 day
3 | securityManager.sessionManager.globalSessionTimeout = 86400000
4 |
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/api.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Default template variable name |
6 | Size |
7 |
8 |
9 |
10 | ${_query.size} |
11 | ${_query.size} |
12 |
13 |
14 | ${_form.size} |
15 | ${_form.size} |
16 |
17 |
18 | ${_files.size} |
19 | ${_files.size} |
20 |
21 |
22 | ${_session} |
23 | ${_session.size} |
24 |
25 |
26 | ${_cookies.size} |
27 | ${_cookies.size} |
28 |
29 |
30 | ${_response} |
31 | ${_response} |
32 |
33 |
34 |
35 | Welcome to the Higgs Thymeleaf demo!
36 |
37 |
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/api_en.properties:
--------------------------------------------------------------------------------
1 | welcome=Welcome to the Higgs Thymeleaf demo!
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/api_es.properties:
--------------------------------------------------------------------------------
1 | welcome=Bienvenido a la demo Thymeleaf Higgs!
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/api_fr.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zcourts/higgs/504504331ded8f276fc7862986747fdeff132d90/http/server/s3/src/main/resources/templates/api_fr.properties
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/error/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Error
5 |
6 |
7 |
8 | Error
9 |
10 |
11 |
--------------------------------------------------------------------------------
/http/server/s3/src/main/resources/templates/footer.html:
--------------------------------------------------------------------------------
1 |