<commit_before>Problem reporting support
=========================

The problem reporting support implements reporing problems for HTTP APIs according to [Problem Details for HTTP APIs](https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-02)


Server-side usage
--------------




**Example 1 - mapping a non http problem-aware exception (such as NumberFormatException) by mapping**
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
     
     long id = Long.paseLong(topicname); // may throw a NumberFormatException   
	
     //...    
}
```


**Example 2 - using a problem exceptions** 
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
        
     if (topicname.startsWith("@")) {
         // <<ToDo update this example>>  here a problem exception should be thrown
		 //...
     }    

     // ...
}
```


**Example 3 - generating a http response in a direct way**
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
     
     if (topicname.startsWith("@")) {
         // <<ToDo update this example>> here a problem error response should be returned
		 // ...
     }   

     // ...     <commit_msg>decription updated<commit_after>Problem reporting support
=========================

The problem reporting support implements reporing problems for HTTP APIs according to [Problem Details for HTTP APIs](https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-02)


Server-side usage
--------------




**Example 1 - mapping a non http-aware exception (such as NumberFormatException) by using mapping**
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
     
     long id = Long.paseLong(topicname); // may throw a NumberFormatException   
	
     //...    
}
```


**Example 2 - using http-aware problem exceptions** 
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
        
     if (topicname.startsWith("@")) {
         // <<ToDo update this example>>  here a problem exception should be thrown
		 //...
     }    

     // ...
}
```


**Example 3 - generating a http response in a direct way**
```
@GET
@Path("/topics/{topicname}")
@Produces("application/vnd.ui.example.topic+json; qs=0.8")
public TopicRepresentation getTopicJson(final @Context UriInfo uriInfo, 
							            final @PathParam("topicname") String topicname) {
     
     if (topicname.startsWith("@")) {
         // <<ToDo update this example>> here a problem error response should be returned
		 // ...
     }   

     // ...     
{'fraction_non_alphanumeric': 0.15290973871733968, 'fraction_numerical': 0.006532066508313539, 'mean_word_length': 2.9681978798586575, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4673638', 'n_tokens_mistral': 1049, 'n_tokens_neox': 950, 'n_words': 255}