Skip to content

Commit

Permalink
Merge pull request #86 from analogweb/adapt-java-11
Browse files Browse the repository at this point in the history
Adapt java 11
  • Loading branch information
y2k2mt authored Dec 24, 2023
2 parents 8174cae + b198cf1 commit f7b305c
Show file tree
Hide file tree
Showing 317 changed files with 16,520 additions and 18,085 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: analogweb core CI

on:
push:
pull_request:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
cache: maven
distribution: 'temurin'
- name: Code Format Validation
run: mvn formatter:validate
- name: Test
run: mvn clean test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Analogweb Framework
===============================================

[![Build Status](https://travis-ci.org/analogweb/core.svg?branch=master)](https://travis-ci.org/analogweb/core)
[![Build Status](https://github.com/analogweb/core/actions/workflows/ci.yml/badge.svg)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.analogweb/analogweb-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.analogweb/analogweb-core)

Analogweb is a tiny HTTP oriented framework.
It depends only Java 8+.
It depends only Java 11+.

## Example

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
The MIT Lisence Copyright (c) 2011 - 2017 Analog Web Framework Development Team.
The MIT Lisence Copyright (c) 2011 - 2023 Analog Web Framework Development Team.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
Expand All @@ -23,7 +23,7 @@
<groupId>org.analogweb</groupId>
<artifactId>analogweb-core</artifactId>
<packaging>jar</packaging>
<version>0.11.2-SNAPSHOT</version>
<version>0.12.0-SNAPSHOT</version>
<name>analogweb-core</name>
<url>http://analogweb.org</url>
<organization>
Expand All @@ -50,7 +50,7 @@
<parent>
<groupId>org.analogweb</groupId>
<artifactId>analogweb-parent-modules</artifactId>
<version>18</version>
<version>21</version>
<relativePath />
</parent>
<build>
Expand Down
94 changes: 47 additions & 47 deletions src/main/java/org/analogweb/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,59 @@

/**
* An Analogweb application.
*
*
* @author snowgoose
*/
public interface Application extends Disposable {

String DEFAULT_PACKAGE_NAME = Application.class.getPackage().getName();
/**
* {@link RequestPath} not found.
*/
Response NOT_FOUND = Response.NOT_FOUND;
String DEFAULT_PACKAGE_NAME = Application.class.getPackage().getName();
/**
* {@link RequestPath} not found.
*/
Response NOT_FOUND = Response.NOT_FOUND;

/**
* Run application.
*
* @param resolver
* {@link ApplicationContext}
* @param collectors
* {@link ClassCollector}
* @param props
* {@link ApplicationProperties}
* @param classLoader
* {@link ClassLoader}
*/
void run(ApplicationContext resolver, ApplicationProperties props,
Collection<ClassCollector> collectors, ClassLoader classLoader);
/**
* Run application.
*
* @param resolver
* {@link ApplicationContext}
* @param collectors
* {@link ClassCollector}
* @param props
* {@link ApplicationProperties}
* @param classLoader
* {@link ClassLoader}
*/
void run(ApplicationContext resolver, ApplicationProperties props, Collection<ClassCollector> collectors,
ClassLoader classLoader);

/**
* Process request. Before then {@link Application} should be running.
*
* @param path
* {@link RequestPath}
* @param context
* {@link RequestContext}
* @param responseContext
* {@link ResponseContext}
* @throws IOException
* @throws WebApplicationException
*/
Response processRequest(RequestPath path, RequestContext context,
ResponseContext responseContext) throws IOException,
WebApplicationException;
/**
* Process request. Before then {@link Application} should be running.
*
* @param path
* {@link RequestPath}
* @param context
* {@link RequestContext}
* @param responseContext
* {@link ResponseContext}
*
* @throws IOException
* @throws WebApplicationException
*/
Response processRequest(RequestPath path, RequestContext context, ResponseContext responseContext)
throws IOException, WebApplicationException;

/**
* Obtain {@link Modules}.
*
* @return {@link Modules}
*/
Modules getModules();
/**
* Obtain {@link Modules}.
*
* @return {@link Modules}
*/
Modules getModules();

/**
* Obtain {@link RouteRegistry}.
*
* @return {@link RouteRegistry}
*/
RouteRegistry getRouteRegistry();
/**
* Obtain {@link RouteRegistry}.
*
* @return {@link RouteRegistry}
*/
RouteRegistry getRouteRegistry();
}
23 changes: 12 additions & 11 deletions src/main/java/org/analogweb/ApplicationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

/**
* Context of application.
*
*
* @author snowgoose
*/
public interface ApplicationContext {

/**
* Obtain application scoped attributes.
*
* @param requiredType
* Type of attribute value.
* @param contextKey
* Key of attribute value.
* @return Attribute value.
*/
<T> T getAttribute(Class<T> requiredType, String contextKey);
/**
* Obtain application scoped attributes.
*
* @param requiredType
* Type of attribute value.
* @param contextKey
* Key of attribute value.
*
* @return Attribute value.
*/
<T> T getAttribute(Class<T> requiredType, String contextKey);
}
168 changes: 83 additions & 85 deletions src/main/java/org/analogweb/ApplicationProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,96 @@

/**
* Interrupt application phases.
*
*
* @author snowgoose
*/
public interface ApplicationProcessor extends MultiModule, Precedence {

/**
* End of process without interruption.
*/
Object NO_INTERRUPTION = new Object();
/**
* End of process without interruption.
*/
Object NO_INTERRUPTION = new Object();

/**
* Interrupt before matching requested URI. Returns expect
* {@link #NO_INTERRUPTION}, finish process request with return value.
*
* @param request
* {@link MutableRequestContext}
* @param path
* {@link RequestPath}
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object preMatching(MutableRequestContext request, RequestPath path);
/**
* Interrupt before matching requested URI. Returns expect {@link #NO_INTERRUPTION}, finish process request with
* return value.
*
* @param request
* {@link MutableRequestContext}
* @param path
* {@link RequestPath}
*
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object preMatching(MutableRequestContext request, RequestPath path);

/**
* Interrupt before invoking {@link Invocation}. Returns expect
* {@link #NO_INTERRUPTION}, finish process request with return value.
*
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
* @param context
* {@link RequestContext}
* @param converters
* {@link TypeMapperContext}
* @param resolvers
* {@link RequestValueResolvers}
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object prepareInvoke(InvocationArguments args, InvocationMetadata metadata,
RequestContext context, TypeMapperContext converters,
RequestValueResolvers resolvers);
/**
* Interrupt before invoking {@link Invocation}. Returns expect {@link #NO_INTERRUPTION}, finish process request
* with return value.
*
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
* @param context
* {@link RequestContext}
* @param converters
* {@link TypeMapperContext}
* @param resolvers
* {@link RequestValueResolvers}
*
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object prepareInvoke(InvocationArguments args, InvocationMetadata metadata, RequestContext context,
TypeMapperContext converters, RequestValueResolvers resolvers);

/**
* Interrupt after cause exception when execute {@link Application}. Returns
* expect {@link #NO_INTERRUPTION}, finish process request with return
* value.
*
* @param ex
* Caused exception when execute {@link Application}.
* @param request
* {@link RequestContext}
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object processException(Exception ex, RequestContext request,
PreparedInvocationArguments args, InvocationMetadata metadata);
/**
* Interrupt after cause exception when execute {@link Application}. Returns expect {@link #NO_INTERRUPTION}, finish
* process request with return value.
*
* @param ex
* Caused exception when execute {@link Application}.
* @param request
* {@link RequestContext}
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
*
* @return {@link #NO_INTERRUPTION} or {@link Renderable}
*/
Object processException(Exception ex, RequestContext request, PreparedInvocationArguments args,
InvocationMetadata metadata);

/**
* Interrupt after execute {@link Application}. Returns expect
* {@link #NO_INTERRUPTION}, finish process request with return value.
*
* @param invocationResult
* {@link Application}の実行結果
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
* @param context
* {@link RequestContext}
* @param resolvers
* {@link RequestValueResolvers}
*/
void postInvoke(Object invocationResult, InvocationArguments args,
InvocationMetadata metadata, RequestContext context,
RequestValueResolvers resolvers);
/**
* Interrupt after execute {@link Application}. Returns expect {@link #NO_INTERRUPTION}, finish process request with
* return value.
*
* @param invocationResult
* {@link Application}の実行結果
* @param args
* {@link InvocationArguments}
* @param metadata
* {@link InvocationMetadata}
* @param context
* {@link RequestContext}
* @param resolvers
* {@link RequestValueResolvers}
*/
void postInvoke(Object invocationResult, InvocationArguments args, InvocationMetadata metadata,
RequestContext context, RequestValueResolvers resolvers);

/**
* Interrupt after execute {@link Application}(include exception occurred).
* When
* {@link #processException(Exception, RequestContext, PreparedInvocationArguments, InvocationMetadata)}
* returns value, this method has no effect.
*
* @param request
* {@link RequestContext}
* @param response
* {@link ResponseContext}
* @param e
* {@link Exception}
*/
void afterCompletion(RequestContext request, ResponseContext response,
Exception e);
/**
* Interrupt after execute {@link Application}(include exception occurred). When
* {@link #processException(Exception, RequestContext, PreparedInvocationArguments, InvocationMetadata)} returns
* value, this method has no effect.
*
* @param request
* {@link RequestContext}
* @param response
* {@link ResponseContext}
* @param e
* {@link Exception}
*/
void afterCompletion(RequestContext request, ResponseContext response, Exception e);
}
Loading

0 comments on commit f7b305c

Please sign in to comment.