Revert "Removing HTML media type"
This reverts commit a243105b01a2ac9e26189da8078d4c2c44200868.
This commit is contained in:
parent
a243105b01
commit
12ce3ee247
@ -23,13 +23,14 @@ public class ContentManagementWebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {
|
||||
configurer.favorPathExtension(false).
|
||||
favorParameter(true).
|
||||
configurer.favorPathExtension(true).
|
||||
favorParameter(false).
|
||||
parameterName("mediaType").
|
||||
ignoreAcceptHeader(true).
|
||||
useJaf(false).
|
||||
defaultContentType(MediaType.APPLICATION_JSON).
|
||||
defaultContentType(MediaType.TEXT_HTML).
|
||||
mediaType("xml", MediaType.APPLICATION_XML).
|
||||
mediaType("html", MediaType.TEXT_HTML).
|
||||
mediaType("json", MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,15 @@ public class EmployeeController {
|
||||
return employeeMap.get(Id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/employee/{Id}", method = RequestMethod.GET)
|
||||
public String getEmployeeByIdHtmlView(@PathVariable final long Id, final ModelMap model) {
|
||||
model.addAttribute("name", employeeMap.get(Id).getName());
|
||||
model.addAttribute("contactNumber", employeeMap.get(Id).getContactNumber());
|
||||
model.addAttribute("id", employeeMap.get(Id).getId());
|
||||
|
||||
return "employeeView";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addEmployee", method = RequestMethod.POST)
|
||||
public String submit(@ModelAttribute("employee") final Employee employee, final BindingResult result, final ModelMap model) {
|
||||
if (result.hasErrors()) {
|
||||
|
@ -30,6 +30,15 @@ public class EmployeeController {
|
||||
return employeeMap.get(Id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/employee/{Id}", method = RequestMethod.GET)
|
||||
public String getEmployeeByIdHtmlView(@PathVariable final long Id, final ModelMap model) {
|
||||
model.addAttribute("name", employeeMap.get(Id).getName());
|
||||
model.addAttribute("contactNumber", employeeMap.get(Id).getContactNumber());
|
||||
model.addAttribute("id", employeeMap.get(Id).getId());
|
||||
|
||||
return "employeeView";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addEmployee", method = RequestMethod.POST)
|
||||
public String submit(@ModelAttribute("employee") final Employee employee, final BindingResult result, final ModelMap model) {
|
||||
if (result.hasErrors()) {
|
||||
|
@ -23,15 +23,16 @@
|
||||
<!-- Content strategy using path extension -->
|
||||
<bean id="contentNegotiationManager"
|
||||
class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
|
||||
<property name="favorPathExtension" value="false" />
|
||||
<property name="favorParameter" value="true"/>
|
||||
<property name="favorPathExtension" value="true" />
|
||||
<property name="favorParameter" value="false"/>
|
||||
<property name="parameterName" value="mediaType"/>
|
||||
<property name="ignoreAcceptHeader" value="true" />
|
||||
<property name="defaultContentType" value="application/json" />
|
||||
<property name="defaultContentType" value="text/html" />
|
||||
<property name="useJaf" value="false" />
|
||||
|
||||
<property name="mediaTypes">
|
||||
<map>
|
||||
<entry key="html" value="text/html" />
|
||||
<entry key="json" value="application/json" />
|
||||
<entry key="xml" value="application/xml" />
|
||||
</map>
|
||||
|
Loading…
x
Reference in New Issue
Block a user